lkml.org 
[lkml]   [2024]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2024-05-27 15:58    [W:0.314 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site