From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bhushan Bharat-R65777 Subject: RE: [PATCH 4/4 v2] KVM: PPC: Add userspace debug stub support Date: Wed, 3 Apr 2013 17:47:34 +0000 Message-ID: <6A3DF150A5B70D4F9B66A25E3F7C888D06FBE9F3@039-SN2MPN1-013.039d.mgd.msft.net> References: <1363847101-26503-1-git-send-email-Bharat.Bhushan@freescale.com> <1363847101-26503-5-git-send-email-Bharat.Bhushan@freescale.com> <7355982C-05D1-4C58-A189-2F8F926AD11B@suse.de> <6A3DF150A5B70D4F9B66A25E3F7C888D06FB82BE@039-SN2MPN1-013.039d.mgd <7C9A47BE-0385-4B45-B4F9-D5069C9ADBA2@suse.de> <6A3DF150A5B70D4F9B66A25E3F7C888D06FBBF38@039-SN2MPN1-013.039d.mgd.msft.net> <515AFC26.5040705@suse.de> <6A3DF150A5B70D4F9B66A25E3F7C888D06FBE94B@039-SN2MPN1-013.039d.mgd.msft.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT Cc: "kvm-ppc@vger.kernel.org" , "kvm@vger.kernel.org" , Wood Scott-B07421 To: Alexander Graf Return-path: Received: from mail-db8lp0184.outbound.messaging.microsoft.com ([213.199.154.184]:10376 "EHLO db8outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762722Ab3DCRrn convert rfc822-to-8bit (ORCPT ); Wed, 3 Apr 2013 13:47:43 -0400 In-Reply-To: Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: > >>>>>>> + dbg_reg =&(vcpu->arch.shadow_dbg_reg); > >>>>>>> + > >>>>>>> + /* > >>>>>>> + * On BOOKE (e500v2); Set DBCR1 and DBCR2 to allow debug events > >>>>>>> + * to occur when MSR.PR is set. > >>>>>>> + * On BOOKE-HV (e500mc+); MSR.PR = 0 when guest is running. So we > >>>>>>> + * should clear DBCR1 and DBCR2. > >>>>>>> + */ > >>>>>>> +#ifdef CONFIG_KVM_BOOKE_HV > >>>>>>> + dbg_reg->dbcr1 = 0; > >>>>>>> + dbg_reg->dbcr2 = 0; > >>>>>> Does that mean we can't debug guest user space? > >>>>> Yes > >>>> This is wrong. > >>> Really, So far I am assuming qemu debug stub is not mean for > >>> debugging guest > >> application. > >> > >> Ok, let me rephrase: This is confusing. You do trap in PR mode on > >> e500v2. IIRC > >> x86 also traps in kernel and user space. I don't see why e500 hv > >> should be different. > > > > I am sorry, I think did not read the document correctly. > > > > DBCR1 = 0 ; means the "00 IAC1 debug conditions unaffected by MSR[PR],MSR[GS]. > > > > Similarly for dbcr2. > > > > So yes the guest user space can be debugged. > > So why is this conditional on BOOKE_HV then? Wouldn't it make things easier to > treat HV and PR identical? > On BOOKE-HV we have to keep these to 0, so guest and guest application both can be debugged. Also on HV we have EPCR.DUVD to control that debug events will not come in hypervisor (GS = 0). On BOOKE; guest and guest application both runs in PR = 1 and hypervisor in PR = 0. So with dbcr1/dbcr2 on booke we control debug exception not to come in hypervisor mode still allow guest and its application debugging. Thanks -Bharat From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bhushan Bharat-R65777 Date: Wed, 03 Apr 2013 17:47:34 +0000 Subject: RE: [PATCH 4/4 v2] KVM: PPC: Add userspace debug stub support Message-Id: <6A3DF150A5B70D4F9B66A25E3F7C888D06FBE9F3@039-SN2MPN1-013.039d.mgd.msft.net> List-Id: References: <1363847101-26503-1-git-send-email-Bharat.Bhushan@freescale.com> <1363847101-26503-5-git-send-email-Bharat.Bhushan@freescale.com> <7355982C-05D1-4C58-A189-2F8F926AD11B@suse.de> <6A3DF150A5B70D4F9B66A25E3F7C888D06FB82BE@039-SN2MPN1-013.039d.mgd <7C9A47BE-0385-4B45-B4F9-D5069C9ADBA2@suse.de> <6A3DF150A5B70D4F9B66A25E3F7C888D06FBBF38@039-SN2MPN1-013.039d.mgd.msft.net> <515AFC26.5040705@suse.de> <6A3DF150A5B70D4F9B66A25E3F7C888D06FBE94B@039-SN2MPN1-013.039d.mgd.msft.net> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Alexander Graf Cc: "kvm-ppc@vger.kernel.org" , "kvm@vger.kernel.org" , Wood Scott-B07421 > >>>>>>> + dbg_reg =&(vcpu->arch.shadow_dbg_reg); > >>>>>>> + > >>>>>>> + /* > >>>>>>> + * On BOOKE (e500v2); Set DBCR1 and DBCR2 to allow debug events > >>>>>>> + * to occur when MSR.PR is set. > >>>>>>> + * On BOOKE-HV (e500mc+); MSR.PR = 0 when guest is running. So we > >>>>>>> + * should clear DBCR1 and DBCR2. > >>>>>>> + */ > >>>>>>> +#ifdef CONFIG_KVM_BOOKE_HV > >>>>>>> + dbg_reg->dbcr1 = 0; > >>>>>>> + dbg_reg->dbcr2 = 0; > >>>>>> Does that mean we can't debug guest user space? > >>>>> Yes > >>>> This is wrong. > >>> Really, So far I am assuming qemu debug stub is not mean for > >>> debugging guest > >> application. > >> > >> Ok, let me rephrase: This is confusing. You do trap in PR mode on > >> e500v2. IIRC > >> x86 also traps in kernel and user space. I don't see why e500 hv > >> should be different. > > > > I am sorry, I think did not read the document correctly. > > > > DBCR1 = 0 ; means the "00 IAC1 debug conditions unaffected by MSR[PR],MSR[GS]. > > > > Similarly for dbcr2. > > > > So yes the guest user space can be debugged. > > So why is this conditional on BOOKE_HV then? Wouldn't it make things easier to > treat HV and PR identical? > On BOOKE-HV we have to keep these to 0, so guest and guest application both can be debugged. Also on HV we have EPCR.DUVD to control that debug events will not come in hypervisor (GS = 0). On BOOKE; guest and guest application both runs in PR = 1 and hypervisor in PR = 0. So with dbcr1/dbcr2 on booke we control debug exception not to come in hypervisor mode still allow guest and its application debugging. Thanks -Bharat