linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: linuxppc-dev@lists.ozlabs.org, Shawn Anastasio <shawn@anastas.io>
Subject: Re: [PATCH 2/2] powerpc/64s: Disallow PROT_SAO in LPARs by default
Date: Fri, 21 Aug 2020 20:37:14 +1000	[thread overview]
Message-ID: <1598006106.5gm5wgd52s.astroid@bobo.none> (raw)
In-Reply-To: <20200821010837.4079-3-shawn@anastas.io>

Excerpts from Shawn Anastasio's message of August 21, 2020 11:08 am:
> Since migration of guests using SAO to ISA 3.1 hosts may cause issues,
> disable PROT_SAO in LPARs by default and introduce a new Kconfig option
> PPC_PROT_SAO_LPAR to allow users to enable it if desired.

I think this should be okay. Could you also update the selftest to skip
if we have PPC_FEATURE2_ARCH_3_1 set?

Thanks,
Nick

Acked-by: Nicholas Piggin <npiggin@gmail.com>

> 
> Signed-off-by: Shawn Anastasio <shawn@anastas.io>
> ---
>  arch/powerpc/Kconfig            | 12 ++++++++++++
>  arch/powerpc/include/asm/mman.h |  9 +++++++--
>  2 files changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 1f48bbfb3ce9..65bed1fdeaad 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -860,6 +860,18 @@ config PPC_SUBPAGE_PROT
>  
>  	  If unsure, say N here.
>  
> +config PPC_PROT_SAO_LPAR
> +	bool "Support PROT_SAO mappings in LPARs"
> +	depends on PPC_BOOK3S_64
> +	help
> +	  This option adds support for PROT_SAO mappings from userspace
> +	  inside LPARs on supported CPUs.
> +
> +	  This may cause issues when performing guest migration from
> +	  a CPU that supports SAO to one that does not.
> +
> +	  If unsure, say N here.
> +
>  config PPC_COPRO_BASE
>  	bool
>  
> diff --git a/arch/powerpc/include/asm/mman.h b/arch/powerpc/include/asm/mman.h
> index 4ba303ea27f5..7cb6d18f5cd6 100644
> --- a/arch/powerpc/include/asm/mman.h
> +++ b/arch/powerpc/include/asm/mman.h
> @@ -40,8 +40,13 @@ static inline bool arch_validate_prot(unsigned long prot, unsigned long addr)
>  {
>  	if (prot & ~(PROT_READ | PROT_WRITE | PROT_EXEC | PROT_SEM | PROT_SAO))
>  		return false;
> -	if ((prot & PROT_SAO) && !cpu_has_feature(CPU_FTR_SAO))
> -		return false;
> +	if (prot & PROT_SAO) {
> +		if (!cpu_has_feature(CPU_FTR_SAO))
> +			return false;
> +		if (firmware_has_feature(FW_FEATURE_LPAR) &&
> +		    !IS_ENABLED(CONFIG_PPC_PROT_SAO_LPAR))
> +			return false;
> +	}
>  	return true;
>  }
>  #define arch_validate_prot arch_validate_prot
> -- 
> 2.28.0
> 
> 

  reply	other threads:[~2020-08-21 10:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21  1:08 [PATCH 0/2] Reintroduce PROT_SAO Shawn Anastasio
2020-08-21  1:08 ` [PATCH 1/2] Revert "powerpc/64s: Remove PROT_SAO support" Shawn Anastasio
2020-08-21  1:08 ` [PATCH 2/2] powerpc/64s: Disallow PROT_SAO in LPARs by default Shawn Anastasio
2020-08-21 10:37   ` Nicholas Piggin [this message]
2020-08-21 18:55     ` Shawn Anastasio

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=1598006106.5gm5wgd52s.astroid@bobo.none \
    --to=npiggin@gmail.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=shawn@anastas.io \
    /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;
as well as URLs for NNTP newsgroup(s).