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 <[email protected]>
---
 target/arm/cpu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 77aa78f00e2..0432888ae34 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1501,7 +1501,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)) {
-- 
2.43.0


Reply via email to