From: Scott Wood <scottwood@freescale.com>
To: Bhushan Bharat-R65777 <R65777@freescale.com>
Cc: Wood Scott-B07421 <B07421@freescale.com>,
"kvm-ppc@vger.kernel.org" <kvm-ppc@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"agraf@suse.de" <agraf@suse.de>
Subject: Re: [PATCH 2/2] KVM: PPC: booke/bookehv: Add guest debug support
Date: Mon, 20 Aug 2012 18:53:26 -0500 [thread overview]
Message-ID: <5032CDF6.2050105@freescale.com> (raw)
In-Reply-To: <6A3DF150A5B70D4F9B66A25E3F7C888D03E02B3E@039-SN2MPN1-022.039d.mgd.msft.net>
On 08/16/2012 03:48 AM, Bhushan Bharat-R65777 wrote:
>>>>> diff --git a/arch/powerpc/include/asm/kvm.h
>>>>> b/arch/powerpc/include/asm/kvm.h index 3c14202..da71c84 100644
>>>>> --- a/arch/powerpc/include/asm/kvm.h
>>>>> +++ b/arch/powerpc/include/asm/kvm.h
>>>>> @@ -25,6 +25,7 @@
>>>>> /* Select powerpc specific features in <linux/kvm.h> */ #define
>>>>> __KVM_HAVE_SPAPR_TCE #define __KVM_HAVE_PPC_SMT
>>>>> +#define __KVM_HAVE_GUEST_DEBUG
>>>>>
>>>>> struct kvm_regs {
>>>>> __u64 pc;
>>>>> @@ -265,10 +266,19 @@ struct kvm_fpu { };
>>>>>
>>>>> struct kvm_debug_exit_arch {
>>>>> + __u32 exception;
>>>>> + __u32 pc;
>>>>> + __u32 status;
>>>>> };
>>>>
>>>> PC must be 64-bit. What goes in "status" and "exception"?
>
> status -> exit because of h/w breakpoint, watchpoint (read, write or
> both) and software breakpoint.
>
> exception -> returns the exception number. If the exit is not handled
> (say not h/w breakpoint or software breakpoint set for this address)
> by qemu then it is supposed to inject the exception to guest. This is
> how it is implemented for x86.
Where is this documented (including the specific values that are possible)?
>>>>> +#define KVM_GUESTDBG_USE_SW_BP 0x00010000
>>>>> +#define KVM_GUESTDBG_USE_HW_BP 0x00020000
>>>>
>>>> Where do these get used? Any reason for these particular values? If
>>>> you're trying to create a partition where the upper half is generic
>>>> and the lower half is arch-specific, say so.
>>>
>>> KVM_SET_GUEST_DEBUG ioctl used to set/unset debug interrupts, which
>>> have a "u32 control" element. We have inherited this mechanism from
>>> x86 implementation and it looks like lower 16 bits are generic (like
>>> KVM_GUESTDBG_ENBLE, KVM_GUESTDBG_SINGLESTEP etc and upper 16 bits are
>>> Architecture specific.
>>>
>>> I will add a comment to describe this.
>>
>> I don't think the sw/hw distinction belongs here -- it should be per breakpoint.
>
> KVM does not track the software breakpoint, so it is not per breakpoint.
> In KVM, when KVM_GUESTDBG_USE_SW_BP flag is set and special trap instruction is executed by guest then exit to userspace.
Can both types of breakpoint be set at the same time?
>>>>> + run->exit_reason = KVM_EXIT_DEBUG;
>>>>> + run->debug.arch.pc = vcpu->arch.pc;
>>>>> + run->debug.arch.exception = exit_nr;
>>>>> + run->debug.arch.status = 0;
>>>>> + kvmppc_account_exit(vcpu, DEBUG_EXITS);
>>>>> + return RESUME_HOST;
>>>>
>>>> The interface isn't (clearly labelled as) booke specific, but you
>>>> return booke- specific exception numbers. How's userspace supposed
>>>> to know what to do with them? What do you plan on doing with them in QEMU?
>>>
>>> This is booke specific.
>>
>> Then put booke in the name,
>
> Which data structure name should have booke?
Anything that's booke specific.
-Scott
next prev parent reply other threads:[~2012-08-20 23:53 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-26 5:32 [PATCH 1/2] KVM: PPC: booke: Allow multiple exception types Bharat Bhushan
2012-07-26 5:32 ` [PATCH 2/2] KVM: PPC: booke/bookehv: Add guest debug support Bharat Bhushan
2012-07-27 1:29 ` Scott Wood
2012-07-30 7:37 ` Bhushan Bharat-R65777
2012-07-30 22:00 ` Scott Wood
2012-08-16 8:48 ` Bhushan Bharat-R65777
2012-08-20 23:53 ` Scott Wood [this message]
2012-08-16 15:12 ` Bhushan Bharat-R65777
2012-08-20 23:55 ` Scott Wood
2012-07-26 23:01 ` [PATCH 1/2] KVM: PPC: booke: Allow multiple exception types Scott Wood
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=5032CDF6.2050105@freescale.com \
--to=scottwood@freescale.com \
--cc=B07421@freescale.com \
--cc=R65777@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).