Add gdb break point support to PowerPC kvm
Subsystems (2)
PATCH v7 1/1 Add gdb break point support to PowerPC kvm
4 files changed, 142 insertions(+), 2 deletions(-) arch/powerpc/kvm/booke_guest.c | 16 ++++ arch/powerpc/kvm/booke_interrupts.S | 3 arch/powerpc/kvm/powerpc.c | 120 ++++++++++++++++++++++++++++++++++- include/asm-powerpc/kvm_host.h | 5 +
*Placed wrong definitions when disabling registers in dbcr0
before restoring guest and host registers. Doh! This fixes it. Also add more registers in dbcr0 to disable just in case.
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 +119 -1
137 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 ];