ppc: Make kvm_arch_put_registers() put *all* the registers
commitf1af19d767073a0926ce12c19b1f06c4933bca35
authorDavid Gibson <david@gibson.dropbear.id.au>
Wed, 12 Sep 2012 16:57:09 +0000 (12 16:57 +0000)
committerAlexander Graf <agraf@suse.de>
Thu, 4 Oct 2012 13:54:17 +0000 (4 15:54 +0200)
tree110cc5b921781bca1df01270a05e9f7d767944ab
parent89243b3b0183471a373d1457e7f93811773b64a7
ppc: Make kvm_arch_put_registers() put *all* the registers

At least when invoked with high enough 'level' arguments,
kvm_arch_put_registers() is supposed to copy essentially all the cpu state
as encoded in qemu's internal structures into the kvm state.  Currently
the ppc version does not do this - it never calls KVM_SET_SREGS, for
example, and therefore never sets the SDR1 and various other important
though rarely changed registers.

Instead, the code paths which need to set these registers need to
explicitly make (conditional) kvm calls which transfer the changes to kvm.
This breaks the usual model of handling state updates in qemu, where code
just changes the internal model and has it flushed out to kvm automatically
at some later point.

This patch fixes this for Book S ppc CPUs by adding a suitable call to
KVM_SET_SREGS and als to KVM_SET_ONE_REG to set the HIOR (the only register
that is set with that call so far).  This lets us remove the hacks to
explicitly set these registers from the kvmppc_set_papr() function.

The problem still exists for Book E CPUs (which use a different version of
the kvm_sregs structure).  But fixing that has some complications of its
own so can be left to another day.

Lkewise, there is still some ugly code for setting the PVR through special
calls to SET_SREGS which is left in for now.  The PVR needs to be set
especially early because it can affect what other features are available
on the CPU, so I need to do more thinking to see if it can be integrated
into the normal paths or not.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
target-ppc/kvm.c