[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=U6t42VNFSY3Jk1XUk+O=B8VnhioQxOHMv86ZH0BqLJQQ@mail.gmail.com>
Date: Mon, 6 Jan 2025 14:32:52 -0800
From: Doug Anderson <dianders@...omium.org>
To: Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>,
Mark Rutland <mark.rutland@....com>
Cc: Roxana Bradescu <roxabee@...gle.com>, Julius Werner <jwerner@...omium.org>,
bjorn.andersson@....qualcomm.com, linux-arm-kernel@...ts.infradead.org,
linux-arm-msm@...r.kernel.org, Jeffrey Hugo <quic_jhugo@...cinc.com>,
Trilok Soni <quic_tsoni@...cinc.com>, stable@...r.kernel.org,
James Morse <james.morse@....com>, Kent Overstreet <kent.overstreet@...ux.dev>,
Suren Baghdasaryan <surenb@...gle.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/3] arm64: errata: Assume that unknown CPUs _are_
vulnerable to Spectre BHB
Hi,
On Thu, Dec 19, 2024 at 12:54 PM Douglas Anderson <dianders@...omium.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
Powered by blists - more mailing lists