Commit 1d01593a86 for qemu.org

commit 1d01593a86f2b103fc1f1cb72505ee176e660840
Author: Peter Maydell <peter.maydell@linaro.org>
Date:   Mon Sep 7 14:02:21 2026 +0100

    target/arm: Don't set ARM_FEATURE_VAPA for v7 PMSA

    The features VAPA (which gets you the ATS instructions and the PAR
    register) and LPAE (which gets you a 64-bit PAR and the long-format
    page table descriptors).  were originally defined in v7 as being
    A-profile only.  For v8, the ATS insns and PAR are added to
    R-profile; although there are no page table descriptors to be long or
    short, the v8R PAR format is always long-descriptor style, so it
    makes more sense to set ARM_FEATURE_LPAE than not (and matches how we
    already return true from regime_using_lpae_format() for v8R PMSA).

    Our "feature X implies feature Y" code was only taking account of
    A-profile; adjust it so that for PMSA:
     * V8 implies V7VE, LPAE, V7, and VAPA (no change from currently)
     * V7 does not imply VAPA (new)

    (v8R wants V7VE because this implies things like the existence of
    ERET and the PMOVSSET insns.)

    This will stop us incorrectly exposing the PAR and ATS insns for v7R
    CPUs (and it will be a migration break on those CPUs, which is fine
    as none of them are usable with versioned machine types).

    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Message-id: 20260907130223.3148989-7-peter.maydell@linaro.org

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index be2316bec1..10ac6c9831 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1507,7 +1507,11 @@ static void arm_cpu_propagate_feature_implications(ARMCPU *cpu)
         set_feature(env, ARM_FEATURE_V7);
     }
     if (arm_feature(env, ARM_FEATURE_V7)) {
-        set_feature(env, ARM_FEATURE_VAPA);
+        /* VAPA appears in v7A, but not in R profile until v8R */
+        if (arm_feature(env, ARM_FEATURE_V8) ||
+            !arm_feature(env, ARM_FEATURE_PMSA)) {
+            set_feature(env, ARM_FEATURE_VAPA);
+        }
         set_feature(env, ARM_FEATURE_THUMB2);
         set_feature(env, ARM_FEATURE_MPIDR);
         if (!arm_feature(env, ARM_FEATURE_M)) {