[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/21] target/arm: kvm64: remove a redundant KVM_CAP_SET_GUEST_DE
From: |
Richard Henderson |
Subject: |
[PATCH 02/21] target/arm: kvm64: remove a redundant KVM_CAP_SET_GUEST_DEBUG probe |
Date: |
Wed, 22 Nov 2023 22:42:00 -0600 |
From: Chao Du <duchao@eswincomputing.com>
The KVM_CAP_SET_GUEST_DEBUG is probed during kvm_init().
gdbserver will fail to start if the CAP is not supported.
So no need to make another probe here, like other targets.
Signed-off-by: Chao Du <duchao@eswincomputing.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20231025070726.22689-1-duchao@eswincomputing.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/arm/kvm64.c | 28 +++++++---------------------
1 file changed, 7 insertions(+), 21 deletions(-)
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index 3c175c93a7..b8bb25a1ea 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -32,13 +32,9 @@
#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,33 +1137,23 @@ 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 (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;
- }
- return 0;
- } else {
- error_report("guest debug not supported on this kernel");
+ 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;
}
+ return 0;
}
int kvm_arch_remove_sw_breakpoint(CPUState *cs, struct kvm_sw_breakpoint *bp)
{
static uint32_t brk;
- if (have_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))
{
- return -EINVAL;
- }
- return 0;
- } else {
- error_report("guest debug not supported on this kernel");
+ 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)) {
return -EINVAL;
}
+ return 0;
}
/* See v8 ARM ARM D7.2.27 ESR_ELx, Exception Syndrome Register
--
2.34.1
- Re: [PATCH 06/21] target/arm/kvm: Move kvm_arm_hw_debug_active and unexport, (continued)
- [PATCH 05/21] target/arm/kvm: Move kvm_arm_copy_hw_debug_data and unexport, Richard Henderson, 2023/11/22
- [PATCH 04/21] target/arm/kvm: Move kvm_arm_verify_ext_dabt_pending and unexport, Richard Henderson, 2023/11/22
- [PATCH 07/21] target/arm/kvm: Move kvm_arm_handle_debug and unexport, Richard Henderson, 2023/11/22
- [PATCH 02/21] target/arm: kvm64: remove a redundant KVM_CAP_SET_GUEST_DEBUG probe,
Richard Henderson <=
- [PATCH 12/21] target/arm/kvm: Move kvm_arm_cpreg_level and unexport, Richard Henderson, 2023/11/22
- [PATCH 10/21] target/arm/kvm: Move kvm_arm_get_host_cpu_features and unexport, Richard Henderson, 2023/11/22
- [PATCH 09/21] target/arm/kvm: Inline kvm_arm_steal_time_supported, Richard Henderson, 2023/11/22