]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
target/arm: Account for SME in aarch64_sve_narrow_vq() assertion
authorPeter Maydell <peter.maydell@linaro.org>
Wed, 18 Feb 2026 18:40:13 +0000 (18:40 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Wed, 18 Feb 2026 18:40:13 +0000 (18:40 +0000)
In aarch64_sve_narrow_vq() we assert that the new VQ is within
the maximum supported range for the CPU. We forgot to update
this to account for SME, which might have a different maximum.

Update the assert to permit any VQ which is valid for either
SVE or SME.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20260202133353.2231685-2-peter.maydell@linaro.org

target/arm/helper.c
target/arm/internals.h

index 8c5769477cf14f40a0dd30d535d80a2728fd68bd..373f0ebcb34cba746117c8f9efb1d9f1c436cc00 100644 (file)
@@ -10088,7 +10088,7 @@ void aarch64_sve_narrow_vq(CPUARMState *env, unsigned vq)
     uint64_t pmask;
 
     assert(vq >= 1 && vq <= ARM_MAX_VQ);
-    assert(vq <= env_archcpu(env)->sve_max_vq);
+    assert(vq <= arm_max_vq(env_archcpu(env)));
 
     /* Zap the high bits of the zregs.  */
     for (i = 0; i < 32; i++) {
index f7b641342a4d47d9853ed1df239ec80033eb3b61..8ec27508473d33fe196fda7d813134588b0700be 100644 (file)
@@ -1808,6 +1808,15 @@ static inline uint64_t arm_mdcr_el2_eff(CPUARMState *env)
     ((1 << (1 - 1)) | (1 << (2 - 1)) |                  \
      (1 << (4 - 1)) | (1 << (8 - 1)) | (1 << (16 - 1)))
 
+/*
+ * Return the maximum SVE/SME VQ for this CPU. This defines
+ * the maximum possible size of the Zn vector registers.
+ */
+static inline int arm_max_vq(ARMCPU *cpu)
+{
+    return MAX(cpu->sve_max_vq, cpu->sme_max_vq);
+}
+
 /*
  * Return true if it is possible to take a fine-grained-trap to EL2.
  */