Patchwork target-ppc kvm: save cr register

login
register
mail settings
Submitter Alexey Kardashevskiy
Date May 30, 2013, 9:26 a.m.
Message ID <1369905970-27249-1-git-send-email-aik@ozlabs.ru>
Download mbox | patch
Permalink /patch/247503/
State New
Headers show

Comments

Alexey Kardashevskiy - May 30, 2013, 9:26 a.m.
This adds a missing code to save CR (condition register) via
kvm_arch_put_registers(). kvm_arch_get_registers() already has it.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 target-ppc/kvm.c |    5 +++++
 1 file changed, 5 insertions(+)
David Gibson - June 4, 2013, 12:11 p.m.
On Thu, May 30, 2013 at 07:26:10PM +1000, Alexey Kardashevskiy wrote:
> This adds a missing code to save CR (condition register) via
> kvm_arch_put_registers(). kvm_arch_get_registers() already has it.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

Huh.  I can't believe that's been broken for so long.  I'll put that
in my tree.

I meant to post my pending patches at the end of last week, but was
sidetracked by a minor injury :(.
Alexey Kardashevskiy - June 5, 2013, 2:36 a.m.
On 06/04/2013 10:11 PM, David Gibson wrote:
> On Thu, May 30, 2013 at 07:26:10PM +1000, Alexey Kardashevskiy wrote:
>> This adds a missing code to save CR (condition register) via
>> kvm_arch_put_registers(). kvm_arch_get_registers() already has it.
>>
>> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> 
> Huh.  I can't believe that's been broken for so long.  I'll put that
> in my tree.

We probably have another bug which compensates this one but just have not
found it yet :-D


> I meant to post my pending patches at the end of last week, but was
> sidetracked by a minor injury :(.

Sigh...
What exactly are you going to post? PCI rework?
David Gibson - June 5, 2013, 9:22 a.m.
On Wed, Jun 05, 2013 at 12:36:04PM +1000, Alexey Kardashevskiy wrote:
> On 06/04/2013 10:11 PM, David Gibson wrote:
> > On Thu, May 30, 2013 at 07:26:10PM +1000, Alexey Kardashevskiy wrote:
> >> This adds a missing code to save CR (condition register) via
> >> kvm_arch_put_registers(). kvm_arch_get_registers() already has it.
> >>
> >> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> > 
> > Huh.  I can't believe that's been broken for so long.  I'll put that
> > in my tree.
> 
> We probably have another bug which compensates this one but just have not
> found it yet :-D

Yay :/.

> > I meant to post my pending patches at the end of last week, but was
> > sidetracked by a minor injury :(.
> 
> Sigh...
> What exactly are you going to post? PCI rework?

Well until now the only thing I had in my ppc-next tree was the change
of default machine.  I have the PCI stuff too, but that's no PCI
related so I was going to post those separately, rather than as a PPC
pull request.
Alexey Kardashevskiy - June 5, 2013, 10:54 a.m.
On 05.06.2013 19:22, David Gibson wrote:

>>> I meant to post my pending patches at the end of last week, but was
>>> sidetracked by a minor injury :(.
>>
>> Sigh...
>> What exactly are you going to post? PCI rework?
> 
> Well until now the only thing I had in my ppc-next tree was the change
> of default machine. 

btw what is going on with this patch?

> I have the PCI stuff too, but that's no PCI
> related so I was going to post those separately, rather than as a PPC
> pull request.


I guess I still want this stuff for VFIO, some bits.
David Gibson - June 5, 2013, 11:12 a.m.
On Wed, Jun 05, 2013 at 08:54:38PM +1000, Alexey Kardashevskiy wrote:
> On 05.06.2013 19:22, David Gibson wrote:
> 
> >>> I meant to post my pending patches at the end of last week, but was
> >>> sidetracked by a minor injury :(.
> >>
> >> Sigh...
> >> What exactly are you going to post? PCI rework?
> > 
> > Well until now the only thing I had in my ppc-next tree was the change
> > of default machine. 
> 
> btw what is going on with this patch?

I've pulled it into my github tree at
git://github.com/dgibson/qemu.git, ppc-next branch.  I'm still trying
to find time to push that out.

Patch

diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 2bbc3b8..c89dd58 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -791,6 +791,11 @@  int kvm_arch_put_registers(CPUState *cs, int level)
     for (i = 0;i < 32; i++)
         regs.gpr[i] = env->gpr[i];
 
+    regs.cr = 0;
+    for (i = 0; i < 8; i++) {
+        regs.cr |= (env->crf[i] & 15) << (4 * (7 - i));
+    }
+
     ret = kvm_vcpu_ioctl(cs, KVM_SET_REGS, &regs);
     if (ret < 0)
         return ret;