[PATCH v2] powerpc/64s: support nospectre_v2 cmdline option

Christopher M Riedl cmr at informatik.wtf
Tue May 7 21:54:10 AEST 2019


> On May 7, 2019 at 5:54 AM Michael Ellerman <mpe at ellerman.id.au> wrote:
> 
> 
> "Christopher M. Riedl" <cmr at informatik.wtf> writes:
> > diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c
> > index b33bafb8fcea..d775da9b9227 100644
> > --- a/arch/powerpc/kernel/security.c
> > +++ b/arch/powerpc/kernel/security.c
> > @@ -391,6 +394,15 @@ static void toggle_count_cache_flush(bool enable)
> >  
> >  void setup_count_cache_flush(void)
> >  {
> > +	if (no_spectrev2) {
> > +		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");
> > +
> > +		toggle_count_cache_flush(false);
> > +		return;
> > +	}
> > +
> >  	toggle_count_cache_flush(true);
> >  }
> 
> I'm nit-picking, but would it be better as:
>
Agreed, v3 is on the way :)
> 
> void setup_count_cache_flush(void)
> {
> 	bool enable = true;
> 
> 	if (no_spectrev2) {
> 		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);
> }
> 
> ???
> 
> cheers


More information about the Linuxppc-dev mailing list