mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kim Phillips <kim.phillips@amd.com>
To: Borislav Petkov <bp@alien8.de>
Cc: <linux-kernel@vger.kernel.org>, <x86@kernel.org>,
	<linux-coco@lists.linux.dev>, <kvm@vger.kernel.org>,
	Sean Christopherson <seanjc@google.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	K Prateek Nayak <kprateek.nayak@amd.com>,
	Nikunj A Dadhania <nikunj@amd.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	Michael Roth <michael.roth@amd.com>,
	Naveen Rao <naveen.rao@amd.com>,
	David Kaplan <david.kaplan@amd.com>,
	Pawan Gupta <pawan.kumar.gupta@linux.intel.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Nathan Fontenot <nathan.fontenot@amd.com>
Subject: Re: [PATCH v5 2/8] x86/bugs: Allow spectre_v2=ibrs on x86 vendors other than Intel
Date: Fri, 18 Sep 2026 18:01:55 -0500	[thread overview]
Message-ID: <9b85be41-db5a-4bdb-95b4-beffb05a5ffc@amd.com> (raw)
In-Reply-To: <20260909210101.GBaqHJDWSUnpjqNcyB@fat_crate.local>

On 9/9/26 4:01 PM, Borislav Petkov wrote:
> On Wed, Aug 26, 2026 at 05:35:04PM -0500, Kim Phillips wrote:
>> Prepare for legacy IBRS toggling on AMD, where the BTB Isolation
> Same question as before: why?
>
> This commit message is explaining what the patch does. It needs to explain
> the why.
>
ok how about this as the new commit text?:

SPEC_CTRL.IBRS is architectural and behaves on AMD just like it does on
Intel, but the kernel offers spectre_v2=ibrs on Intel only: the option is
rejected at parse time on other vendors, and MITIGATION_IBRS_ENTRY cannot
even be built into an AMD-only kernel.

AMD's SNP BTB Isolation needs the kernel to toggle legacy IBRS in order to
optimize the VM exit-to-re-entry path, and right now there is no way to ask
for kernel IBRS on an AMD machine at all.

It happens for historical reasons only.  Commit 7c693f54c873
("x86/speculation: Add spectre_v2=ibrs option to support Kernel IBRS")
gated the option on Intel because Intel was the only vendor that needed it
back then - there, kernel IBRS doubles as a RETBleed mitigation. Nothing
in the IBRS_ENTER/IBRS_EXIT mechanism itself is vendor-specific.

Fix it by dropping the vendor check from the command line parsing and
CPU_SUP_INTEL from MITIGATION_IBRS_ENTRY's depends line.

Keep the IBRS-trumps-retbleed logic in retbleed_update_mitigation()
Intel-only, though: legacy SPEC_CTRL.IBRS does not cover AMD's Branch Type
Confusion RETBleed variant because RET prediction comes from the Return
Address Predictor rather than from the indirect branch predictors IBRS
restricts.  Letting SPECTRE_V2_IBRS trump retbleed on AMD would silently
drop the UNRET/IBPB mitigation that does cover it.  RETBleed selection on
AMD never consults spectre_v2=, so spectre_v2=ibrs neither adds nor removes
RETBleed coverage there and the retbleed sysfs node keeps reporting the
truth on its own.

Two more things need handling once the option becomes reachable on AMD:

AutoIBRS-capable CPUs would take the EFER.AUTOIBRS path for any IBRS mode,
handing spectre_v2=ibrs the always-on AutoIBRS behaviour instead of the
toggleable SPEC_CTRL.IBRS the option asks for.  Restrict that path to the
eIBRS modes.

And EFER.AUTOIBRS survives kexec because head_64.S preserves the incoming
EFER bits, so a kernel that ran in AutoIBRS mode leaves the next one in
AutoIBRS mode while its sysfs reports "Mitigation: IBRS" or a retpoline
mode.  Clear the bit at the top of cpu_select_mitigations() next to the
existing SPEC_CTRL kexec cleanup - a cold boot has it clear already, and
that spot precedes the init_real_mode() EFER snapshot the AP trampoline
uses.

Thanks,

Kim

  reply	other threads:[~2026-09-18 23:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 22:35 [PATCH v5 0/8] Add SEV-SNP BTB Isolation and IBPB-on-Entry guest features Kim Phillips
2026-08-26 22:35 ` [PATCH v5 1/8] x86/bugs: Allow forcing Automatic IBRS with SNP active using spectre_v2=eibrs Kim Phillips
2026-08-27  4:32   ` Pawan Gupta
2026-09-03  4:03   ` Borislav Petkov
2026-09-18 23:00     ` Kim Phillips
2026-08-26 22:35 ` [PATCH v5 2/8] x86/bugs: Allow spectre_v2=ibrs on x86 vendors other than Intel Kim Phillips
2026-08-27  4:33   ` Pawan Gupta
2026-09-09 21:01   ` Borislav Petkov
2026-09-18 23:01     ` Kim Phillips [this message]
2026-08-26 22:35 ` [PATCH v5 3/8] KVM: SVM: Define SVM_SEV_FEAT_* flags using BIT_ULL() Kim Phillips
2026-08-26 22:35 ` [PATCH v5 4/8] KVM: selftests: sev_init2: Use BIT_ULL for VMSA feature bit definition Kim Phillips
2026-08-26 22:35 ` [PATCH v5 5/8] KVM: SEV: Disallow setting SNP-only features for non-SNP guests via a single mask Kim Phillips
2026-08-26 22:35 ` [PATCH v5 6/8] KVM: SEV: Advertise SVM_SEV_FEAT_SNP_ACTIVE Kim Phillips
2026-08-26 22:35 ` [PATCH v5 7/8] KVM: SEV: Add support for IBPB-on-Entry Kim Phillips
2026-08-26 22:35 ` [PATCH v5 8/8] KVM: SEV: Add support for SNP BTB Isolation Kim Phillips

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=9b85be41-db5a-4bdb-95b4-beffb05a5ffc@amd.com \
    --to=kim.phillips@amd.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=david.kaplan@amd.com \
    --cc=kprateek.nayak@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.roth@amd.com \
    --cc=nathan.fontenot@amd.com \
    --cc=naveen.rao@amd.com \
    --cc=nikunj@amd.com \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=thomas.lendacky@amd.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

all inboxes | Powered by JetHome®