Set PVR in sregs
authorAlexander Graf <agraf@suse.de>
Fri, 17 Jul 2009 11:51:43 +0000 (13:51 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Wed, 22 Jul 2009 15:58:45 +0000 (10:58 -0500)
We need to tell the kernel about some initial CPU state we don't have yet,
so let's use the "sregs" IOCTL for that and simply put the Processor Version
Register in there.

Now the kernel knows which guest CPU to virtualize.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
target-ppc/kvm.c

index acbb1abd2b292d85b34ea8f04d35f173303a73d8..04bb305a37b9a953e7adb75f4ac38231cdfe70d4 100644 (file)
@@ -44,7 +44,13 @@ int kvm_arch_init(KVMState *s, int smp_cpus)
 
 int kvm_arch_init_vcpu(CPUState *cenv)
 {
-    return 0;
+    int ret = 0;
+    struct kvm_sregs sregs;
+
+    sregs.pvr = cenv->spr[SPR_PVR];
+    ret = kvm_vcpu_ioctl(cenv, KVM_SET_SREGS, &sregs);
+
+    return ret;
 }
 
 int kvm_arch_put_registers(CPUState *env)