All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] arm64/sme: Fix context switch for SME only systems
  2022-12-27 17:12 [PATCH 0/3] arm64/sme: Fixes for SME only support Mark Brown
@ 2022-12-27 17:12 ` Mark Brown
  2022-12-27 17:12 ` [PATCH 2/3] arm64/signal: Always accept SVE signal frames on " Mark Brown
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2022-12-27 17:12 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon; +Cc: linux-arm-kernel, Mark Brown

When refactoring fpsimd_load() to support keeping SVE enabled over syscalls
support for systems with SME but not SVE was broken. The code that selects
between loading regular FPSIMD and SVE states was guarded by using
system_supports_sve() but is also needed to handle the streaming SVE state
in SME only systems where that check will be false. Fix this by also
checking for system_supports_sme().

Fixes: a0136be443d ("arm64/fpsimd: Load FP state based on recorded data type")
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 arch/arm64/kernel/fpsimd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c
index dcc81e7200d4..b6ef1af0122e 100644
--- a/arch/arm64/kernel/fpsimd.c
+++ b/arch/arm64/kernel/fpsimd.c
@@ -385,7 +385,7 @@ static void task_fpsimd_load(void)
 	WARN_ON(!system_supports_fpsimd());
 	WARN_ON(!have_cpu_fpsimd_context());
 
-	if (system_supports_sve()) {
+	if (system_supports_sve() || system_supports_sme()) {
 		switch (current->thread.fp_type) {
 		case FP_STATE_FPSIMD:
 			/* Stop tracking SVE for this task until next use. */

-- 
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] 9+ messages in thread

* [PATCH 0/3] arm64/sme: Fixes for SME only support
@ 2022-12-27 17:12 Mark Brown
  2022-12-27 17:12 ` [PATCH 1/3] arm64/sme: Fix context switch for SME only systems Mark Brown
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Mark Brown @ 2022-12-27 17:12 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon; +Cc: linux-arm-kernel, Mark Brown

There is no architectural requirement for systems implementing SME to
also implement SVE, though it is expected to be an unusual configuration.
This series fixes several cases where such systems would encounter
problems, one introduced in the refactoring to avoid disabling SVE over
system call and the other two in signal handling which have been there
since SME was initially supported.

To: Catalin Marinas <catalin.marinas@arm.com>
To: Will Deacon <will@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Mark Brown <broonie@kernel.org>

---
Mark Brown (3):
      arm64/sme: Fix context switch for SME only systems
      arm64/signal: Always accept SVE signal frames on SME only systems
      arm64/signal: Always allocate SVE signal frames on SME only systems

 arch/arm64/kernel/fpsimd.c | 2 +-
 arch/arm64/kernel/signal.c | 9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)
---
base-commit: 1b929c02afd37871d5afb9d498426f83432e71c2
change-id: 20221223-arm64-fix-sme-only-2abc130cde3f

Best regards,
-- 
Mark Brown <broonie@kernel.org>

_______________________________________________
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] 9+ messages in thread

* [PATCH 2/3] arm64/signal: Always accept SVE signal frames on SME only systems
  2022-12-27 17:12 [PATCH 0/3] arm64/sme: Fixes for SME only support Mark Brown
  2022-12-27 17:12 ` [PATCH 1/3] arm64/sme: Fix context switch for SME only systems Mark Brown
@ 2022-12-27 17:12 ` Mark Brown
  2022-12-27 17:12 ` [PATCH 3/3] arm64/signal: Always allocate " Mark Brown
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2022-12-27 17:12 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon; +Cc: linux-arm-kernel, Mark Brown

Currently we reject an attempt to restore a SVE signal frame on a system
with SME but not SVE supported. This means that it is not possible to
disable streaming mode via signal return as this is configured via the
flags in the SVE signal context. Instead accept the signal frame, we will
require it to have a vector length of 0 specified and no payload since the
task will have no SVE vector length configured.

Fixes: 85ed24dad29 ("arm64/sme: Implement streaming SVE signal handling")
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 arch/arm64/kernel/signal.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index e0d09bf5b01b..f90ee2dc413c 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -281,7 +281,12 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user)
 
 		vl = task_get_sme_vl(current);
 	} else {
-		if (!system_supports_sve())
+		/*
+		 * A SME only system use SVE for streaming mode so can
+		 * have a SVE formatted context with a zero VL and no
+		 * payload data.
+		 */
+		if (!system_supports_sve() && !system_supports_sme())
 			return -EINVAL;
 
 		vl = task_get_sve_vl(current);

-- 
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] 9+ messages in thread

* [PATCH 3/3] arm64/signal: Always allocate SVE signal frames on SME only systems
  2022-12-27 17:12 [PATCH 0/3] arm64/sme: Fixes for SME only support Mark Brown
  2022-12-27 17:12 ` [PATCH 1/3] arm64/sme: Fix context switch for SME only systems Mark Brown
  2022-12-27 17:12 ` [PATCH 2/3] arm64/signal: Always accept SVE signal frames on " Mark Brown
@ 2022-12-27 17:12 ` Mark Brown
  2023-01-05 15:22 ` [PATCH 0/3] arm64/sme: Fixes for SME only support Will Deacon
  2023-01-05 18:03 ` Will Deacon
  4 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2022-12-27 17:12 UTC (permalink / raw)
  To: Catalin Marinas, Will Deacon; +Cc: linux-arm-kernel, Mark Brown

Currently we only allocate space for SVE signal frames on systems that
support SVE, meaning that SME only systems do not allocate a signal frame
for streaming mode SVE state. Change the check so space is allocated if
either feature is supported.

Fixes: 85ed24dad29 ("arm64/sme: Implement streaming SVE signal handling")
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 arch/arm64/kernel/signal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index f90ee2dc413c..be279fd48248 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -737,7 +737,7 @@ static int setup_sigframe_layout(struct rt_sigframe_user_layout *user,
 			return err;
 	}
 
-	if (system_supports_sve()) {
+	if (system_supports_sve() || system_supports_sme()) {
 		unsigned int vq = 0;
 
 		if (add_all || test_thread_flag(TIF_SVE) ||

-- 
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] 9+ messages in thread

* Re: [PATCH 0/3] arm64/sme: Fixes for SME only support
  2022-12-27 17:12 [PATCH 0/3] arm64/sme: Fixes for SME only support Mark Brown
                   ` (2 preceding siblings ...)
  2022-12-27 17:12 ` [PATCH 3/3] arm64/signal: Always allocate " Mark Brown
@ 2023-01-05 15:22 ` Will Deacon
  2023-01-05 15:29   ` Will Deacon
  2023-01-05 15:47   ` Mark Brown
  2023-01-05 18:03 ` Will Deacon
  4 siblings, 2 replies; 9+ messages in thread
From: Will Deacon @ 2023-01-05 15:22 UTC (permalink / raw)
  To: Mark Brown; +Cc: Catalin Marinas, linux-arm-kernel

On Tue, Dec 27, 2022 at 05:12:04PM +0000, Mark Brown wrote:
> There is no architectural requirement for systems implementing SME to
> also implement SVE, though it is expected to be an unusual configuration.

How unusual? If people aren't practically going to build this, I think
we'd be better off keeping the code simple and not supporting SME unless
SVE is also present.

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] 9+ messages in thread

* Re: [PATCH 0/3] arm64/sme: Fixes for SME only support
  2023-01-05 15:22 ` [PATCH 0/3] arm64/sme: Fixes for SME only support Will Deacon
@ 2023-01-05 15:29   ` Will Deacon
  2023-01-05 16:00     ` Mark Brown
  2023-01-05 15:47   ` Mark Brown
  1 sibling, 1 reply; 9+ messages in thread
From: Will Deacon @ 2023-01-05 15:29 UTC (permalink / raw)
  To: Mark Brown; +Cc: Catalin Marinas, linux-arm-kernel

On Thu, Jan 05, 2023 at 03:22:28PM +0000, Will Deacon wrote:
> On Tue, Dec 27, 2022 at 05:12:04PM +0000, Mark Brown wrote:
> > There is no architectural requirement for systems implementing SME to
> > also implement SVE, though it is expected to be an unusual configuration.
> 
> How unusual? If people aren't practically going to build this, I think
> we'd be better off keeping the code simple and not supporting SME unless
> SVE is also present.

(I'll queue these three anyway, as they're all simple, so the above is more
 of a question to you as this feels like we're making a rod for our own back
 and we'll continue to miss the extra condition).

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] 9+ messages in thread

* Re: [PATCH 0/3] arm64/sme: Fixes for SME only support
  2023-01-05 15:22 ` [PATCH 0/3] arm64/sme: Fixes for SME only support Will Deacon
  2023-01-05 15:29   ` Will Deacon
@ 2023-01-05 15:47   ` Mark Brown
  1 sibling, 0 replies; 9+ messages in thread
From: Mark Brown @ 2023-01-05 15:47 UTC (permalink / raw)
  To: Will Deacon; +Cc: Catalin Marinas, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 947 bytes --]

On Thu, Jan 05, 2023 at 03:22:29PM +0000, Will Deacon wrote:
> On Tue, Dec 27, 2022 at 05:12:04PM +0000, Mark Brown wrote:

> > There is no architectural requirement for systems implementing SME to
> > also implement SVE, though it is expected to be an unusual configuration.

> How unusual? If people aren't practically going to build this, I think
> we'd be better off keeping the code simple and not supporting SME unless
> SVE is also present.

I can't comment on anyone's roadmaps, but this is a configuration I've
been asked about by other people rather than just something I thought of
myself so it has been considered and I can see why someone might think
about implementing such a system.  Given that the changes are just
adding system_supports_sme() to existing configuration checks so that we
go through code paths that are already being exercised anyway I think
it's sufficiently non-invasive to justify the cost of handling the case.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
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] 9+ messages in thread

* Re: [PATCH 0/3] arm64/sme: Fixes for SME only support
  2023-01-05 15:29   ` Will Deacon
@ 2023-01-05 16:00     ` Mark Brown
  0 siblings, 0 replies; 9+ messages in thread
From: Mark Brown @ 2023-01-05 16:00 UTC (permalink / raw)
  To: Will Deacon; +Cc: Catalin Marinas, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 519 bytes --]

On Thu, Jan 05, 2023 at 03:29:49PM +0000, Will Deacon wrote:

> (I'll queue these three anyway, as they're all simple, so the above is more
>  of a question to you as this feels like we're making a rod for our own back
>  and we'll continue to miss the extra condition).

Thanks.  If we were doing anything complex to cover this case I'd be
more worried but as it is my judgement is that it's easier to just
handle the case than to explain the status.  It's also well supported by
the models so easy to keep an eye on.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
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] 9+ messages in thread

* Re: [PATCH 0/3] arm64/sme: Fixes for SME only support
  2022-12-27 17:12 [PATCH 0/3] arm64/sme: Fixes for SME only support Mark Brown
                   ` (3 preceding siblings ...)
  2023-01-05 15:22 ` [PATCH 0/3] arm64/sme: Fixes for SME only support Will Deacon
@ 2023-01-05 18:03 ` Will Deacon
  4 siblings, 0 replies; 9+ messages in thread
From: Will Deacon @ 2023-01-05 18:03 UTC (permalink / raw)
  To: Mark Brown, Catalin Marinas; +Cc: kernel-team, Will Deacon, linux-arm-kernel

On Tue, 27 Dec 2022 17:12:04 +0000, Mark Brown wrote:
> There is no architectural requirement for systems implementing SME to
> also implement SVE, though it is expected to be an unusual configuration.
> This series fixes several cases where such systems would encounter
> problems, one introduced in the refactoring to avoid disabling SVE over
> system call and the other two in signal handling which have been there
> since SME was initially supported.
> 
> [...]

Applied to arm64 (for-next/fixes), thanks!

[1/3] arm64/sme: Fix context switch for SME only systems
      https://git.kernel.org/arm64/c/0cab5b4964c7
[2/3] arm64/signal: Always accept SVE signal frames on SME only systems
      https://git.kernel.org/arm64/c/7dde62f0687c
[3/3] arm64/signal: Always allocate SVE signal frames on SME only systems
      https://git.kernel.org/arm64/c/f26cd7372160

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

_______________________________________________
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] 9+ messages in thread

end of thread, other threads:[~2023-01-05 23:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-27 17:12 [PATCH 0/3] arm64/sme: Fixes for SME only support Mark Brown
2022-12-27 17:12 ` [PATCH 1/3] arm64/sme: Fix context switch for SME only systems Mark Brown
2022-12-27 17:12 ` [PATCH 2/3] arm64/signal: Always accept SVE signal frames on " Mark Brown
2022-12-27 17:12 ` [PATCH 3/3] arm64/signal: Always allocate " Mark Brown
2023-01-05 15:22 ` [PATCH 0/3] arm64/sme: Fixes for SME only support Will Deacon
2023-01-05 15:29   ` Will Deacon
2023-01-05 16:00     ` Mark Brown
2023-01-05 15:47   ` Mark Brown
2023-01-05 18:03 ` Will Deacon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.