[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<LV3PR12MB926504F7792CC53B00F15BFA94812@LV3PR12MB9265.namprd12.prod.outlook.com>
Date: Mon, 28 Apr 2025 13:42:08 +0000
From: "Kaplan, David" <David.Kaplan@....com>
To: Borislav Petkov <bp@...en8.de>
CC: Thomas Gleixner <tglx@...utronix.de>, Peter Zijlstra
<peterz@...radead.org>, Josh Poimboeuf <jpoimboe@...nel.org>, Pawan Gupta
<pawan.kumar.gupta@...ux.intel.com>, Ingo Molnar <mingo@...hat.com>, Dave
Hansen <dave.hansen@...ux.intel.com>, "x86@...nel.org" <x86@...nel.org>, "H .
Peter Anvin" <hpa@...or.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH v5 04/16] x86/bugs: Restructure RFDS mitigation
[AMD Official Use Only - AMD Internal Distribution Only]
> -----Original Message-----
> From: Borislav Petkov <bp@...en8.de>
> Sent: Sunday, April 27, 2025 10:09 AM
> To: Kaplan, David <David.Kaplan@....com>
> Cc: Thomas Gleixner <tglx@...utronix.de>; Peter Zijlstra <peterz@...radead.org>;
> Josh Poimboeuf <jpoimboe@...nel.org>; Pawan Gupta
> <pawan.kumar.gupta@...ux.intel.com>; Ingo Molnar <mingo@...hat.com>; Dave
> Hansen <dave.hansen@...ux.intel.com>; x86@...nel.org; H . Peter Anvin
> <hpa@...or.com>; linux-kernel@...r.kernel.org
> Subject: Re: [PATCH v5 04/16] x86/bugs: Restructure RFDS mitigation
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Fri, Apr 18, 2025 at 11:17:09AM -0500, David Kaplan wrote:
> > +static bool __init rfds_has_ucode(void) {
> > + return (x86_arch_cap_msr & ARCH_CAP_RFDS_CLEAR); }
>
> Might as well call it what the bit means and then the code reads a bit better:
>
> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index
> e668ccccd8c7..2705105d9a5e 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -630,7 +630,7 @@ static const char * const rfds_strings[] = {
> [RFDS_MITIGATION_UCODE_NEEDED] = "Vulnerable: No microcode",
> };
>
> -static bool __init rfds_has_ucode(void)
> +static inline bool __init verw_clears_cpu_reg_file(void)
> {
> return (x86_arch_cap_msr & ARCH_CAP_RFDS_CLEAR); } @@ -648,7
> +648,7 @@ static void __init rfds_select_mitigation(void)
> if (rfds_mitigation == RFDS_MITIGATION_OFF)
> return;
>
> - if (rfds_has_ucode())
> + if (verw_clears_cpu_reg_file())
> verw_clear_cpu_buf_mitigation_selected = true; }
>
> @@ -661,7 +661,7 @@ static void __init rfds_update_mitigation(void)
> rfds_mitigation = RFDS_MITIGATION_VERW;
>
> if (rfds_mitigation == RFDS_MITIGATION_VERW) {
> - if (!rfds_has_ucode())
> + if (!verw_clears_cpu_reg_file())
> rfds_mitigation = RFDS_MITIGATION_UCODE_NEEDED;
> }
>
>
Makes sense to me, thanks.
--David Kaplan
Powered by blists - more mailing lists