public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH v2] arm64/signal: Clean up SVE/SME feature checking inconsistency
@ 2022-06-24 13:44 Mark Brown
  2022-06-24 16:57 ` Will Deacon
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2022-06-24 13:44 UTC (permalink / raw)
  To: Will Deacon, Catalin Marinas; +Cc: linux-arm-kernel, Mark Brown

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 <broonie@kernel.org>
---

v2:
 - Add a stub restore_sve_fpsimd_context() to hopefully fix an
   allnoconfig issue, I can't reproduce locally.

 arch/arm64/kernel/signal.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index b0980fbb6bc7..6b6a79806e82 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -280,6 +280,9 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user)
 
 		vl = task_get_sme_vl(current);
 	} else {
+		if (!system_supports_sve())
+			return -EINVAL;
+
 		vl = task_get_sve_vl(current);
 	}
 
@@ -342,9 +345,13 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user)
 
 #else /* ! CONFIG_ARM64_SVE */
 
-/* Turn any non-optimised out attempts to use these into a link error: */
+static int restore_sve_fpsimd_context(struct user_ctxs *user)
+{
+	return 0;
+}
+
+/* Turn any non-optimised out attempts to use this into a link error: */
 extern int preserve_sve_context(void __user *ctx);
-extern int restore_sve_fpsimd_context(struct user_ctxs *user);
 
 #endif /* ! CONFIG_ARM64_SVE */
 
@@ -649,14 +656,10 @@ static int restore_sigframe(struct pt_regs *regs,
 		if (!user.fpsimd)
 			return -EINVAL;
 
-		if (user.sve) {
-			if (!system_supports_sve())
-				return -EINVAL;
-
+		if (user.sve)
 			err = restore_sve_fpsimd_context(&user);
-		} else {
+		else
 			err = restore_fpsimd_context(user.fpsimd);
-		}
 	}
 
 	if (err == 0 && system_supports_sme() && user.za)
-- 
2.30.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] arm64/signal: Clean up SVE/SME feature checking inconsistency
  2022-06-24 13:44 [PATCH v2] arm64/signal: Clean up SVE/SME feature checking inconsistency Mark Brown
@ 2022-06-24 16:57 ` Will Deacon
  0 siblings, 0 replies; 2+ messages in thread
From: Will Deacon @ 2022-06-24 16:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Catalin Marinas, linux-arm-kernel

On Fri, Jun 24, 2022 at 02:44:14PM +0100, Mark Brown wrote:
> 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 <broonie@kernel.org>
> ---
> 
> v2:
>  - Add a stub restore_sve_fpsimd_context() to hopefully fix an
>    allnoconfig issue, I can't reproduce locally.
> 
>  arch/arm64/kernel/signal.c | 19 +++++++++++--------
>  1 file changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
> index b0980fbb6bc7..6b6a79806e82 100644
> --- a/arch/arm64/kernel/signal.c
> +++ b/arch/arm64/kernel/signal.c
> @@ -280,6 +280,9 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user)
>  
>  		vl = task_get_sme_vl(current);
>  	} else {
> +		if (!system_supports_sve())
> +			return -EINVAL;
> +
>  		vl = task_get_sve_vl(current);
>  	}
>  
> @@ -342,9 +345,13 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user)
>  
>  #else /* ! CONFIG_ARM64_SVE */
>  
> -/* Turn any non-optimised out attempts to use these into a link error: */
> +static int restore_sve_fpsimd_context(struct user_ctxs *user)
> +{
> +	return 0;
> +}

Given that this should never be called, should we return an error instead
of 0 (or possibly even WARN/BUG)?

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-24 16:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-24 13:44 [PATCH v2] arm64/signal: Clean up SVE/SME feature checking inconsistency Mark Brown
2022-06-24 16:57 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox