Re: [PATCH RFC rebase 9/9] powerpc/64: barrier_nospec: Add commandline trigger
From: Diana Madalina Craciun <hidden>
Date: 2018-03-23 15:59:50
Also in:
lkml
On 3/15/2018 9:34 PM, Michal Suchanek wrote:=0A=
Add commandline options spectre_v2 and nospectre_v2=0A= =0A= These are named same as similar x86 options regardless of actual effect=
=0A=
to not require platform-specific configuration.=0A= =0A= Supported options:=0A= nospectre_v2 or spectre_v2=3Doff - speculation barrier not used=0A= spectre_v2=3Don or spectre_v2=3Dauto - speculation barrier used=0A=
=0A= Why the barrier is enabled only for spectre variant 2 mitigations? It=0A= can be used as well for variant 1 mitigations. In fact I am not sure=0A= that the places where it is used fall under spectre 2 at all.=0A= =0A=
quoted hunk ↗ jump to hunk
=0A= Changing the settings after boot is not supported and VM migration may=0A= change requirements so auto is same as on.=0A= =0A= Based on s390 implementation=0A= =0A= Signed-off-by: Michal Suchanek <redacted>=0A= ---=0A= arch/powerpc/kernel/setup_64.c | 22 ++++++++++++++++++++++=0A= 1 file changed, 22 insertions(+)=0A= =0A=diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_6=
4.c=0A=
quoted hunk ↗ jump to hunk
index f6678a7b6114..c74e656265df 100644=0A=--- a/arch/powerpc/kernel/setup_64.c=0A= +++ b/arch/powerpc/kernel/setup_64.c=0A=@@ -840,6 +840,28 @@ static int __init handle_no_pti(char *p)=0A= }=0A= early_param("nopti", handle_no_pti);=0A= =0A= +static int __init nospectre_v2_setup_early(char *str)=0A= +{=0A= + no_nospec =3D true;=0A= + return 0;=0A= +}=0A= +early_param("nospectre_v2", nospectre_v2_setup_early);=0A= +=0A= +static int __init spectre_v2_setup_early(char *str)=0A= +{=0A= + if (str && !strncmp(str, "on", 2))=0A= + no_nospec =3D false;=0A= +=0A= + if (str && !strncmp(str, "off", 3))=0A= + no_nospec =3D true;=0A= +=0A= + if (str && !strncmp(str, "auto", 4))=0A= + no_nospec =3D false;=0A= +=0A= + return 0;=0A= +}=0A= +early_param("spectre_v2", spectre_v2_setup_early);=0A= +=0A= static void do_nothing(void *unused)=0A= {=0A= /*=0A=
=0A= Thanks,=0A= =0A= Diana=0A= =0A=