[PATCH v2] powerpc/64s: support nospectre_v2 cmdline option
Michael Ellerman
mpe at ellerman.id.au
Tue May 7 19:54:55 AEST 2019
"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:
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