target/arm/kvm: Use generic kvm_supports_guest_debug()
cover target/arm/kvm: Use generic kvm_supports_guest_debug()
Expose kvm_supports_guest_debug() to all targets
and simplify ARM using it.
Philippe Mathieu-Daudé (2):
accel/kvm: Expose kvm_supports_guest_debug() prototype target/arm/kvm: Use generic kvm_supports_guest_debug()
accel/kvm/kvm-cpus.h | 1 - include/sysemu/kvm.h | 1 + target/arm/kvm64.c | 9 ++------- 3 files changed, 3 insertions(+), 8 deletions(-)
Signature · 1 line
2.41.0
PATCH 1/2 accel/kvm: Expose kvm_supports_guest_debug() prototype
kvm_supports_guest_debug() should be accessible by KVM implementations.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
--- accel/kvm/kvm-cpus.h | 1 - include/sysemu/kvm.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
accel/kvm/kvm-cpus.h +0 -1
@@ -18,7 +18,6 @@ void kvm_destroy_vcpu(CPUState *cpu);void kvm_cpu_synchronize_post_reset (CPUState *cpu);void kvm_cpu_synchronize_post_init (CPUState *cpu);void kvm_cpu_synchronize_pre_loadvm (CPUState *cpu); -bool kvm_supports_guest_debug (void );int kvm_insert_breakpoint (CPUState *cpu,int type,vaddr addr,vaddr len);int kvm_remove_breakpoint (CPUState *cpu,int type,vaddr addr,vaddr len);void kvm_remove_all_breakpoints (CPUState *cpu);
include/sysemu/kvm.h +1 -0
@@ -206,6 +206,7 @@ int kvm_has_gsi_routing(void);*/ bool kvm_arm_supports_user_irq (void ); +bool kvm_supports_guest_debug (void );int kvm_on_sigbus_vcpu (CPUState *cpu,int code,void *addr);int kvm_on_sigbus (int code,void *addr);
Signature · 1 line
2.41.0
Re: [PATCH-for-9.0 1/2] accel/kvm: Expose kvm_supports_guest_debug() prototype
Quoted 9 lines · Philippe Mathieu-Daudé
kvm_supports_guest_debug()should be accessible by KVM implementations.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- accel/kvm/kvm-cpus.h | 1 - include/sysemu/kvm.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
Reviewed-by Gavin Shan <[email protected]>
PATCH 2/2 target/arm/kvm: Use generic kvm_supports_guest_debug()
In reply to Philippe Mathieu-DaudéDo not open-code the generic kvm_supports_guest_debug().
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
--- target/arm/kvm64.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
target/arm/kvm64.c +2 -7
@@ -32,13 +32,8 @@#include "hw/acpi/acpi.h" #include "hw/acpi/ghes.h" -static bool have_guest_debug; -void kvm_arm_init_debug (KVMState *s) { - have_guest_debug =kvm_check_extension (s, -KVM_CAP_SET_GUEST_DEBUG ); - max_hw_wps =kvm_check_extension (s,KVM_CAP_GUEST_DEBUG_HW_WPS ); hw_watchpoints =g_array_sized_new (true, true,sizeof (HWWatchpoint), max_hw_wps);
@@ -1141,7 +1136,7 @@ static const uint32_t brk_insn = 0xd4200000;int kvm_arch_insert_sw_breakpoint (CPUState *cs,struct kvm_sw_breakpoint *bp) { -if (have_guest_debug) { +if (kvm_supports_guest_debug ()) {if (cpu_memory_rw_debug (cs, bp->pc, (uint8_t *)&bp->saved_insn,4 ,0 ) ||cpu_memory_rw_debug (cs, bp->pc, (uint8_t *)&brk_insn,4 ,1 )) {return -EINVAL ;
@@ -1157,7 +1152,7 @@ int kvm_arch_remove_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp) {static uint32_t brk; -if (have_guest_debug) { +if (kvm_supports_guest_debug ()) {if (cpu_memory_rw_debug (cs, bp->pc, (uint8_t *)&brk,4 ,0 ) || brk != brk_insn ||cpu_memory_rw_debug (cs, bp->pc, (uint8_t *)&bp->saved_insn,4 ,1 )) {
Signature · 1 line
2.41.0
Quoted 7 lines · Philippe Mathieu-Daudé
Do not open-code the generic
kvm_supports_guest_debug().Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/arm/kvm64.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
Reviewed-by Gavin Shan <[email protected]>