[2/4] arm64/signal: Alloc tpidr2 sigframe after checking system_supports_tpidr2()

Message ID 20230317124915.1263-3-sundongxu3@huawei.com
State New
Headers
Series arm64: Use specific checking for TPIDR2 and some comments update |

Commit Message

sundongxu (A) March 17, 2023, 12:49 p.m. UTC
  Move tpidr2 sigframe allocation from under the checking of
system_supports_sme() to the checking of system_supports_tpidr2().

Signed-off-by: Dongxu Sun <sundongxu3@huawei.com>
---
 arch/arm64/kernel/signal.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
  

Comments

Mark Brown March 17, 2023, 12:55 p.m. UTC | #1
On Fri, Mar 17, 2023 at 08:49:13PM +0800, Dongxu Sun wrote:
> Move tpidr2 sigframe allocation from under the checking of
> system_supports_sme() to the checking of system_supports_tpidr2().

Reviewed-by: Mark Brown <broonie@kernel.org>

I didn't check the context enough to confirm if this may reorder things
in the sigframe but given that we don't have shipping hardware yet and
the layout is generally subject to change I think that's fine.
  

Patch

diff --git a/arch/arm64/kernel/signal.c b/arch/arm64/kernel/signal.c
index 032e97f8cae0..2cfc810d0a5b 100644
--- a/arch/arm64/kernel/signal.c
+++ b/arch/arm64/kernel/signal.c
@@ -893,6 +893,13 @@  static int setup_sigframe_layout(struct rt_sigframe_user_layout *user,
 			return err;
 	}
 
+	if (system_supports_tpidr2()) {
+		err = sigframe_alloc(user, &user->tpidr2_offset,
+				     sizeof(struct tpidr2_context));
+		if (err)
+			return err;
+	}
+
 	if (system_supports_sme()) {
 		unsigned int vl;
 		unsigned int vq = 0;
@@ -902,11 +909,6 @@  static int setup_sigframe_layout(struct rt_sigframe_user_layout *user,
 		else
 			vl = task_get_sme_vl(current);
 
-		err = sigframe_alloc(user, &user->tpidr2_offset,
-				     sizeof(struct tpidr2_context));
-		if (err)
-			return err;
-
 		if (thread_za_enabled(&current->thread))
 			vq = sve_vq_from_vl(vl);