[PATCH] powerpc: Ignore DSI error caused by the copy/paste instruction

Christophe Leroy christophe.leroy at csgroup.eu
Thu Sep 22 19:04:57 AEST 2022



Le 22/09/2022 à 10:29, Haren Myneni a écrit :
> 
> DSI error will be generated when the paste operation is issued on
> the suspended NX window due to NX state changes. The hypervisor
> expects the partition to ignore this error during page pault
> handling. To differentiate DSI caused by an actual HW configuration
> or by the NX window, a new “ibm,pi-features” type value is defined.
> Byte 0, bit 3 of pi-attribute-specifier-type is now defined to
> indicate this DSI error.

What is NX ? No eXec ? That's what it is usually. But in that case it 
would be the ISI, not DSI.

> 
> This patch adds changes to read ibm,pi-features property and ignore
> DSI error in the page fault handling if CPU_FTR_NX_DSI if defined.
> 
> Signed-off-by: Haren Myneni <haren at linux.ibm.com>
> ---
>   arch/powerpc/include/asm/cputable.h |  5 ++--
>   arch/powerpc/kernel/prom.c          | 36 +++++++++++++++++++++--------
>   arch/powerpc/mm/fault.c             | 17 +++++++++++++-
>   3 files changed, 45 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
> index 014005428687..154cc1e85770 100644
> --- a/arch/powerpc/mm/fault.c
> +++ b/arch/powerpc/mm/fault.c
> @@ -367,7 +367,22 @@ static void sanity_check_fault(bool is_write, bool is_user,
>   #elif defined(CONFIG_PPC_8xx)
>   #define page_fault_is_bad(__err)	((__err) & DSISR_NOEXEC_OR_G)
>   #elif defined(CONFIG_PPC64)
> -#define page_fault_is_bad(__err)	((__err) & DSISR_BAD_FAULT_64S)
> +static inline int page_fault_is_bad(unsigned long __err)

The name was __err because it was a macro and there was a risk of 
collision with a 'err' variable in the caller.

But as it is now a function, you can just call it 'err'.

And no need of the 'inline' keyword, GCC will inline it anyway.

> +{
> +	unsigned long flag = DSISR_BAD_FAULT_64S;
> +
> +	/*
> +	 * PAPR 14.15.3.4.1
> +	 * If byte 0, bit 3 of pi-attribute-specifier-type in
> +	 * ibm,pi-features property is defined, ignore the DSI error
> +	 * which is caused by the paste instruction on the
> +	 * suspended NX window.
> +	 */
> +	if (cpu_has_feature(CPU_FTR_NX_DSI))
> +		flag &= ~DSISR_BAD_COPYPASTE;
> +
> +	return ((__err) & flag);

The () around __err was because it was a macro parameter. It is 
pointless now. And same for the overall ones. Now it can be :

	return err & flags;

> +}
>   #else
>   #define page_fault_is_bad(__err)	((__err) & DSISR_BAD_FAULT_32S)
>   #endif


More information about the Linuxppc-dev mailing list