Le 10/03/2021 à 02:33, Nicholas Piggin a écrit :
Excerpts from Christophe Leroy's message of March 9, 2021 10:10 pm:
No need to do that is assembly, do it in C.

Hmm. No issues with the patch as such, but why does ppc32 need this but
not 64? AFAIKS 64 sets this when a thread is created.

Looks like ppc64 was doing the same in function save_remaining_regs() in arch/ppc64/kernel/head.S until commit https://github.com/mpe/linux-fullhistory/commit/e5bb080d

But I can't find what happend to it in that commit.

Where is it done now ? Maybe that's also already done for ppc32.

Thanks
Christophe



Thanks,
Nick


Signed-off-by: Christophe Leroy <christophe.le...@csgroup.eu>
---
  arch/powerpc/include/asm/interrupt.h | 4 +++-
  arch/powerpc/kernel/entry_32.S       | 3 +--
  2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/include/asm/interrupt.h 
b/arch/powerpc/include/asm/interrupt.h
index 861e6eadc98c..e6d71c2e3aa2 100644
--- a/arch/powerpc/include/asm/interrupt.h
+++ b/arch/powerpc/include/asm/interrupt.h
@@ -33,8 +33,10 @@ static inline void interrupt_enter_prepare(struct pt_regs 
*regs, struct interrup
        if (!arch_irq_disabled_regs(regs))
                trace_hardirqs_off();
- if (user_mode(regs))
+       if (user_mode(regs)) {
+               current->thread.regs = regs;
                account_cpu_user_entry();
+       }
  #endif
        /*
         * Book3E reconciles irq soft mask in asm
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 8fe1c3fdfa6e..815a4ff1ba76 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -52,8 +52,7 @@
  prepare_transfer_to_handler:
        andi.   r0,r9,MSR_PR
        addi    r12, r2, THREAD
-       beq     2f                      /* if from user, fix up THREAD.regs */
-       stw     r3,PT_REGS(r12)
+       beq     2f
  #ifdef CONFIG_PPC_BOOK3S_32
        kuep_lock r11, r12
  #endif
--
2.25.0


Reply via email to