@samitouri / QOSamiQemu / commits / 787f05b875

target/arm: Don't provide TLBTR for pre-v6 CPUs

The TLBTR register (encoding cp15, 0, c0, c0, 3) is listed in the v7A Arm ARM appendix O as being present in v4 and v5 (section O.7.1, diagram "Organization of CP15 registers in an ARMv4 or ARMv5 VMSA implementation"). However, it isn't listed in the v5 Arm ARM, and checking individual TRMs for the arm926, arm1026, sa1100, sa1110 and ti925 shows that none of them implement it, so it seems much more likely that TLBTR was new for v6. It's also confirmed not to be present on a real arm926. Gate the register on ARM_FEATURE_V6 being present; this means that on pre-v6 cores the encoding will fall back to reporting the MIDR (due to the CP_ANY wildcarding), matching the hardware behaviour. We can also remove the "make id_tlbtr_reginfo r/w for strongarm and omap" code, because those CPUs are pre-v6 so won't be using that reginfo struct now. Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/4207 Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20260821120036.4161792-1-peter.maydell@linaro.org

Peter Maydell committed Aug 21, 2026 at 13:00 UTC 787f05b8754d0751a0c944e07a1342e043977593
1 file changed +2 -2
target/arm/helper.c
+2 -2
@@ -7353,7 +7353,6 @@ void register_cp_regs_for_features(ARMCPU *cpu)
7353 id_cp_reginfo[i].access = PL1_RW;
7354 }
7355 id_mpuir_reginfo.access = PL1_RW;
7356 - id_tlbtr_reginfo.access = PL1_RW;
7356 }
7357 if (arm_feature(env, ARM_FEATURE_V8)) {
7358 define_arm_cp_regs(cpu, id_v8_midr_cp_reginfo);
@@ -7364,7 +7363,8 @@ void register_cp_regs_for_features(ARMCPU *cpu)
7363 define_arm_cp_regs(cpu, id_pre_v8_midr_cp_reginfo);
7364 }
7365 define_arm_cp_regs(cpu, id_cp_reginfo);
7367 - if (!arm_feature(env, ARM_FEATURE_PMSA)) {
7366 + if (arm_feature(env, ARM_FEATURE_V6) &&
7367 + !arm_feature(env, ARM_FEATURE_PMSA)) {
7368 define_one_arm_cp_reg(cpu, &id_tlbtr_reginfo);
7369 } else if (arm_feature(env, ARM_FEATURE_PMSA) &&
7370 arm_feature(env, ARM_FEATURE_V8)) {