In sve_vqm1_for_el_sm(), we implicitly assume that the CPU has SVE: if called with sm == false for non-streaming mode, we try to return a vector length from svq_vq. This hits the "assert(sm)" at the bettom of the function in an SME-only CPU where sve_vq.map is zero.
Add code to handle the "SME-only CPU not in streaming mode" case: we report an effective VL of 128 bits, which is what the architecture rule R_KXKNK says should be used when SVE instructions are disabled or trapped but floating point instructions are enabled. Signed-off-by: Peter Maydell <[email protected]> --- target/arm/helper.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 7ceab0b503..732c3a9eba 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -4763,7 +4763,7 @@ int sme_exception_el(CPUARMState *env, int el) } /* - * Given that SVE is enabled, return the vector length for EL. + * Given that SVE or SME is enabled, return the vector length for EL. */ uint32_t sve_vqm1_for_el_sm(CPUARMState *env, int el, bool sm) { @@ -4775,6 +4775,12 @@ uint32_t sve_vqm1_for_el_sm(CPUARMState *env, int el, bool sm) if (sm) { cr = env->vfp.smcr_el; map = cpu->sme_vq.map; + } else if (map == 0) { + /* + * SME-only CPU not in streaming mode: effective VL + * is 128 bits, per R_KXKNK. + */ + return 0; } if (el <= 1 && !el_is_in_host(env, el)) { -- 2.43.0
