Skip to content

Commit

Permalink
powerpc/rtas: Call enter_rtas with MSR[EE] disabled
Browse files Browse the repository at this point in the history
Disable MSR[EE] in C code rather than asm.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Laurent Dufour <ldufour@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220308135047.478297-5-npiggin@gmail.com
  • Loading branch information
Nicholas Piggin authored and Michael Ellerman committed May 19, 2022
1 parent 4e949fa commit c5a65e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
4 changes: 4 additions & 0 deletions arch/powerpc/kernel/rtas.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ static inline void do_enter_rtas(unsigned long args)
msr = mfmsr();
BUG_ON(!(msr & MSR_RI));

BUG_ON(!irqs_disabled());

hard_irq_disable(); /* Ensure MSR[EE] is disabled on PPC64 */

enter_rtas(args);

srr_regs_clobbered(); /* rtas uses SRRs, invalidate */
Expand Down
15 changes: 0 additions & 15 deletions arch/powerpc/kernel/rtas_entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ _GLOBAL(enter_rtas)
lwz r4,RTASBASE(r4)
mfmsr r9
stw r9,8(r1)
LOAD_REG_IMMEDIATE(r0,MSR_KERNEL)
mtmsr r0 /* disable interrupts so SRR0/1 don't get trashed */
li r9,MSR_KERNEL & ~(MSR_IR|MSR_DR)
mtlr r6
stw r1, THREAD + RTAS_SP(r2)
Expand Down Expand Up @@ -87,20 +85,7 @@ _GLOBAL(enter_rtas)
li r0,0
mtcr r0

#ifdef CONFIG_BUG
/* There is no way it is acceptable to get here with interrupts enabled,
* check it with the asm equivalent of WARN_ON
*/
lbz r0,PACAIRQSOFTMASK(r13)
1: tdeqi r0,IRQS_ENABLED
EMIT_WARN_ENTRY 1b,__FILE__,__LINE__,BUGFLAG_WARNING
#endif

/* Hard-disable interrupts */
mfmsr r6
rldicl r7,r6,48,1
rotldi r7,r7,16
mtmsrd r7,1

/* Unfortunately, the stack pointer and the MSR are also clobbered,
* so they are saved in the PACA which allows us to restore
Expand Down

0 comments on commit c5a65e0

Please sign in to comment.