On 08/03/2022, 14:50:46, Nicholas Piggin wrote:
> rtas_call must not be called with the MMU disabled because in case
> of rtas error, log_error is called which requires MMU enabled. Add
> a test and warning for this.
> 
> Signed-off-by: Nicholas Piggin <npig...@gmail.com>

Reviewed-by: Laurent Dufour <lduf...@linux.ibm.com>

> ---
>  arch/powerpc/kernel/rtas.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
> index 1fc22138e3ab..adf4892aeecd 100644
> --- a/arch/powerpc/kernel/rtas.c
> +++ b/arch/powerpc/kernel/rtas.c
> @@ -479,6 +479,11 @@ int rtas_call(int token, int nargs, int nret, int 
> *outputs, ...)
>       if (!rtas.entry || token == RTAS_UNKNOWN_SERVICE)
>               return -1;
>  
> +     if ((mfmsr() & (MSR_IR|MSR_DR)) != (MSR_IR|MSR_DR)) {
> +             WARN_ON_ONCE(1);
> +             return -1;
> +     }
> +
>       s = lock_rtas();
>  
>       /* We use the global rtas args buffer */

Reply via email to