qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] target/arm: Restrict ARM_FEATURE_PMU to system emulation


From: Philippe Mathieu-Daudé
Subject: [PATCH] target/arm: Restrict ARM_FEATURE_PMU to system emulation
Date: Thu, 7 Dec 2023 12:10:48 +0100

ARM Performance Monitor Unit is not reachable from user
emulation, restrict it to system emulation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/arm/cpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 51f57fd5b4..60cf747fd6 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1410,6 +1410,7 @@ static Property arm_cpu_pmsav7_dregion_property =
                                            pmsav7_dregion,
                                            qdev_prop_uint32, uint32_t);
 
+#ifndef CONFIG_USER_ONLY
 static bool arm_get_pmu(Object *obj, Error **errp)
 {
     ARMCPU *cpu = ARM_CPU(obj);
@@ -1432,6 +1433,7 @@ static void arm_set_pmu(Object *obj, bool value, Error 
**errp)
     }
     cpu->has_pmu = value;
 }
+#endif
 
 unsigned int gt_cntfrq_period_ns(ARMCPU *cpu)
 {
@@ -1592,12 +1594,12 @@ void arm_cpu_post_init(Object *obj)
     if (arm_feature(&cpu->env, ARM_FEATURE_EL2)) {
         qdev_property_add_static(DEVICE(obj), &arm_cpu_has_el2_property);
     }
-#endif
 
     if (arm_feature(&cpu->env, ARM_FEATURE_PMU)) {
         cpu->has_pmu = true;
         object_property_add_bool(obj, "pmu", arm_get_pmu, arm_set_pmu);
     }
+#endif
 
     /*
      * Allow user to turn off VFP and Neon support, but only for TCG --
-- 
2.41.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]