[PATCH RFC rebase 9/9] powerpc/64: barrier_nospec: Add commandline trigger

Diana Madalina Craciun diana.craciun at nxp.com
Sat Mar 24 02:59:50 AEDT 2018


On 3/15/2018 9:34 PM, Michal Suchanek wrote:
> Add commandline options spectre_v2 and nospectre_v2
>
> These are named same as similar x86 options regardless of actual effect
> to not require platform-specific configuration.
>
> Supported options:
> nospectre_v2 or spectre_v2=off - speculation barrier not used
> spectre_v2=on or spectre_v2=auto - speculation barrier used

Why the barrier is enabled only for spectre variant 2 mitigations? It
can be used as well for variant 1 mitigations. In fact I am not sure
that the places where it is used fall under spectre 2 at all.

>
> Changing the settings after boot is not supported and VM migration may
> change requirements so auto is same as on.
>
> Based on s390 implementation
>
> Signed-off-by: Michal Suchanek <msuchanek at suse.de>
> ---
>  arch/powerpc/kernel/setup_64.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>
> diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
> index f6678a7b6114..c74e656265df 100644
> --- a/arch/powerpc/kernel/setup_64.c
> +++ b/arch/powerpc/kernel/setup_64.c
> @@ -840,6 +840,28 @@ static int __init handle_no_pti(char *p)
>  }
>  early_param("nopti", handle_no_pti);
>  
> +static int __init nospectre_v2_setup_early(char *str)
> +{
> +	no_nospec = true;
> +	return 0;
> +}
> +early_param("nospectre_v2", nospectre_v2_setup_early);
> +
> +static int __init spectre_v2_setup_early(char *str)
> +{
> +	if (str && !strncmp(str, "on", 2))
> +		no_nospec = false;
> +
> +	if (str && !strncmp(str, "off", 3))
> +		no_nospec = true;
> +
> +	if (str && !strncmp(str, "auto", 4))
> +		no_nospec = false;
> +
> +	return 0;
> +}
> +early_param("spectre_v2", spectre_v2_setup_early);
> +
>  static void do_nothing(void *unused)
>  {
>  	/*

Thanks,

Diana



More information about the Linuxppc-dev mailing list