On 21.08.2012, at 15:51, Bharat Bhushan wrote:

> This patch defines the interface parameter for KVM_SET_GUEST_DEBUG
> ioctl support. Follow up patches will use this for setting up
> hardware breakpoints, watchpoints and software breakpoints.
> 
> Signed-off-by: Bharat Bhushan <[email protected]>
> ---
> arch/powerpc/include/asm/kvm.h |   33 +++++++++++++++++++++++++++++++++
> arch/powerpc/kvm/book3s.c      |    6 ++++++
> arch/powerpc/kvm/booke.c       |    6 ++++++
> arch/powerpc/kvm/powerpc.c     |    6 ------
> 4 files changed, 45 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/kvm.h b/arch/powerpc/include/asm/kvm.h
> index 3c14202..61b197e 100644
> --- a/arch/powerpc/include/asm/kvm.h
> +++ b/arch/powerpc/include/asm/kvm.h
> @@ -269,8 +269,41 @@ struct kvm_debug_exit_arch {
> 
> /* for KVM_SET_GUEST_DEBUG */
> struct kvm_guest_debug_arch {
> +     struct {
> +             /* H/W breakpoint/watchpoint address */
> +             __u64 addr;
> +             /*
> +              * Type denotes h/w breakpoint, read watchpoint, write
> +              * watchpoint or watchpoint (both read and write).
> +              */
> +#define KVMPPC_DEBUG_NOTYPE          0x0
> +#define KVMPPC_DEBUG_BREAKPOINT              (1UL << 1)
> +#define KVMPPC_DEBUG_WATCH_WRITE     (1UL << 2)
> +#define KVMPPC_DEBUG_WATCH_READ              (1UL << 3)
> +             __u32 type;
> +             __u32 pad1;

Why the padding?

> +             __u64 pad2;
> +     } bp[16];

Why 16?

> };
> 
> +/* Debug related defines */
> +/*
> + * kvm_guest_debug->control is a 32 bit field. The lower 16 bits are generic
> + * and upper 16 bits are architecture specific. Architecture specific defines
> + * that ioctl is for setting hardware breakpoint or software breakpoint.
> + */
> +#define KVM_GUESTDBG_USE_SW_BP               0x00010000
> +#define KVM_GUESTDBG_USE_HW_BP               0x00020000
> +
> +/* When setting software breakpoint, Change the software breakpoint
> + * instruction to special trap instruction and set KVM_GUESTDBG_USE_SW_BP
> + * flag in kvm_guest_debug->control. KVM does keep track of software
> + * breakpoints. So when KVM_GUESTDBG_USE_SW_BP flag is set and special trap
> + * instruction is executed by guest then exit to userspace.
> + * NOTE: A Nice interface can be added to get the special trap instruction.
> + */
> +#define KVMPPC_INST_GUEST_GDB                0x7C00021C      /* ehpriv OC=0 
> */

This definitely has to be passed to user space (which writes that instruction 
into guest phys memory). Other PPC subarchs will use different instructions. 
Just model it as a read-only ONE_REG.


Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to