On 8/1/25 19:06, Smail AIDER wrote:
Create a common helper for pmreg_access and pmreg_access_pmcr to improve
readability.
Signed-off-by: Smail AIDER <smail.ai...@huawei.com>
---
target/arm/cpregs-pmu.c | 40 +++++++++++++++++++---------------------
1 file changed, 19 insertions(+), 21 deletions(-)
The squash of these two patch is what I asked for.
diff --git a/target/arm/cpregs-pmu.c b/target/arm/cpregs-pmu.c
index 3aacd4f652..adaaaf2517 100644
--- a/target/arm/cpregs-pmu.c
+++ b/target/arm/cpregs-pmu.c
@@ -228,22 +228,28 @@ static bool event_supported(uint16_t number)
return supported_event_map[number] != UNSUPPORTED_EVENT;
}
-static CPAccessResult pmreg_access(CPUARMState *env, const ARMCPRegInfo *ri,
- bool isread)
+static CPAccessResult do_pmreg_access(CPUARMState *env, bool is_pmcr)
{
/*
* Performance monitor registers user accessibility is controlled
- * by PMUSERENR. MDCR_EL2.TPM and MDCR_EL3.TPM allow configurable
+ * by PMUSERENR. MDCR_EL2.TPM/TPMCR and MDCR_EL3.TPM allow configurable
* trapping to EL2 or EL3 for other accesses.
*/
int el = arm_current_el(env);
- uint64_t mdcr_el2 = arm_mdcr_el2_eff(env);
+ uint64_t mdcr_el2;
if (el == 0 && !(env->cp15.c9_pmuserenr & 1)) {
return CP_ACCESS_TRAP_EL1;
}
- if (el < 2 && (mdcr_el2 & MDCR_TPM)) {
- return CP_ACCESS_TRAP_EL2;
+ if (el < 2) {
+ mdcr_el2 = arm_mdcr_el2_eff(env);
Move the declaration here too:
uint64_t mdcr_el2 = arm_mdcr_el2_eff(env);
With that,
Reviewed-by: Richard Henderson <richard.hender...@linaro.org>
r~