@samitouri / QOSamiQemu / commits / aad2691d06

target/arm: Better describe PMU depends on TCG or HVF

PMU is supported by TCG / HVF but not KVM. Make it explicit rewriting '!KVM' as 'TCG || HVF' (ignoring QTest, because vCPUs are not available there). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-Id: <20251028054238.14949-57-philmd@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>

Philippe Mathieu-Daudé committed Jun 25, 2025 at 23:54 UTC aad2691d066708d2f5d9761c864a3b53ef69f402
2 files changed +6 -6
target/arm/cpu.c
+1 -1
@@ -2183,7 +2183,7 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
2183 if (arm_feature(env, ARM_FEATURE_PMU)) {
2184 pmu_init(cpu);
2185
2186 - if (!kvm_enabled()) {
2186 + if (tcg_enabled() || hvf_enabled()) {
2187 arm_register_pre_el_change_hook(cpu, &pmu_pre_el_change, 0);
2188 arm_register_el_change_hook(cpu, &pmu_post_el_change, 0);
2189 }
target/arm/machine.c
+5 -5
@@ -3,7 +3,7 @@
3 #include "cpregs.h"
4 #include "trace.h"
5 #include "qemu/error-report.h"
6 -#include "system/kvm.h"
6 +#include "system/hvf.h"
7 #include "system/tcg.h"
8 #include "kvm_arm.h"
9 #include "internals.h"
@@ -983,7 +983,7 @@ static int cpu_pre_save(void *opaque)
983 {
984 ARMCPU *cpu = opaque;
985
986 - if (!kvm_enabled()) {
986 + if (tcg_enabled() || hvf_enabled()) {
987 pmu_op_start(&cpu->env);
988 }
989
@@ -1021,7 +1021,7 @@ static void cpu_post_save(void *opaque)
1021 {
1022 ARMCPU *cpu = opaque;
1023
1024 - if (!kvm_enabled()) {
1024 + if (tcg_enabled() || hvf_enabled()) {
1025 pmu_op_finish(&cpu->env);
1026 }
1027
@@ -1055,7 +1055,7 @@ static int cpu_pre_load(void *opaque)
1055 */
1056 env->irq_line_state = UINT32_MAX;
1057
1058 - if (!kvm_enabled()) {
1058 + if (tcg_enabled() || hvf_enabled()) {
1059 pmu_op_start(env);
1060 }
1061
@@ -1234,7 +1234,7 @@ static int cpu_post_load(void *opaque, int version_id)
1234 }
1235 }
1236
1237 - if (!kvm_enabled()) {
1237 + if (tcg_enabled() || hvf_enabled()) {
1238 pmu_op_finish(env);
1239 }
1240