Skip to content

Commit fd2ddd1

Browse files
Maxim Levitskybonzini
authored andcommitted
kvm: add support for KVM_GUESTDBG_BLOCKIRQ
Use the KVM_GUESTDBG_BLOCKIRQ debug flag if supported. Signed-off-by: Maxim Levitsky <[email protected]> [Extracted from Maxim's patch into a separate commit. - Paolo] Signed-off-by: Paolo Bonzini <[email protected]> Reviewed-by: Alex Bennée <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 12bc5b4 commit fd2ddd1

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

accel/kvm/kvm-all.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@
6161
#endif
6262
#define PAGE_SIZE qemu_real_host_page_size
6363

64+
#ifndef KVM_GUESTDBG_BLOCKIRQ
65+
#define KVM_GUESTDBG_BLOCKIRQ 0
66+
#endif
67+
6468
//#define DEBUG_KVM
6569

6670
#ifdef DEBUG_KVM
@@ -2574,6 +2578,15 @@ static int kvm_init(MachineState *ms)
25742578
kvm_sstep_flags = 0;
25752579
if (kvm_has_guest_debug) {
25762580
kvm_sstep_flags = SSTEP_ENABLE;
2581+
2582+
#if defined KVM_CAP_SET_GUEST_DEBUG2
2583+
int guest_debug_flags =
2584+
kvm_check_extension(s, KVM_CAP_SET_GUEST_DEBUG2);
2585+
2586+
if (guest_debug_flags & KVM_GUESTDBG_BLOCKIRQ) {
2587+
kvm_sstep_flags |= SSTEP_NOIRQ;
2588+
}
2589+
#endif
25772590
}
25782591

25792592
kvm_state = s;
@@ -3205,6 +3218,10 @@ int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap)
32053218

32063219
if (cpu->singlestep_enabled) {
32073220
data.dbg.control |= KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_SINGLESTEP;
3221+
3222+
if (cpu->singlestep_enabled & SSTEP_NOIRQ) {
3223+
data.dbg.control |= KVM_GUESTDBG_BLOCKIRQ;
3224+
}
32083225
}
32093226
kvm_arch_update_guest_debug(cpu, &data.dbg);
32103227

0 commit comments

Comments
 (0)