[PATCH 09/14] powerpc/rtas: Leave MSR[RI] enabled over RTAS call
Laurent Dufour
ldufour at linux.ibm.com
Tue Mar 15 04:17:28 AEDT 2022
On 08/03/2022, 14:50:42, Nicholas Piggin wrote:
> PAPR specifies that RTAS may be called with MSR[RI] enabled if the
> calling context is recoverable, and RTAS will manage RI as necessary.
> Call the rtas entry point with RI enabled, and add a check to ensure
> the caller has RI enabled.
>
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
> ---
> arch/powerpc/kernel/rtas.c | 1 +
> arch/powerpc/kernel/rtas_entry.S | 13 +++----------
> 2 files changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
> index 87ede1877816..fece066115f0 100644
> --- a/arch/powerpc/kernel/rtas.c
> +++ b/arch/powerpc/kernel/rtas.c
> @@ -57,6 +57,7 @@ static noinline void do_enter_rtas(unsigned long args)
> hard_irq_disable();
>
> msr = mfmsr();
> + BUG_ON(!(msr & MSR_RI));
> mtmsr(msr & ~(MSR_IR|MSR_DR));
> enter_rtas(args);
> mtmsr(msr);
> diff --git a/arch/powerpc/kernel/rtas_entry.S b/arch/powerpc/kernel/rtas_entry.S
> index 292551684bbd..72b27b14ccc9 100644
> --- a/arch/powerpc/kernel/rtas_entry.S
> +++ b/arch/powerpc/kernel/rtas_entry.S
> @@ -95,7 +95,7 @@ _GLOBAL(enter_rtas)
> clrldi r4,r4,2 /* convert to realmode address */
> mtlr r4
>
> - LOAD_REG_IMMEDIATE(r6, MSR_ME)
> + LOAD_REG_IMMEDIATE(r6, MSR_ME|MSR_RI)
>
> LOAD_REG_ADDR(r4, rtas)
> ld r5,RTASENTRY(r4) /* get the rtas->entry value */
> @@ -113,15 +113,8 @@ _ASM_NOKPROBE_SYMBOL(enter_rtas)
> rtas_return_loc:
> FIXUP_ENDIAN
>
> - /*
> - * Clear RI and set SF before anything.
> - */
> - mfmsr r6
> - li r0,MSR_RI
> - andc r6,r6,r0
> - sldi r0,r0,(MSR_SF_LG - MSR_RI_LG)
> - or r6,r6,r0
> - sync
> + /* Set SF before anything. */
> + LOAD_REG_IMMEDIATE(r6, MSR_KERNEL & ~(MSR_IR|MSR_DR))
I guess we cannot directly load a MSR value stored in the PACA at that
time, isn't it?
> mtmsrd r6
>
> GET_PACA(r13)
More information about the Linuxppc-dev
mailing list