[PATCH v2 0/2] x86/cpu, kvm: Support AMD Automatic IBRS

From: Kim Phillips
Date: Wed Nov 23 2022 - 19:05:17 EST


The AMD Zen4 core supports a new feature called Automatic IBRS
(Indirect Branch Restricted Speculation).

Enable Automatic IBRS by default if the CPU feature is present.
It typically provides greater performance over the incumbent
generic retpolines mitigation.

Patch 1 adds support for AutoIBRS and other feature
bits in the CPUID_8000_0021_EAX leaf.

Patch 2 adds support for AMD Automatic IBRS

Co-developed-by: Babu Moger <Babu.Moger@xxxxxxx>
Co-developed-by: Borislav Petkov <bp@xxxxxxxxx>
Signed-off-by: Kim Phillips <kim.phillips@xxxxxxx>
Cc: Borislav Petkov <bp@xxxxxxx>
Cc: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
Cc: "H. Peter Anvin" <hpa@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Joao Martins <joao.m.martins@xxxxxxxxxx>
Cc: Jonathan Corbet <corbet@xxxxxxx>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx>
Cc: Sean Christopherson <seanjc@xxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: David Woodhouse <dwmw@xxxxxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: Juergen Gross <jgross@xxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Tony Luck <tony.luck@xxxxxxxxx>
Cc: Tom Lendacky <thomas.lendacky@xxxxxxx>
Cc: kvm@xxxxxxxxxxxxxxx
Cc: linux-doc@xxxxxxxxxxxxxxx
Cc: x86@xxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx

Kim Phillips (2):
x86/cpu, kvm: Use CPU capabilities for CPUID[0x80000021].EAX
x86/cpu, kvm: Support AMD Automatic IBRS

.../admin-guide/kernel-parameters.txt | 9 +++--
arch/x86/include/asm/cpufeatures.h | 5 +--
arch/x86/include/asm/msr-index.h | 2 ++
arch/x86/kernel/cpu/bugs.c | 23 +++++++-----
arch/x86/kernel/cpu/common.c | 8 +++++
arch/x86/kernel/cpu/scattered.c | 4 +++
arch/x86/kvm/cpuid.c | 35 +++++++++++--------
arch/x86/kvm/reverse_cpuid.h | 24 +++++++++----
arch/x86/kvm/svm/svm.c | 3 ++
arch/x86/kvm/x86.c | 3 ++
10 files changed, 82 insertions(+), 34 deletions(-)

--
2.34.1