diff mbox

[1/4] kvmppc: guest debug definitions

Message ID 1265183633-2230-2-git-send-email-yu.liu@freescale.com (mailing list archive)
State New, archived
Headers show

Commit Message

Liu Yu-B13201 Feb. 3, 2010, 7:53 a.m. UTC
None
diff mbox

Patch

diff --git a/arch/powerpc/include/asm/kvm.h b/arch/powerpc/include/asm/kvm.h
index 81f3b0b..b7f7861 100644
--- a/arch/powerpc/include/asm/kvm.h
+++ b/arch/powerpc/include/asm/kvm.h
@@ -22,6 +22,9 @@ 
 
 #include <linux/types.h>
 
+/* Select powerpc specific features in <linux/kvm.h> */
+#define __KVM_HAVE_GUEST_DEBUG
+
 struct kvm_regs {
 	__u64 pc;
 	__u64 cr;
@@ -71,10 +74,27 @@  struct kvm_fpu {
 };
 
 struct kvm_debug_exit_arch {
+	__u32 exception;
+	__u32 pc;
+	__u32 status;
 };
 
+#define KVM_INST_GUESTGDB               0x44000022
+
+#define KVM_GUESTDBG_USE_SW_BP          0x00010000
+#define KVM_GUESTDBG_USE_HW_BP          0x00020000
+
+#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)
+
 /* for KVM_SET_GUEST_DEBUG */
 struct kvm_guest_debug_arch {
+	struct {
+		__u32 addr;
+		__u32 type;
+	} bp[6];
 };
 
 #endif /* __LINUX_KVM_POWERPC_H */
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 5e5bae7..a364832 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -157,6 +157,18 @@  struct hpte_cache {
 	struct kvmppc_pte pte;
 };
 
+struct kvmppc_debug_reg {
+	u32 dbcr0;
+	u32 iac[0];
+	u32 iac1;
+	u32 iac2;
+	u32 iac3;
+	u32 iac4;
+	u32 dac[0];
+	u32 dac1;
+	u32 dac2;
+};
+
 struct kvm_vcpu_arch {
 	ulong host_stack;
 	u32 host_pid;
@@ -240,6 +252,9 @@  struct kvm_vcpu_arch {
 	u32 dbcr1;
 	u32 dbsr;
 
+	struct kvmppc_debug_reg shadow_dbg_reg;
+	struct kvmppc_debug_reg host_dbg_reg;
+
 #ifdef CONFIG_KVM_EXIT_TIMING
 	struct kvmppc_exit_timing timing_exit;
 	struct kvmppc_exit_timing timing_last_enter;
@@ -274,6 +289,7 @@  struct kvm_vcpu_arch {
 	struct tasklet_struct tasklet;
 	u64 dec_jiffies;
 	unsigned long pending_exceptions;
+	struct kvm_guest_debug_arch dbg;
 
 #ifdef CONFIG_PPC64
 	struct hpte_cache hpte_cache[HPTEG_CACHE_NUM];