[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZfyJ8sObTIvwm17B@gmail.com>
Date: Thu, 21 Mar 2024 20:26:42 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Borislav Petkov <bp@...en8.de>
Cc: X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
"Maciej S. Szmigiero" <maciej.szmigiero@...cle.com>
Subject: Re: [PATCH 2/2] x86/CPU/AMD: Improve the erratum 1386 workaround
* Borislav Petkov <bp@...en8.de> wrote:
> From: "Borislav Petkov (AMD)" <bp@...en8.de>
>
> Disable XSAVES only on machines which haven't loaded the microcode
> revision containing the erratum fix.
>
> This will come in handy when running archaic OSes as guests. OSes whose
> brilliant programmers thought that CPUID is overrated and one should not
> query it but use features directly, ala shoot first, ask questions
> later... but only if you're alive after the shooting.
>
> Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
> Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com>
> Cc: "Maciej S. Szmigiero" <maciej.szmigiero@...cle.com>
> ---
> arch/x86/kernel/cpu/amd.c | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
>
> diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
> index 6d8677e80ddb..c02b07feff6e 100644
> --- a/arch/x86/kernel/cpu/amd.c
> +++ b/arch/x86/kernel/cpu/amd.c
> @@ -15,6 +15,7 @@
> #include <asm/cpu.h>
> #include <asm/spec-ctrl.h>
> #include <asm/smp.h>
> +#include <asm/microcode.h>
> #include <asm/numa.h>
> #include <asm/pci-direct.h>
> #include <asm/delay.h>
> @@ -804,6 +805,16 @@ static void init_amd_bd(struct cpuinfo_x86 *c)
>
> static void fix_erratum_1386(struct cpuinfo_x86 *c)
> {
> + u8 fam, model, stpng, rev;
> + union zen_patch_rev p;
> +
> + p.ucode_rev = c->microcode;
> +
> + fam = p.ext_fam + 0xf;
> + model = p.ext_model << 4 | p.model;
> + stpng = p.stepping;
Please make this 'stepping' - we don't have a single 'stpng' variable name
in the kernel currently, and that's very good so.
Thanks,
Ingo
Powered by blists - more mailing lists