LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Haren Myneni <haren@linux.ibm.com>,
	"mpe@ellerman.id.au" <mpe@ellerman.id.au>,
	"npiggin@gmail.com" <npiggin@gmail.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [PATCH v2] powerpc: Ignore DSI error caused by the copy/paste instruction
Date: Mon, 26 Sep 2022 05:55:57 +0000	[thread overview]
Message-ID: <fcc2792d-ece1-d01a-7591-c487dd4d7e1c@csgroup.eu> (raw)
In-Reply-To: <12b8c238593b835837dbb8ce664c50dcaf9ecb3d.camel@linux.ibm.com>



Le 25/09/2022 à 22:26, 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. If this error is not ignored, the user
> space can get SIGBUS when the NX request is issued.

Would be nice to mention at least one time in the message that NX stands 
to nest accelerator.

Otherwise, that's confusing with for exemple:
Commit 2e602847d9c2 ("KVM: PPC: Don't flush PTEs on NX/RO hit")
Commit c49643319715 ("powerpc/32s: Only leave NX unset on segments used 
for modules")


> 
> 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@linux.ibm.com>
> ---
> v2: Code cleanup as suggested by Christophe Leroy
> 
>   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..cb949f12baa9 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 int page_fault_is_bad(unsigned long err)
> +{
> +	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);

You don't need parenthesis ( )

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

  reply	other threads:[~2022-09-26  5:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-25 20:26 [PATCH v2] powerpc: Ignore DSI error caused by the copy/paste instruction Haren Myneni
2022-09-26  5:55 ` Christophe Leroy [this message]
2022-09-26 21:57   ` Haren Myneni
2022-09-26 13:28 ` Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fcc2792d-ece1-d01a-7591-c487dd4d7e1c@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=haren@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox