linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Donnellan <ajd@linux.ibm.com>
To: "Christopher M. Riedl" <cmr@informatik.wtf>, linuxppc-dev@ozlabs.org
Subject: Re: [PATCH v5] powerpc/64s: support nospectre_v2 cmdline option
Date: Wed, 5 Jun 2019 17:42:03 +1000	[thread overview]
Message-ID: <98c47360-c89c-5f4d-1c32-f6ac0ddd7f1e@linux.ibm.com> (raw)
In-Reply-To: <20190524024647.381-1-cmr@informatik.wtf>

On 24/5/19 12:46 pm, Christopher M. Riedl wrote:
> Add support for disabling the kernel implemented spectre v2 mitigation
> (count cache flush on context switch) via the nospectre_v2 and
> mitigations=off cmdline options.
> 
> Suggested-by: Michael Ellerman <mpe@ellerman.id.au>
> Signed-off-by: Christopher M. Riedl <cmr@informatik.wtf>
> Reviewed-by: Andrew Donnellan <ajd@linux.ibm.com>

snowpatch is whinging about this breaking the build for some reason... 
https://patchwork.ozlabs.org/patch/1104583/


> ---
> v4->v5:
> 	Fix checkpatch complaint
>   arch/powerpc/kernel/security.c | 19 ++++++++++++++++---
>   1 file changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c
> index e1c9cf079503..7cfcb294b11c 100644
> --- a/arch/powerpc/kernel/security.c
> +++ b/arch/powerpc/kernel/security.c
> @@ -28,7 +28,7 @@ static enum count_cache_flush_type count_cache_flush_type = COUNT_CACHE_FLUSH_NO
>   bool barrier_nospec_enabled;
>   static bool no_nospec;
>   static bool btb_flush_enabled;
> -#ifdef CONFIG_PPC_FSL_BOOK3E
> +#if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_BOOK3S_64)
>   static bool no_spectrev2;
>   #endif
>   
> @@ -114,7 +114,7 @@ static __init int security_feature_debugfs_init(void)
>   device_initcall(security_feature_debugfs_init);
>   #endif /* CONFIG_DEBUG_FS */
>   
> -#ifdef CONFIG_PPC_FSL_BOOK3E
> +#if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_BOOK3S_64)
>   static int __init handle_nospectre_v2(char *p)
>   {
>   	no_spectrev2 = true;
> @@ -122,6 +122,9 @@ static int __init handle_nospectre_v2(char *p)
>   	return 0;
>   }
>   early_param("nospectre_v2", handle_nospectre_v2);
> +#endif /* CONFIG_PPC_FSL_BOOK3E || CONFIG_PPC_BOOK3S_64 */
> +
> +#ifdef CONFIG_PPC_FSL_BOOK3E
>   void setup_spectre_v2(void)
>   {
>   	if (no_spectrev2 || cpu_mitigations_off())
> @@ -399,7 +402,17 @@ static void toggle_count_cache_flush(bool enable)
>   
>   void setup_count_cache_flush(void)
>   {
> -	toggle_count_cache_flush(true);
> +	bool enable = true;
> +
> +	if (no_spectrev2 || cpu_mitigations_off()) {
> +		if (security_ftr_enabled(SEC_FTR_BCCTRL_SERIALISED) ||
> +		    security_ftr_enabled(SEC_FTR_COUNT_CACHE_DISABLED))
> +			pr_warn("Spectre v2 mitigations not under software control, can't disable\n");
> +
> +		enable = false;
> +	}
> +
> +	toggle_count_cache_flush(enable);
>   }
>   
>   #ifdef CONFIG_DEBUG_FS
> 

-- 
Andrew Donnellan              OzLabs, ADL Canberra
ajd@linux.ibm.com             IBM Australia Limited


  reply	other threads:[~2019-06-05  7:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-24  2:46 [PATCH v5] powerpc/64s: support nospectre_v2 cmdline option Christopher M. Riedl
2019-06-05  7:42 ` Andrew Donnellan [this message]
2019-07-09  8:08   ` Andrew Donnellan
2019-08-28  4:24 ` 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=98c47360-c89c-5f4d-1c32-f6ac0ddd7f1e@linux.ibm.com \
    --to=ajd@linux.ibm.com \
    --cc=cmr@informatik.wtf \
    --cc=linuxppc-dev@ozlabs.org \
    /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).