linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: alex.bennee@linaro.org (Alex Bennée)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/7] KVM: arm: guest debug, define API headers
Date: Tue, 25 Nov 2014 16:10:00 +0000	[thread overview]
Message-ID: <1416931805-23223-3-git-send-email-alex.bennee@linaro.org> (raw)
In-Reply-To: <1416931805-23223-1-git-send-email-alex.bennee@linaro.org>

This commit defines the API headers for guest debugging. There are two
architecture specific debug structures:

  - kvm_guest_debug_arch, allows us to pass in HW debug registers
  - kvm_debug_exit_arch, signals the exact debug exit and address

The type of debugging being used is control by the architecture specific
control bits of the kvm_guest_debug->control flags in the ioctl
structure.

Signed-off-by: Alex Benn?e <alex.bennee@linaro.org>

diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h
index 8e38878..de2450c 100644
--- a/arch/arm64/include/uapi/asm/kvm.h
+++ b/arch/arm64/include/uapi/asm/kvm.h
@@ -93,10 +93,30 @@ struct kvm_sregs {
 struct kvm_fpu {
 };
 
+/* See ARM ARM D7.3: Debug Registers
+ *
+ * The control registers are stored as 64bit values as the setup code
+ * is shared with the normal cpu context restore code in hyp.S which
+ * is 64 bit only.
+ */
+#define KVM_ARM_NDBG_REGS 16
 struct kvm_guest_debug_arch {
+	__u64 dbg_bcr[KVM_ARM_NDBG_REGS];
+	__u64 dbg_bvr[KVM_ARM_NDBG_REGS];
+	__u64 dbg_wcr[KVM_ARM_NDBG_REGS];
+	__u64 dbg_wvr[KVM_ARM_NDBG_REGS];
 };
 
+/* Exit types which define why we did a debug exit */
+#define KVM_DEBUG_EXIT_ERROR		0x0
+#define KVM_DEBUG_EXIT_SINGLE_STEP	0x1
+#define KVM_DEBUG_EXIT_SW_BKPT		0x2
+#define KVM_DEBUG_EXIT_HW_BKPT		0x3
+#define KVM_DEBUG_EXIT_HW_WTPT		0x4
+
 struct kvm_debug_exit_arch {
+	__u64 address;
+	__u32 exit_type;
 };
 
 struct kvm_sync_regs {
@@ -198,4 +218,12 @@ struct kvm_arch_memory_slot {
 
 #endif
 
+/* Architecture related debug defines - upper 16 bits of
+ * kvm_guest_debug->control
+ */
+#define KVM_GUESTDBG_USE_SW_BP_SHIFT	16
+#define KVM_GUESTDBG_USE_SW_BP		(1 << KVM_GUESTDBG_USE_SW_BP_SHIFT)
+#define KVM_GUESTDBG_USE_HW_BP_SHIFT	17
+#define KVM_GUESTDBG_USE_HW_BP		(1 << KVM_GUESTDBG_USE_HW_BP_SHIFT)
+
 #endif /* __ARM_KVM_H__ */
-- 
2.1.3

  parent reply	other threads:[~2014-11-25 16:10 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-25 16:09 [PATCH 0/7] KVM Guest Debug support for arm64 Alex Bennée
2014-11-25 16:09 ` [PATCH 1/7] KVM: add commentary for kvm_debug_exit_arch struct Alex Bennée
2014-11-26 14:20   ` Andrew Jones
2014-11-25 16:10 ` Alex Bennée [this message]
2014-11-25 16:19   ` [PATCH 2/7] KVM: arm: guest debug, define API headers Peter Maydell
2014-11-26 15:04     ` Alex Bennée
2014-11-29 16:20       ` Christoffer Dall
2014-12-01 11:30         ` Alex Bennée
2014-11-25 17:05   ` Paolo Bonzini
2014-11-25 17:13     ` Peter Maydell
2014-11-25 17:22       ` Paolo Bonzini
2014-11-26 13:13         ` Alex Bennée
2014-11-26 13:14           ` Paolo Bonzini
2014-11-26 14:31   ` Andrew Jones
2014-11-26 14:58     ` Alex Bennée
2014-11-26 16:46       ` Paolo Bonzini
2014-11-26 17:47         ` Andrew Jones
2014-11-29 16:20   ` Christoffer Dall
2014-11-25 16:10 ` [PATCH 3/7] KVM: arm: guest debug, add stub KVM_SET_GUEST_DEBUG ioctl Alex Bennée
2014-11-26 14:38   ` Andrew Jones
2014-11-26 15:03     ` Alex Bennée
2014-11-26 16:46       ` Paolo Bonzini
2014-11-29 16:21   ` Christoffer Dall
2014-11-25 16:10 ` [PATCH 4/7] KVM: arm64: guest debug, add SW break point support Alex Bennée
2014-11-26 16:07   ` Andrew Jones
2014-11-26 17:14     ` Peter Maydell
2014-11-29 16:21     ` Christoffer Dall
2014-11-29 16:21   ` Christoffer Dall
2014-12-01 11:33     ` Alex Bennée
2014-11-25 16:10 ` [PATCH 5/7] KVM: arm64: guest debug, add support for single-step Alex Bennée
2014-11-26 16:40   ` Andrew Jones
2014-11-26 18:00     ` Alex Bennée
2014-11-26 19:27   ` Peter Maydell
2014-11-30 10:10     ` Christoffer Dall
2014-11-30 10:20       ` Peter Maydell
2014-11-30 10:21   ` Christoffer Dall
2014-12-01 11:50     ` Alex Bennée
2014-12-02 13:17       ` Christoffer Dall
2014-11-25 16:10 ` [PATCH 6/7] KVM: arm64: re-factor hyp.S debug register code Alex Bennée
2014-11-26 16:49   ` Andrew Jones
2014-11-30 10:25   ` Christoffer Dall
2014-12-01 11:52     ` Alex Bennée
2014-12-02 13:23       ` Christoffer Dall
2014-11-25 16:10 ` [PATCH 7/7] KVM: arm64: guest debug, HW assisted debug support Alex Bennée
2014-11-26 17:34   ` Andrew Jones
2014-11-30 10:34   ` Christoffer Dall
2014-12-01 11:54     ` Alex Bennée

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=1416931805-23223-3-git-send-email-alex.bennee@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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).