Messages in this thread | | | Date | Thu, 21 Mar 2024 20:26:42 +0100 | From | Ingo Molnar <> | Subject | Re: [PATCH 2/2] x86/CPU/AMD: Improve the erratum 1386 workaround |
| |
* Borislav Petkov <bp@alien8.de> wrote:
> From: "Borislav Petkov (AMD)" <bp@alien8.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@alien8.de> > Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> > Cc: "Maciej S. Szmigiero" <maciej.szmigiero@oracle.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
| |