Patchwork [06/50] KVM: PPC: e500: Don't hardcode PIR=0

login
register
mail settings
Submitter Alexander Graf
Date Jan. 4, 2012, 1:10 a.m.
Message ID <1325639448-9494-7-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/134170/
State New
Headers show

Comments

Alexander Graf - Jan. 4, 2012, 1:10 a.m.
From: Scott Wood <scottwood@freescale.com>

The hardcoded behavior prevents proper SMP support.

QEMU 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>
---
 arch/powerpc/kvm/booke.c |    4 ++--
 arch/powerpc/kvm/e500.c  |    3 ---
 2 files changed, 2 insertions(+), 5 deletions(-)
Avi Kivity - Jan. 8, 2012, 1:14 p.m.
On 01/04/2012 03:10 AM, Alexander Graf wrote:
> From: Scott Wood <scottwood@freescale.com>
>
> The hardcoded behavior prevents proper SMP support.
>
> QEMU shall specify the vcpu's PIR as the vcpu id.

s/QEMU/userspace/
Alexander Graf - Jan. 8, 2012, 2:53 p.m.
On 08.01.2012, at 14:14, Avi Kivity wrote:

> On 01/04/2012 03:10 AM, Alexander Graf wrote:
>> From: Scott Wood <scottwood@freescale.com>
>> 
>> The hardcoded behavior prevents proper SMP support.
>> 
>> QEMU shall specify the vcpu's PIR as the vcpu id.
> 
> s/QEMU/userspace/

This is a pull request, not a review request. While I'm open to suggestions on ABI corrections, I'd rather not go in and randomly change other people's commit descriptions :).


Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Avi Kivity - Jan. 8, 2012, 2:56 p.m.
On 01/08/2012 04:53 PM, Alexander Graf wrote:
> On 08.01.2012, at 14:14, Avi Kivity wrote:
>
> > On 01/04/2012 03:10 AM, Alexander Graf wrote:
> >> From: Scott Wood <scottwood@freescale.com>
> >> 
> >> The hardcoded behavior prevents proper SMP support.
> >> 
> >> QEMU shall specify the vcpu's PIR as the vcpu id.
> > 
> > s/QEMU/userspace/
>
> This is a pull request, not a review request. 

You get it for free, when you ask me to pull.

> While I'm open to suggestions on ABI corrections, I'd rather not go in and randomly change other people's commit descriptions :).

If it's the only change, okay, otherwise please do change it.  And keep
it in mind for the future.

Patch

diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index bb6c988..b642200 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -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;
diff --git a/arch/powerpc/kvm/e500.c b/arch/powerpc/kvm/e500.c
index f17d7e7..ac3c4bf 100644
--- a/arch/powerpc/kvm/e500.c
+++ b/arch/powerpc/kvm/e500.c
@@ -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;