From patchwork Fri May 10 09:40:01 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caraman Mihai Claudiu-B02008 X-Patchwork-Id: 2549271 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 35164DF2A2 for ; Fri, 10 May 2013 09:40:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752586Ab3EJJkK (ORCPT ); Fri, 10 May 2013 05:40:10 -0400 Received: from co1ehsobe003.messaging.microsoft.com ([216.32.180.186]:13953 "EHLO co1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752240Ab3EJJkH convert rfc822-to-8bit (ORCPT ); Fri, 10 May 2013 05:40:07 -0400 Received: from mail6-co1-R.bigfish.com (10.243.78.250) by CO1EHSOBE036.bigfish.com (10.243.66.101) with Microsoft SMTP Server id 14.1.225.23; Fri, 10 May 2013 09:40:07 +0000 Received: from mail6-co1 (localhost [127.0.0.1]) by mail6-co1-R.bigfish.com (Postfix) with ESMTP id 104B0900255; Fri, 10 May 2013 09:40:07 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 3 X-BigFish: VS3(z52aesz9371I542I1432I179dNdb82hzz1f42h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ah1fc6hzz8275bhz2dh2a8h668h839h8e2h8e3h944hd25hf0ah1220h1288h12a5h12a9h12bdh137ah13b6h1441h1504h1537h153bh15d0h162dh1631h1758h18e1h1946h19b5h1ad9h1b0ah1d0ch1d2eh1d3fhbe9i1155h) Received: from mail6-co1 (localhost.localdomain [127.0.0.1]) by mail6-co1 (MessageSwitch) id 1368178805681607_18804; Fri, 10 May 2013 09:40:05 +0000 (UTC) Received: from CO1EHSMHS002.bigfish.com (unknown [10.243.78.227]) by mail6-co1.bigfish.com (Postfix) with ESMTP id A1041440048; Fri, 10 May 2013 09:40:05 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CO1EHSMHS002.bigfish.com (10.243.66.12) with Microsoft SMTP Server (TLS) id 14.1.225.23; Fri, 10 May 2013 09:40:03 +0000 Received: from 039-SN2MPN1-011.039d.mgd.msft.net ([169.254.1.117]) by 039-SN1MMR1-003.039d.mgd.msft.net ([10.84.1.16]) with mapi id 14.02.0328.011; Fri, 10 May 2013 09:40:02 +0000 From: Caraman Mihai Claudiu-B02008 To: Wood Scott-B07421 , Alexander Graf CC: "kvm-ppc@vger.kernel.org" , "kvm@vger.kernel.org" Subject: RE: [PATCH] kvm/ppc/booke64: fix build breakage from Altivec, and disable e6500 Thread-Topic: [PATCH] kvm/ppc/booke64: fix build breakage from Altivec, and disable e6500 Thread-Index: AQHOTSyV3W8RCuHpx0qdeO27wEqVN5j+AZGA Date: Fri, 10 May 2013 09:40:01 +0000 Message-ID: <300B73AA675FCE4A93EB4FC1D42459FF3FE2FA@039-SN2MPN1-011.039d.mgd.msft.net> References: <1368155698-15784-1-git-send-email-scottwood@freescale.com> In-Reply-To: <1368155698-15784-1-git-send-email-scottwood@freescale.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.171.73.132] MIME-Version: 1.0 X-OriginatorOrg: freescale.com Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org > -----Original Message----- > From: Wood Scott-B07421 > Sent: Friday, May 10, 2013 6:15 AM > To: Alexander Graf > Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; Wood Scott-B07421; > Caraman Mihai Claudiu-B02008 > Subject: [PATCH] kvm/ppc/booke64: fix build breakage from Altivec, and > disable e6500 > > BookE altivec support brought two new exceptions, but KVM was not > updated, so the build broke for all 64-bit booke with KVM enabled. We couldn't do that in KVM before having BOOKE_INTERRUPT_ALTIVEC_UNAVAIL/ BOOKE_INTERRUPT_ALTIVEC_ASSIST. As Tiejun noticed earlier we should have done this in Kumar's tree but we missed that chance. We will face similar issues every time an exception handler will be added. > > Add the new vectors, but there's more than this required to make > Altivec work in the guest, and we can't prevent the guest from turning > on Altivec (which can corrupt host state until state save/restore is > implemented). Disable e6500 on KVM until this is fixed. To be more precise it can corrupt Altivec host state. > > Signed-off-by: Scott Wood > Cc: Mihai Caraman > --- > arch/powerpc/kvm/bookehv_interrupts.S | 4 ++++ > arch/powerpc/kvm/e500mc.c | 2 -- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/kvm/bookehv_interrupts.S > b/arch/powerpc/kvm/bookehv_interrupts.S > index e8ed7d6..6397613 100644 > --- a/arch/powerpc/kvm/bookehv_interrupts.S > +++ b/arch/powerpc/kvm/bookehv_interrupts.S > @@ -309,6 +309,10 @@ kvm_handler BOOKE_INTERRUPT_DOORBELL_CRITICAL, > EX_PARAMS(CRIT), \ > SPRN_CSRR0, SPRN_CSRR1, 0 > kvm_handler BOOKE_INTERRUPT_HV_PRIV, EX_PARAMS(GEN), \ > SPRN_SRR0, SPRN_SRR1, NEED_EMU > +kvm_handler BOOKE_INTERRUPT_ALTIVEC_UNAVAIL, EX_PARAMS(GEN), \ > + SPRN_SRR0, SPRN_SRR1, 0 > +kvm_handler BOOKE_INTERRUPT_ALTIVEC_ASSIST, EX_PARAMS(GEN), \ > + SPRN_SRR0, SPRN_SRR1, 0 Why not NEED_ESR as we did in our SDK? > kvm_handler BOOKE_INTERRUPT_HV_SYSCALL, EX_PARAMS(GEN), \ > SPRN_SRR0, SPRN_SRR1, 0 > kvm_handler BOOKE_INTERRUPT_GUEST_DBELL, EX_PARAMS(GDBELL), \ > diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c > index 753cc99..19c8379 100644 > --- a/arch/powerpc/kvm/e500mc.c > +++ b/arch/powerpc/kvm/e500mc.c > @@ -177,8 +177,6 @@ int kvmppc_core_check_processor_compat(void) > r = 0; > else if (strcmp(cur_cpu_spec->cpu_name, "e5500") == 0) > r = 0; > - else if (strcmp(cur_cpu_spec->cpu_name, "e6500") == 0) > - r = 0; Hmm ... I made it clear in the commit message that Altivec is not supported, why couldn't we be more gentle: Kconfig should also be updated (in both proposals). -Mike --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/powerpc/kvm/e500mc.c b/arch/powerpc/kvm/e500mc.c index c3bdc0a..4f43a36 100644 --- a/arch/powerpc/kvm/e500mc.c +++ b/arch/powerpc/kvm/e500mc.c @@ -172,8 +172,11 @@ int kvmppc_core_check_processor_compat(void) r = 0; else if (strcmp(cur_cpu_spec->cpu_name, "e5500") == 0) r = 0; +#ifndef CONFIG_ALTIVEC +/* ALTIVEC is not supported now by KVM so only one of them can work */ else if (strcmp(cur_cpu_spec->cpu_name, "e6500") == 0) r = 0; +#endif else r = -ENOTSUPP; diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index 82f155e..bb1a9e0 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c @@ -973,6 +973,16 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu, break; #endif + case BOOKE_INTERRUPT_ALTIVEC_UNAVAIL: + case BOOKE_INTERRUPT_ALTIVEC_ASSIST: + /* + * Guest wants ALTIVEC, but host kernel doesn't support it. + * send an "unimplemented operation" program check to the guest. + */ + kvmppc_core_queue_program(vcpu, ESR_PUO | ESR_SPV); + r = RESUME_GUEST; + break; + case BOOKE_INTERRUPT_DATA_STORAGE: kvmppc_core_queue_data_storage(vcpu, vcpu->arch.fault_dear, vcpu->arch.fault_esr);