Skip to content

Commit f7767ca

Browse files
committed
target/arm: Disable SME if SVE is disabled
There is no architectural requirement that SME implies SVE, but our implementation currently assumes it. (FEAT_SME_FA64 does imply SVE.) So if you try to run a CPU with eg "-cpu max,sve=off" you quickly run into an assert when the guest tries to write to SMCR_EL1: espressif#6 0x00007ffff4b38e96 in __GI___assert_fail (assertion=0x5555566e69cb "sm", file=0x5555566e5b24 "../../target/arm/helper.c", line=6865, function=0x5555566e82f0 <__PRETTY_FUNCTION__.31> "sve_vqm1_for_el_sm") at ./assert/assert.c:101 espressif#7 0x0000555555ee33aa in sve_vqm1_for_el_sm (env=0x555557d291f0, el=2, sm=false) at ../../target/arm/helper.c:6865 espressif#8 0x0000555555ee3407 in sve_vqm1_for_el (env=0x555557d291f0, el=2) at ../../target/arm/helper.c:6871 espressif#9 0x0000555555ee3724 in smcr_write (env=0x555557d291f0, ri=0x555557da23b0, value=2147483663) at ../../target/arm/helper.c:6995 espressif#10 0x0000555555fd1dba in helper_set_cp_reg64 (env=0x555557d291f0, rip=0x555557da23b0, value=2147483663) at ../../target/arm/tcg/op_helper.c:839 espressif#11 0x00007fff60056781 in code_gen_buffer () Avoid this unsupported and slightly odd combination by disabling SME when SVE is not present. Cc: [email protected] Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2005 Signed-off-by: Peter Maydell <[email protected]> Reviewed-by: Richard Henderson <[email protected]> Message-id: [email protected]
1 parent 29b5d70 commit f7767ca

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

target/arm/cpu.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,6 +1743,16 @@ void arm_cpu_finalize_features(ARMCPU *cpu, Error **errp)
17431743
return;
17441744
}
17451745

1746+
/*
1747+
* FEAT_SME is not architecturally dependent on FEAT_SVE (unless
1748+
* FEAT_SME_FA64 is present). However our implementation currently
1749+
* assumes it, so if the user asked for sve=off then turn off SME also.
1750+
* (KVM doesn't currently support SME at all.)
1751+
*/
1752+
if (cpu_isar_feature(aa64_sme, cpu) && !cpu_isar_feature(aa64_sve, cpu)) {
1753+
object_property_set_bool(OBJECT(cpu), "sme", false, &error_abort);
1754+
}
1755+
17461756
arm_cpu_sme_finalize(cpu, &local_err);
17471757
if (local_err != NULL) {
17481758
error_propagate(errp, local_err);

0 commit comments

Comments
 (0)