From patchwork Fri Sep 2 22:39:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Wood X-Patchwork-Id: 1123012 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p82Mdi91024567 for ; Fri, 2 Sep 2011 22:39:45 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756407Ab1IBWjk (ORCPT ); Fri, 2 Sep 2011 18:39:40 -0400 Received: from tx2ehsobe002.messaging.microsoft.com ([65.55.88.12]:28170 "EHLO TX2EHSOBE003.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756345Ab1IBWjk (ORCPT ); Fri, 2 Sep 2011 18:39:40 -0400 Received: from mail169-tx2-R.bigfish.com (10.9.14.243) by TX2EHSOBE003.bigfish.com (10.9.40.23) with Microsoft SMTP Server id 14.1.225.22; Fri, 2 Sep 2011 22:39:39 +0000 Received: from mail169-tx2 (localhost.localdomain [127.0.0.1]) by mail169-tx2-R.bigfish.com (Postfix) with ESMTP id 2309815A0212; Fri, 2 Sep 2011 22:39:39 +0000 (UTC) X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839h944h62h) X-Spam-TCS-SCL: 1:0 X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPVD:NLI; H:mail.freescale.net; RD:none; EFVD:NLI Received: from mail169-tx2 (localhost.localdomain [127.0.0.1]) by mail169-tx2 (MessageSwitch) id 131500317947514_23051; Fri, 2 Sep 2011 22:39:39 +0000 (UTC) Received: from TX2EHSMHS021.bigfish.com (unknown [10.9.14.242]) by mail169-tx2.bigfish.com (Postfix) with ESMTP id 05EFA1168052; Fri, 2 Sep 2011 22:39:39 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by TX2EHSMHS021.bigfish.com (10.9.99.121) with Microsoft SMTP Server (TLS) id 14.1.225.22; Fri, 2 Sep 2011 22:39:38 +0000 Received: from az33smr02.freescale.net (10.64.34.200) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server id 14.1.323.2; Fri, 2 Sep 2011 17:39:37 -0500 Received: from schlenkerla.am.freescale.net (schlenkerla.am.freescale.net [10.82.121.12]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id p82MdbZj024336; Fri, 2 Sep 2011 17:39:37 -0500 (CDT) Date: Fri, 2 Sep 2011 17:39:37 -0500 From: Scott Wood To: CC: , Subject: [PATCH v2] KVM: PPC: e500: Don't hardcode PIR=0 Message-ID: <20110902223936.GA17355@schlenkerla.am.freescale.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-OriginatorOrg: freescale.com Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 02 Sep 2011 22:39:45 +0000 (UTC) The hardcoded behavior prevents proper SMP support. QEMU shall specify the vcpu's PIR as the vcpu id. Signed-off-by: Scott Wood --- v2: More detailed commit message. arch/powerpc/kvm/booke.c | 4 ++-- arch/powerpc/kvm/e500.c | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index ee45fa0..d967faf 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c @@ -753,7 +753,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; @@ -766,7 +766,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 b8f065c..e8f5ec2 100644 --- a/arch/powerpc/kvm/e500.c +++ b/arch/powerpc/kvm/e500.c @@ -70,9 +70,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; - return 0; }