Skip to content

Commit df07443

Browse files
brooniewilldeacon
authored andcommitted
arm64/signal: Clean up SVE/SME feature checking inconsistency
Currently when restoring signal state we check to see if SVE is supported in restore_sigframe() but check to see if SVE is supported inside restore_sve_fpsimd_context(). This makes no real difference since SVE is always supported in systems with SME but looks a bit untidy and makes things slightly harder to follow, move the SVE check next to the SME one in restore_sve_fpsimd_context(). Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent d69d564 commit df07443

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

arch/arm64/kernel/signal.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,9 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user)
280280

281281
vl = task_get_sme_vl(current);
282282
} else {
283+
if (!system_supports_sve())
284+
return -EINVAL;
285+
283286
vl = task_get_sve_vl(current);
284287
}
285288

@@ -342,9 +345,14 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user)
342345

343346
#else /* ! CONFIG_ARM64_SVE */
344347

345-
/* Turn any non-optimised out attempts to use these into a link error: */
348+
static int restore_sve_fpsimd_context(struct user_ctxs *user)
349+
{
350+
WARN_ON_ONCE(1);
351+
return -EINVAL;
352+
}
353+
354+
/* Turn any non-optimised out attempts to use this into a link error: */
346355
extern int preserve_sve_context(void __user *ctx);
347-
extern int restore_sve_fpsimd_context(struct user_ctxs *user);
348356

349357
#endif /* ! CONFIG_ARM64_SVE */
350358

@@ -649,14 +657,10 @@ static int restore_sigframe(struct pt_regs *regs,
649657
if (!user.fpsimd)
650658
return -EINVAL;
651659

652-
if (user.sve) {
653-
if (!system_supports_sve())
654-
return -EINVAL;
655-
660+
if (user.sve)
656661
err = restore_sve_fpsimd_context(&user);
657-
} else {
662+
else
658663
err = restore_fpsimd_context(user.fpsimd);
659-
}
660664
}
661665

662666
if (err == 0 && system_supports_sme() && user.za)

0 commit comments

Comments
 (0)