From: Ingo Molnar <mingo@kernel.org>
To: Borislav Petkov <bp@alien8.de>
Cc: X86 ML <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
"Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>
Subject: Re: [PATCH 2/2] x86/CPU/AMD: Improve the erratum 1386 workaround
Date: Thu, 21 Mar 2024 20:26:42 +0100 [thread overview]
Message-ID: <ZfyJ8sObTIvwm17B@gmail.com> (raw)
In-Reply-To: <20240321120548.22687-2-bp@alien8.de>
* 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
next prev parent reply other threads:[~2024-03-21 19:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-21 12:05 [PATCH 1/2] x86/microcode/AMD: Add a patch revision number union Borislav Petkov
2024-03-21 12:05 ` [PATCH 2/2] x86/CPU/AMD: Improve the erratum 1386 workaround Borislav Petkov
2024-03-21 15:21 ` Maciej S. Szmigiero
2024-03-24 20:05 ` [PATCH -v2] " Borislav Petkov
2024-03-25 12:45 ` Maciej S. Szmigiero
2024-03-25 13:01 ` Borislav Petkov
2024-03-25 13:23 ` [tip: x86/cpu] " tip-bot2 for Borislav Petkov (AMD)
2024-03-21 19:26 ` Ingo Molnar [this message]
2024-03-21 19:24 ` [PATCH 1/2] x86/microcode/AMD: Add a patch revision number union Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZfyJ8sObTIvwm17B@gmail.com \
--to=mingo@kernel.org \
--cc=boris.ostrovsky@oracle.com \
--cc=bp@alien8.de \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.szmigiero@oracle.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox