Hi,
On Thu, Dec 19, 2024 at 12:54 PM Douglas Anderson dianders@chromium.org wrote:
@@ -916,9 +932,8 @@ static enum mitigation_state spectre_bhb_get_cpu_fw_mitigation_state(void) } }
-static bool is_spectre_bhb_fw_affected(int scope) +static bool is_spectre_bhb_fw_affected(void) {
static bool system_affected; enum mitigation_state fw_state; bool has_smccc = arm_smccc_1_1_get_conduit() != SMCCC_CONDUIT_NONE; static const struct midr_range spectre_bhb_firmware_mitigated_list[] = {
@@ -929,16 +944,8 @@ static bool is_spectre_bhb_fw_affected(int scope) bool cpu_in_list = is_midr_in_range_list(read_cpuid_id(), spectre_bhb_firmware_mitigated_list);
if (scope != SCOPE_LOCAL_CPU)
return system_affected;
fw_state = spectre_bhb_get_cpu_fw_mitigation_state();
if (cpu_in_list || (has_smccc && fw_state == SPECTRE_MITIGATED)) {
system_affected = true;
return true;
}
return false;
return cpu_in_list || (has_smccc && fw_state == SPECTRE_MITIGATED);
Upon looking at this again, I realized that I can fully get rid of `cpu_in_list` here and the whole `spectre_bhb_firmware_mitigated_list` variable. After my patch there's only one caller to this function and it only cares whether the firmware call can be used to mitigate, so I can rename this function to has_spectre_bhb_fw_mitigation() and simplify it and the caller.
I'll plan to spin this in the next day or two and also include the proper loop value for Kryo-400 cores, since I've got that now.
I'll plan to keep Julius's review tag unless told not to.
-Doug