Add gdb break point support to PowerPC kvm
Subsystems (2)
PATCH v6 1/1 Add gdb break point support to PowerPC kvm
4 files changed, 141 insertions(+), 2 deletions(-) arch/powerpc/kvm/booke_guest.c | 16 ++++ arch/powerpc/kvm/booke_interrupts.S | 3 arch/powerpc/kvm/powerpc.c | 119 ++++++++++++++++++++++++++++++++++- include/asm-powerpc/kvm_host.h | 5 +
*Renamed funcitons with kvmppc_*
Now disable registers in dbcr0 before restoring guest and host registers
This patch adds the ability to use breakpoints from a gdb stub in userpace (currently qemu). It does this through the use of hardware debug registers.
Signed-off-by Jerone Young <[email protected]>
arch/powerpc/kvm/booke_guest.c +16 -0
@@ -410,6 +410,22 @@ int kvmppc_handle_exit(struct kvm_run *rbreak ; } +case BOOKE_INTERRUPT_DEBUG : { +u32 dbsr; + + vcpu->arch.pc =mfspr (SPRN_CSRR0 ); + +/* clear IAC events in DBSR register */ + dbsr =mfspr (SPRN_DBSR ); + + dbsr &= (DBSR_IAC1 |DBSR_IAC2 |DBSR_IAC3 |DBSR_IAC4 ); +mtspr (SPRN_DBSR , dbsr); + + run->exit_reason =KVM_EXIT_DEBUG ; + r =RESUME_HOST ; +break ; + } +default :printk (KERN_EMERG "exit_nr %d\n" , exit_nr);BUG ();
arch/powerpc/kvm/booke_interrupts.S +2 -1
@@ -42,7 +42,8 @@ #define HOST_STACK_LR (HOST_STACK_SIZE + 4) /* In caller stack frame. */ #define NEED_INST_MASK ((1<<BOOKE_INTERRUPT_PROGRAM) | \ - (1<<BOOKE_INTERRUPT_DTLB_MISS)) + (1<<BOOKE_INTERRUPT_DTLB_MISS) | \ + (1<<BOOKE_INTERRUPT_DEBUG)) #define NEED_DEAR_MASK ((1<<BOOKE_INTERRUPT_DATA_STORAGE) | \ (1<<BOOKE_INTERRUPT_DTLB_MISS))
arch/powerpc/kvm/powerpc.c +118 -1
136 lines not on this page · raw message
include/asm-powerpc/kvm_host.h +5 -0
@@ -84,6 +84,11 @@ struct kvm_vcpu_arch {u32 host_stack;u32 host_pid; +u32 host_dbcr0; +u32 host_dbcr1; +u32 host_dbcr2; +u32 host_iac[4 ]; +u32 host_msr;u64 fpr[32 ];u32 gpr[32 ];