From patchwork Thu Jan 31 17:59:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharat Bhushan X-Patchwork-Id: 2074891 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 4A62F3FD1A for ; Thu, 31 Jan 2013 18:00:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753547Ab3AaSAA (ORCPT ); Thu, 31 Jan 2013 13:00:00 -0500 Received: from ch1ehsobe002.messaging.microsoft.com ([216.32.181.182]:47573 "EHLO ch1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751570Ab3AaR77 convert rfc822-to-8bit (ORCPT ); Thu, 31 Jan 2013 12:59:59 -0500 Received: from mail194-ch1-R.bigfish.com (10.43.68.226) by CH1EHSOBE001.bigfish.com (10.43.70.51) with Microsoft SMTP Server id 14.1.225.23; Thu, 31 Jan 2013 17:59:58 +0000 Received: from mail194-ch1 (localhost [127.0.0.1]) by mail194-ch1-R.bigfish.com (Postfix) with ESMTP id E0E4740365; Thu, 31 Jan 2013 17:59:58 +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: 1 X-BigFish: VS1(zz98dI9371I542I1432Izz1ee6h1de0h1202h1e76h1d1ah1d2ahzz17326ah8275dh8275bha509lz2dh2a8h668h839h8e2h8e3h944hd25hf0ah1220h1288h12a5h12a9h12bdh137ah13b6h1441h1504h1537h153bh15d0h162dh1631h1758h18e1h1946hbe9i1155h) Received: from mail194-ch1 (localhost.localdomain [127.0.0.1]) by mail194-ch1 (MessageSwitch) id 1359655197145688_26525; Thu, 31 Jan 2013 17:59:57 +0000 (UTC) Received: from CH1EHSMHS022.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.246]) by mail194-ch1.bigfish.com (Postfix) with ESMTP id 1CA782A004F; Thu, 31 Jan 2013 17:59:57 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS022.bigfish.com (10.43.70.22) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 31 Jan 2013 17:59:56 +0000 Received: from 039-SN2MPN1-023.039d.mgd.msft.net ([169.254.3.75]) by 039-SN1MMR1-003.039d.mgd.msft.net ([10.84.1.16]) with mapi id 14.02.0318.003; Thu, 31 Jan 2013 17:59:56 +0000 From: Bhushan Bharat-R65777 To: Alexander Graf CC: "kvm-ppc@vger.kernel.org" , "kvm@vger.kernel.org" Subject: RE: [PATCH 8/8] KVM:PPC:booke: Allow debug interrupt injection to guest Thread-Topic: [PATCH 8/8] KVM:PPC:booke: Allow debug interrupt injection to guest Thread-Index: AQHN88QXUB5wz+5GsE2z1x0k3BqxT5haA1gAgAfEZ8CAAab3gIAAYApw Date: Thu, 31 Jan 2013 17:59:55 +0000 Message-ID: <6A3DF150A5B70D4F9B66A25E3F7C888D06591B44@039-SN2MPN1-023.039d.mgd.msft.net> References: <1358324685-30225-1-git-send-email-bharat.bhushan@freescale.com> <1358324685-30225-7-git-send-email-bharat.bhushan@freescale.com> <4145C65C-BC91-494C-8C90-2DC2538F131F@suse.de> <6A3DF150A5B70D4F9B66A25E3F7C888D065829EE@039-SN2MPN1-022.039d.mgd <11819845-A3C0-41F1-90E3-8E22E97863CB@suse.de> In-Reply-To: <11819845-A3C0-41F1-90E3-8E22E97863CB@suse.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.214.249.70] 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: kvm-owner@vger.kernel.org [mailto:kvm-owner@vger.kernel.org] On Behalf Of > Alexander Graf > Sent: Thursday, January 31, 2013 5:34 PM > To: Bhushan Bharat-R65777 > Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org > Subject: Re: [PATCH 8/8] KVM:PPC:booke: Allow debug interrupt injection to guest > > > On 30.01.2013, at 12:12, Bhushan Bharat-R65777 wrote: > > > > > > >> -----Original Message----- > >> From: kvm-ppc-owner@vger.kernel.org > >> [mailto:kvm-ppc-owner@vger.kernel.org] On Behalf Of Alexander Graf > >> Sent: Friday, January 25, 2013 5:44 PM > >> To: Bhushan Bharat-R65777 > >> Cc: kvm-ppc@vger.kernel.org; kvm@vger.kernel.org; Bhushan > >> Bharat-R65777 > >> Subject: Re: [PATCH 8/8] KVM:PPC:booke: Allow debug interrupt > >> injection to guest > >> > >> > >> On 16.01.2013, at 09:24, Bharat Bhushan wrote: > >> > >>> Allow userspace to inject debug interrupt to guest. QEMU can > >> > >> s/QEMU/user space. > >> > >>> inject the debug interrupt to guest if it is not able to handle the > >>> debug interrupt. > >>> > >>> Signed-off-by: Bharat Bhushan > >>> --- > >>> arch/powerpc/kvm/booke.c | 32 +++++++++++++++++++++++++++++++- > >>> arch/powerpc/kvm/e500mc.c | 10 +++++++++- > >>> 2 files changed, 40 insertions(+), 2 deletions(-) > >>> > >>> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c > >>> index faa0a0b..547797f 100644 > >>> --- a/arch/powerpc/kvm/booke.c > >>> +++ b/arch/powerpc/kvm/booke.c > >>> @@ -133,6 +133,13 @@ static void kvmppc_vcpu_sync_fpu(struct > >>> kvm_vcpu > >>> *vcpu) #endif } > >>> > >>> +#ifdef CONFIG_KVM_BOOKE_HV > >>> +static int kvmppc_core_pending_debug(struct kvm_vcpu *vcpu) { > >>> + return test_bit(BOOKE_IRQPRIO_DEBUG, > >>> +&vcpu->arch.pending_exceptions); } #endif > >>> + > >>> /* > >>> * Helper function for "full" MSR writes. No need to call this if > >>> only > >>> * EE/CE/ME/DE/RI are changing. > >>> @@ -144,7 +151,11 @@ void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 > >>> new_msr) #ifdef CONFIG_KVM_BOOKE_HV > >>> new_msr |= MSR_GS; > >>> > >>> - if (vcpu->guest_debug) > >>> + /* > >>> + * Set MSR_DE if the hardware debug resources are owned by user-space > >>> + * and there is no debug interrupt pending for guest to handle. > >> > >> Why? > > > > QEMU is using the IAC/DAC registers to set hardware breakpoint/watchpoints via > debug ioctls. As debug events are enabled/gated by MSR_DE so somehow we need to > set MSR_DE on hardware MSR when guest is running in this case. > > Reading this 5 times I still have no idea what you're really checking for here. > Maybe the naming for kvmppc_core_pending_debug is just unnatural? What does that > function do really? > > > > > On bookehv this is how I am controlling the MSR_DE in hardware MSR. > > > >> And why is this whole thing only executed on HV? > > > > On e500v2 we always enable MSR_DE using vcpu->arch.shadow_msr in > > e500.c #ifndef CONFIG_KVM_BOOKE_HV > > - vcpu->arch.shadow_msr = MSR_USER | MSR_IS | MSR_DS; > > + vcpu->arch.shadow_msr = MSR_USER | MSR_DE | MSR_IS | MSR_DS; > Why? How is e500v2 any different wrt debug? And why wouldn't that work for > e500mc? > > > Alex > > -- > 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 --- 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/booke.c b/arch/powerpc/kvm/booke.c index b340a62..1e2d663 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c @@ -151,10 +151,14 @@ void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr) /* * Set MSR_DE if the hardware debug resources are owned by user-space - * and there is no debug interrupt pending for guest to handle. */ - if (vcpu->guest_debug && !kvmppc_core_pending_debug(vcpu)) + if (vcpu->guest_debug) new_msr |= MSR_DE; +#else + if (vcpu->guest_debug) + vcpu->arch.shadow_msr |= MSR_DE; #endif But do not when I should clear? >