From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Date: Wed, 05 Sep 2012 23:27:00 +0000 Subject: Re: [PATCH 6/6] KVM: booke/bookehv: Add debug stub support Message-Id: <5047DFC4.8040701@freescale.com> List-Id: References: <1345557120-16197-1-git-send-email-Bharat.Bhushan@freescale.com> <1345557120-16197-7-git-send-email-Bharat.Bhushan@freescale.com> <5047DED8.5030202@freescale.com> In-Reply-To: <5047DED8.5030202@freescale.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Bharat Bhushan Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, agraf@suse.de, Bharat Bhushan On 09/05/2012 06:23 PM, Scott Wood wrote: > On 08/21/2012 08:52 AM, Bharat Bhushan wrote: >> This patch adds the debug stub support on booke/bookehv. >> Now QEMU debug stub can use hw breakpoint, watchpoint and >> software breakpoint to debug guest. >> >> Signed-off-by: Bharat Bhushan >> --- >> arch/powerpc/include/asm/kvm.h | 29 ++++++- >> arch/powerpc/include/asm/kvm_host.h | 5 + >> arch/powerpc/kernel/asm-offsets.c | 26 ++++++ >> arch/powerpc/kvm/booke.c | 144 +++++++++++++++++++++++++++++---- >> arch/powerpc/kvm/booke_interrupts.S | 110 +++++++++++++++++++++++++ >> arch/powerpc/kvm/bookehv_interrupts.S | 141 +++++++++++++++++++++++++++++++- >> arch/powerpc/kvm/e500mc.c | 3 +- >> 7 files changed, 435 insertions(+), 23 deletions(-) >> >> diff --git a/arch/powerpc/include/asm/kvm.h b/arch/powerpc/include/asm/kvm.h >> index 61b197e..53479ea 100644 >> --- a/arch/powerpc/include/asm/kvm.h >> +++ b/arch/powerpc/include/asm/kvm.h >> @@ -25,6 +25,7 @@ >> /* Select powerpc specific features in */ >> #define __KVM_HAVE_SPAPR_TCE >> #define __KVM_HAVE_PPC_SMT >> +#define __KVM_HAVE_GUEST_DEBUG >> >> struct kvm_regs { >> __u64 pc; >> @@ -264,7 +265,31 @@ struct kvm_fpu { >> __u64 fpr[32]; >> }; >> >> + >> +/* >> + * Defines for h/w breakpoint, watchpoint (read, write or both) and >> + * software breakpoint. >> + * These are used as "type" in KVM_SET_GUEST_DEBUG ioctl and "status" >> + * for KVM_DEBUG_EXIT. >> + */ >> +#define KVMPPC_DEBUG_NONE 0x0 >> +#define KVMPPC_DEBUG_BREAKPOINT (1UL << 1) >> +#define KVMPPC_DEBUG_WATCH_WRITE (1UL << 2) >> +#define KVMPPC_DEBUG_WATCH_READ (1UL << 3) >> struct kvm_debug_exit_arch { > > That says "arch", but it's not in an arch-specific file. Sigh, I can't read today apparently. >> + __u64 pc; >> + /* >> + * exception -> returns the exception number. If the KVM_DEBUG_EXIT >> + * exit is not handled (say not h/w breakpoint or software breakpoint >> + * set for this address) by qemu then it is supposed to inject this >> + * exception to guest. >> + */ >> + __u32 exception; >> + /* >> + * exiting to userspace because of h/w breakpoint, watchpoint >> + * (read, write or both) and software breakpoint. >> + */ >> + __u32 status; >> }; > > What does "exception number" mean in a generic API? Still, "exception number" is not a well-defined concept powerpc-wide. -Scott From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Wood Subject: Re: [PATCH 6/6] KVM: booke/bookehv: Add debug stub support Date: Wed, 5 Sep 2012 18:27:00 -0500 Message-ID: <5047DFC4.8040701@freescale.com> References: <1345557120-16197-1-git-send-email-Bharat.Bhushan@freescale.com> <1345557120-16197-7-git-send-email-Bharat.Bhushan@freescale.com> <5047DED8.5030202@freescale.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: , , , Bharat Bhushan To: Bharat Bhushan Return-path: In-Reply-To: <5047DED8.5030202@freescale.com> Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 09/05/2012 06:23 PM, Scott Wood wrote: > On 08/21/2012 08:52 AM, Bharat Bhushan wrote: >> This patch adds the debug stub support on booke/bookehv. >> Now QEMU debug stub can use hw breakpoint, watchpoint and >> software breakpoint to debug guest. >> >> Signed-off-by: Bharat Bhushan >> --- >> arch/powerpc/include/asm/kvm.h | 29 ++++++- >> arch/powerpc/include/asm/kvm_host.h | 5 + >> arch/powerpc/kernel/asm-offsets.c | 26 ++++++ >> arch/powerpc/kvm/booke.c | 144 +++++++++++++++++++++++++++++---- >> arch/powerpc/kvm/booke_interrupts.S | 110 +++++++++++++++++++++++++ >> arch/powerpc/kvm/bookehv_interrupts.S | 141 +++++++++++++++++++++++++++++++- >> arch/powerpc/kvm/e500mc.c | 3 +- >> 7 files changed, 435 insertions(+), 23 deletions(-) >> >> diff --git a/arch/powerpc/include/asm/kvm.h b/arch/powerpc/include/asm/kvm.h >> index 61b197e..53479ea 100644 >> --- a/arch/powerpc/include/asm/kvm.h >> +++ b/arch/powerpc/include/asm/kvm.h >> @@ -25,6 +25,7 @@ >> /* Select powerpc specific features in */ >> #define __KVM_HAVE_SPAPR_TCE >> #define __KVM_HAVE_PPC_SMT >> +#define __KVM_HAVE_GUEST_DEBUG >> >> struct kvm_regs { >> __u64 pc; >> @@ -264,7 +265,31 @@ struct kvm_fpu { >> __u64 fpr[32]; >> }; >> >> + >> +/* >> + * Defines for h/w breakpoint, watchpoint (read, write or both) and >> + * software breakpoint. >> + * These are used as "type" in KVM_SET_GUEST_DEBUG ioctl and "status" >> + * for KVM_DEBUG_EXIT. >> + */ >> +#define KVMPPC_DEBUG_NONE 0x0 >> +#define KVMPPC_DEBUG_BREAKPOINT (1UL << 1) >> +#define KVMPPC_DEBUG_WATCH_WRITE (1UL << 2) >> +#define KVMPPC_DEBUG_WATCH_READ (1UL << 3) >> struct kvm_debug_exit_arch { > > That says "arch", but it's not in an arch-specific file. Sigh, I can't read today apparently. >> + __u64 pc; >> + /* >> + * exception -> returns the exception number. If the KVM_DEBUG_EXIT >> + * exit is not handled (say not h/w breakpoint or software breakpoint >> + * set for this address) by qemu then it is supposed to inject this >> + * exception to guest. >> + */ >> + __u32 exception; >> + /* >> + * exiting to userspace because of h/w breakpoint, watchpoint >> + * (read, write or both) and software breakpoint. >> + */ >> + __u32 status; >> }; > > What does "exception number" mean in a generic API? Still, "exception number" is not a well-defined concept powerpc-wide. -Scott