KVM: PPC: e500: Don't hardcode PIR=0
authorScott Wood <scottwood@freescale.com>
Fri, 2 Sep 2011 22:39:37 +0000 (17:39 -0500)
committerAvi Kivity <avi@redhat.com>
Mon, 5 Mar 2012 12:52:24 +0000 (14:52 +0200)
The hardcoded behavior prevents proper SMP support.

user space shall specify the vcpu's PIR as the vcpu id.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/powerpc/kvm/booke.c
arch/powerpc/kvm/e500.c

index bb6c988f010aa29b0732d628788547456e6b577c..b64220079d561a4fc6f0b9324d0deeedfc1df787 100644 (file)
@@ -761,7 +761,7 @@ static void get_sregs_arch206(struct kvm_vcpu *vcpu,
 {
        sregs->u.e.features |= KVM_SREGS_E_ARCH206;
 
-       sregs->u.e.pir = 0;
+       sregs->u.e.pir = vcpu->vcpu_id;
        sregs->u.e.mcsrr0 = vcpu->arch.mcsrr0;
        sregs->u.e.mcsrr1 = vcpu->arch.mcsrr1;
        sregs->u.e.decar = vcpu->arch.decar;
@@ -774,7 +774,7 @@ static int set_sregs_arch206(struct kvm_vcpu *vcpu,
        if (!(sregs->u.e.features & KVM_SREGS_E_ARCH206))
                return 0;
 
-       if (sregs->u.e.pir != 0)
+       if (sregs->u.e.pir != vcpu->vcpu_id)
                return -EINVAL;
 
        vcpu->arch.mcsrr0 = sregs->u.e.mcsrr0;
index f17d7e732a1e03be5238ff01047d2dbcde908f39..ac3c4bf21677e3de73c5650fed861216475b204a 100644 (file)
@@ -71,9 +71,6 @@ int kvmppc_core_vcpu_setup(struct kvm_vcpu *vcpu)
        vcpu->arch.pvr = mfspr(SPRN_PVR);
        vcpu_e500->svr = mfspr(SPRN_SVR);
 
-       /* Since booke kvm only support one core, update all vcpus' PIR to 0 */
-       vcpu->vcpu_id = 0;
-
        vcpu->arch.cpu_type = KVM_CPU_E500V2;
 
        return 0;