Skip to contentSkip to conversation

kvmppc guest debug definitions

PATCH In review Liu Yu 1 participant 2 messages Aug 3, 2009

Subsystems (2)
lore
Share & tools
lore

Liu Yu

author
#0 lore raw

PATCH 2/5 kvmppc guest debug definitions

---
 arch/powerpc/include/asm/kvm.h      |   20 ++++++++++++++++++++
 arch/powerpc/include/asm/kvm_host.h |   18 ++++++++++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)
arch/powerpc/include/asm/kvm.h +20 -0
index bb2de6a..804df17 100644
@@ -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;
@@ -53,10 +56,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 */
arch/powerpc/include/asm/kvm_host.h +18 -0
index c9c930e..6caabfc 100644
@@ -109,9 +109,22 @@ struct kvmppc_exit_timing {
 struct kvm_arch {
 };
 
+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 {
 	u32 host_stack;
 	u32 host_pid;
+	u32 host_msr;
 
 	u64 fpr[32];
 	ulong gpr[32];
@@ -160,6 +173,10 @@ struct kvm_vcpu_arch {
 	u32 dbcr1;
 	u32 dbsr;
 
+	struct kvmppc_debug_reg shadow_dbg_reg;
+	struct kvmppc_debug_reg host_dbg_reg;
+	bool has_load_host_dbg;
+
 #ifdef CONFIG_KVM_EXIT_TIMING
 	struct kvmppc_exit_timing timing_exit;
 	struct kvmppc_exit_timing timing_last_enter;
@@ -187,6 +204,7 @@ struct kvm_vcpu_arch {
 
 	struct timer_list dec_timer;
 	unsigned long pending_exceptions;
+	struct kvm_guest_debug_arch dbg;
 };
 
 #endif /* __POWERPC_KVM_HOST_H__ */
Signature · 1 line
1.5.4
#1 lore raw
Quoted 21 lines

-----Original Message-----
From: Liu Yu-B13201
Sent: Monday, August 03, 2009 7:08 PM
To: [email protected]
Cc: [email protected]; [email protected]; Liu Yu-B13201
Subject: [PATCH 2/5] kvmppc guest debug definitions

---
 arch/powerpc/include/asm/kvm.h      |   20 ++++++++++++++++++++
 arch/powerpc/include/asm/kvm_host.h |   18 ++++++++++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)
arch/powerpc/include/asm/kvm_host.h +0 -0
index c9c930e..6caabfc 100644

arch/powerpc/include/asm/kvm_host.h struct kvm_vcpu_arch { · line 178

Quoted 6 lines
arch/powerpc/include/asm/kvm_host.h +3 -0
@@ -160,6 +173,10 @@ struct kvm_vcpu_arch {
 	u32 dbcr1;
 	u32 dbsr;
 
+	struct kvmppc_debug_reg shadow_dbg_reg;
+	struct kvmppc_debug_reg host_dbg_reg;
+	bool has_load_host_dbg;

Forgot to remove this variable for debug....