Skip to content

Commit b248280

Browse files
brooniectmarinas
authored andcommitted
arm64/sme: Optimise SME exit on syscall entry
Our ABI says that we exit streaming mode on syscall entry. Currently we check if we are in streaming mode before doing this but since we have a SMSTOP SM instruction which will clear SVCR.SM in a single atomic operation we can save ourselves the read of the system register and check of the flag and just unconditionally do the SMSTOP SM. If we are not in streaming mode it results in a noop change to SVCR, if we are in streaming mode we will exit as desired. No functional change. Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent fcd3d2c commit b248280

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

arch/arm64/kernel/syscall.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,8 @@ static inline void fp_user_discard(void)
173173
* register state to track, if this changes the KVM code will
174174
* need updating.
175175
*/
176-
if (system_supports_sme() && test_thread_flag(TIF_SME)) {
177-
u64 svcr = read_sysreg_s(SYS_SVCR);
178-
179-
if (svcr & SVCR_SM_MASK)
180-
sme_smstop_sm();
181-
}
176+
if (system_supports_sme())
177+
sme_smstop_sm();
182178

183179
if (!system_supports_sve())
184180
return;

0 commit comments

Comments
 (0)