diff --git a/qemu/target/arm/helper.c b/qemu/target/arm/helper.c index 62ac92ad..79285e32 100644 --- a/qemu/target/arm/helper.c +++ b/qemu/target/arm/helper.c @@ -1117,6 +1117,10 @@ static bool pmu_counter_enabled(CPUARMState *env, uint8_t counter) int el = arm_current_el(env); uint8_t hpmn = env->cp15.mdcr_el2 & MDCR_HPMN; + if (!arm_feature(env, ARM_FEATURE_PMU)) { + return false; + } + if (!arm_feature(env, ARM_FEATURE_EL2) || (counter < hpmn || counter == 31)) { e = env->cp15.c9_pmcr & PMCRE;