Commit 2e4a1616 authored by Michael Ellerman's avatar Michael Ellerman

powerpc/pseries: Use the security flags in pseries_setup_rfi_flush()

Now that we have the security flags we can simplify the code in
pseries_setup_rfi_flush() because the security flags have pessimistic
defaults.
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 37c0bdd0
...@@ -501,30 +501,27 @@ void pseries_setup_rfi_flush(void) ...@@ -501,30 +501,27 @@ void pseries_setup_rfi_flush(void)
bool enable; bool enable;
long rc; long rc;
/* Enable by default */
enable = true;
types = L1D_FLUSH_FALLBACK;
rc = plpar_get_cpu_characteristics(&result); rc = plpar_get_cpu_characteristics(&result);
if (rc == H_SUCCESS) { if (rc == H_SUCCESS)
init_cpu_char_feature_flags(&result); init_cpu_char_feature_flags(&result);
if (result.character & H_CPU_CHAR_L1D_FLUSH_TRIG2)
types |= L1D_FLUSH_MTTRIG;
if (result.character & H_CPU_CHAR_L1D_FLUSH_ORI30)
types |= L1D_FLUSH_ORI;
if ((!(result.behaviour & H_CPU_BEHAV_L1D_FLUSH_PR)) ||
(!(result.behaviour & H_CPU_BEHAV_FAVOUR_SECURITY)))
enable = false;
}
/* /*
* We're the guest so this doesn't apply to us, clear it to simplify * We're the guest so this doesn't apply to us, clear it to simplify
* handling of it elsewhere. * handling of it elsewhere.
*/ */
security_ftr_clear(SEC_FTR_L1D_FLUSH_HV); security_ftr_clear(SEC_FTR_L1D_FLUSH_HV);
types = L1D_FLUSH_FALLBACK;
if (security_ftr_enabled(SEC_FTR_L1D_FLUSH_TRIG2))
types |= L1D_FLUSH_MTTRIG;
if (security_ftr_enabled(SEC_FTR_L1D_FLUSH_ORI30))
types |= L1D_FLUSH_ORI;
enable = security_ftr_enabled(SEC_FTR_FAVOUR_SECURITY) && \
security_ftr_enabled(SEC_FTR_L1D_FLUSH_PR);
setup_rfi_flush(types, enable); setup_rfi_flush(types, enable);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment