All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bhushan Bharat-R65777 <R65777@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: "kvm-ppc@vger.kernel.org" <kvm-ppc@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	Wood Scott-B07421 <B07421@freescale.com>
Subject: RE: [PATCH 4/4 v2] KVM: PPC: Add userspace debug stub support
Date: Wed, 3 Apr 2013 17:47:34 +0000	[thread overview]
Message-ID: <6A3DF150A5B70D4F9B66A25E3F7C888D06FBE9F3@039-SN2MPN1-013.039d.mgd.msft.net> (raw)
In-Reply-To: <EA86C07E-2666-4F94-8B51-9D953A5C0F81@suse.de>

> >>>>>>> +	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






WARNING: multiple messages have this Message-ID (diff)
From: Bhushan Bharat-R65777 <R65777@freescale.com>
To: Alexander Graf <agraf@suse.de>
Cc: "kvm-ppc@vger.kernel.org" <kvm-ppc@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	Wood Scott-B07421 <B07421@freescale.com>
Subject: RE: [PATCH 4/4 v2] KVM: PPC: Add userspace debug stub support
Date: Wed, 03 Apr 2013 17:47:34 +0000	[thread overview]
Message-ID: <6A3DF150A5B70D4F9B66A25E3F7C888D06FBE9F3@039-SN2MPN1-013.039d.mgd.msft.net> (raw)
In-Reply-To: <EA86C07E-2666-4F94-8B51-9D953A5C0F81@suse.de>

> >>>>>>> +	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






  reply	other threads:[~2013-04-03 17:47 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-21  6:24 [PATCH 0/4 v2] KVM :PPC: Userspace Debug support Bharat Bhushan
2013-03-21  6:36 ` Bharat Bhushan
2013-03-21  6:24 ` [PATCH 1/4 v2] Added ONE_REG interface for debug instruction Bharat Bhushan
2013-03-21  6:36   ` Bharat Bhushan
2013-03-29  1:55   ` Alexander Graf
2013-03-29  1:55     ` Alexander Graf
2013-03-21  6:24 ` [PATCH 2/4 v2] KVM: PPC: debug stub interface parameter defined Bharat Bhushan
2013-03-21  6:36   ` Bharat Bhushan
2013-03-29  1:55   ` Alexander Graf
2013-03-29  1:55     ` Alexander Graf
2013-03-29  3:08     ` Bhushan Bharat-R65777
2013-04-02  8:27       ` Alexander Graf
2013-04-02  8:27         ` Alexander Graf
2013-03-21  6:25 ` [PATCH 3/4 v2] Rename EMULATE_DO_PAPR to EMULATE_EXIT_USER Bharat Bhushan
2013-03-21  6:37   ` Bharat Bhushan
2013-03-28 14:05   ` Alexander Graf
2013-03-28 14:05     ` Alexander Graf
2013-03-21  6:25 ` [PATCH 4/4 v2] KVM: PPC: Add userspace debug stub support Bharat Bhushan
2013-03-21  6:37   ` Bharat Bhushan
2013-03-28 16:36   ` Alexander Graf
2013-03-28 16:36     ` Alexander Graf
2013-03-29  6:04     ` Bhushan Bharat-R65777
2013-03-29  6:04       ` Bhushan Bharat-R65777
2013-04-02  8:27       ` Alexander Graf
2013-04-02  8:27         ` Alexander Graf
2013-04-02 14:09         ` Bhushan Bharat-R65777
2013-04-02 14:09           ` Bhushan Bharat-R65777
2013-04-02 15:41           ` Alexander Graf
2013-04-02 15:41             ` Alexander Graf
2013-04-03 17:14             ` Bhushan Bharat-R65777
2013-04-03 17:14               ` Bhushan Bharat-R65777
2013-04-03 17:35               ` Alexander Graf
2013-04-03 17:35                 ` Alexander Graf
2013-04-03 17:47                 ` Bhushan Bharat-R65777 [this message]
2013-04-03 17:47                   ` Bhushan Bharat-R65777
2013-04-03 17:56                   ` Alexander Graf
2013-04-03 17:56                     ` Alexander Graf
2013-04-03 18:00                     ` Bhushan Bharat-R65777
2013-04-03 18:00                       ` Bhushan Bharat-R65777
2013-04-02 18:00           ` Scott Wood
2013-04-02 18:00             ` Scott Wood
2013-04-03 10:03             ` Bhushan Bharat-R65777
2013-04-03 10:03               ` Bhushan Bharat-R65777
2013-04-03 10:28               ` Alexander Graf
2013-04-03 10:28                 ` Alexander Graf
2013-04-03 13:50                 ` Bhushan Bharat-R65777
2013-04-03 13:50                   ` Bhushan Bharat-R65777
2013-04-03 14:09                   ` Alexander Graf
2013-04-03 14:09                     ` Alexander Graf
2013-04-03 15:18                     ` Bhushan Bharat-R65777
2013-04-03 15:18                       ` Bhushan Bharat-R65777
2013-04-03 16:26                       ` Alexander Graf
2013-04-03 16:26                         ` Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6A3DF150A5B70D4F9B66A25E3F7C888D06FBE9F3@039-SN2MPN1-013.039d.mgd.msft.net \
    --to=r65777@freescale.com \
    --cc=B07421@freescale.com \
    --cc=agraf@suse.de \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.