linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Nicholas Piggin <npiggin@gmail.com>
Subject: [PATCH 1/8] powerpc: copy_thread remove unused pkey code
Date: Wed,  1 Feb 2023 02:55:27 +1000	[thread overview]
Message-ID: <20230131165534.601490-2-npiggin@gmail.com> (raw)
In-Reply-To: <20230131165534.601490-1-npiggin@gmail.com>

The pkey registers (AMR, IAMR) do not get loaded from the switch frame
so it is pointless to save anything there. Remove the dead code.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kernel/process.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index c22cc234672f..ba10505f62c1 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1814,6 +1814,7 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 	sp -= STACK_SWITCH_FRAME_SIZE;
 	((unsigned long *)sp)[0] = sp + STACK_SWITCH_FRAME_SIZE;
 	kregs = (struct pt_regs *)(sp + STACK_SWITCH_FRAME_REGS);
+	kregs->nip = ppc_function_entry(f);
 	p->thread.ksp = sp;
 
 #ifdef CONFIG_HAVE_HW_BREAKPOINT
@@ -1846,17 +1847,6 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 
 	p->thread.tidr = 0;
 #endif
-	/*
-	 * Run with the current AMR value of the kernel
-	 */
-#ifdef CONFIG_PPC_PKEY
-	if (mmu_has_feature(MMU_FTR_BOOK3S_KUAP))
-		kregs->amr = AMR_KUAP_BLOCKED;
-
-	if (mmu_has_feature(MMU_FTR_BOOK3S_KUEP))
-		kregs->iamr = AMR_KUEP_BLOCKED;
-#endif
-	kregs->nip = ppc_function_entry(f);
 	return 0;
 }
 
-- 
2.37.2


  reply	other threads:[~2023-01-31 16:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-31 16:55 [PATCH 0/8] powerpc: improve copy_thread Nicholas Piggin
2023-01-31 16:55 ` Nicholas Piggin [this message]
2023-01-31 16:55 ` [PATCH 2/8] powerpc: copy_thread make ret_from_fork register setup consistent Nicholas Piggin
2023-01-31 16:55 ` [PATCH 3/8] powerpc: use switch frame for ret_from_kernel_thread parameters Nicholas Piggin
2023-01-31 16:55 ` [PATCH 4/8] powerpc/64: ret_from_fork avoid restoring regs twice Nicholas Piggin
2023-01-31 16:55 ` [PATCH 5/8] powerpc: copy_thread differentiate kthreads and user mode threads Nicholas Piggin
2023-01-31 16:55 ` [PATCH 6/8] powerpc: differentiate kthread from user kernel thread start Nicholas Piggin
2023-01-31 16:55 ` [PATCH 7/8] powerpc: copy_thread don't set _TIF_RESTOREALL Nicholas Piggin
2023-01-31 16:55 ` [PATCH 8/8] powerpc: copy_thread don't set ppr in user interrupt frame regs Nicholas Piggin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230131165534.601490-2-npiggin@gmail.com \
    --to=npiggin@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).