aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-12-07 11:11:03 +0200
committerAvi Kivity <avi@redhat.com>2009-12-07 11:11:03 +0200
commitc859bf47e565062b7801a18966913142cf59eda8 (patch)
tree45b0d133200af9e62d052d7145a604e7d3d23cc0 /target-ppc
parentMerge commit '40ff6d7e8dceca227e7f8a3e8e0d58b2c66d19b4' into upstream-merge (diff)
parentkvm: x86: Add support for VCPU event states (diff)
downloadqemu-kvm-c859bf47e565062b7801a18966913142cf59eda8.tar.gz
qemu-kvm-c859bf47e565062b7801a18966913142cf59eda8.tar.bz2
qemu-kvm-c859bf47e565062b7801a18966913142cf59eda8.zip
Merge commit 'a0fb002c6462d21ceb9eac8c5772e469ec189374' into upstream-merge
* commit 'a0fb002c6462d21ceb9eac8c5772e469ec189374': kvm: x86: Add support for VCPU event states kvm: x86: Fix merge artifact of f8d926e9 about mp_state targe-ppc: Sync CPU state for KVM target-ppc: Get MMU state on register sync qemu: cleanup unused macros in cirrus qemu: make cirrus init value pci spec compliant Conflicts: kvm-all.c target-i386/kvm.c Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'target-ppc')
-rw-r--r--target-ppc/kvm.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 4e1c65f12..2b5abf430 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -98,12 +98,17 @@ int kvm_arch_put_registers(CPUState *env)
int kvm_arch_get_registers(CPUState *env)
{
struct kvm_regs regs;
+ struct kvm_sregs sregs;
uint32_t i, ret;
ret = kvm_vcpu_ioctl(env, KVM_GET_REGS, &regs);
if (ret < 0)
return ret;
+ ret = kvm_vcpu_ioctl(env, KVM_GET_SREGS, &sregs);
+ if (ret < 0)
+ return ret;
+
env->ctr = regs.ctr;
env->lr = regs.lr;
env->xer = regs.xer;
@@ -125,6 +130,31 @@ int kvm_arch_get_registers(CPUState *env)
for (i = 0;i < 32; i++)
env->gpr[i] = regs.gpr[i];
+#ifdef KVM_CAP_PPC_SEGSTATE
+ if (kvm_check_extension(env->kvm_state, KVM_CAP_PPC_SEGSTATE)) {
+ env->sdr1 = sregs.u.s.sdr1;
+
+ /* Sync SLB */
+ for (i = 0; i < 64; i++) {
+ ppc_store_slb(env, sregs.u.s.ppc64.slb[i].slbe,
+ sregs.u.s.ppc64.slb[i].slbv);
+ }
+
+ /* Sync SRs */
+ for (i = 0; i < 16; i++) {
+ env->sr[i] = sregs.u.s.ppc32.sr[i];
+ }
+
+ /* Sync BATs */
+ for (i = 0; i < 8; i++) {
+ env->DBAT[0][i] = sregs.u.s.ppc32.dbat[i] & 0xffffffff;
+ env->DBAT[1][i] = sregs.u.s.ppc32.dbat[i] >> 32;
+ env->IBAT[0][i] = sregs.u.s.ppc32.ibat[i] & 0xffffffff;
+ env->IBAT[1][i] = sregs.u.s.ppc32.ibat[i] >> 32;
+ }
+ }
+#endif
+
return 0;
}