-
Notifications
You must be signed in to change notification settings - Fork 54k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'x86_cpu_for_v6.3_rc1' of git://git.kernel.org/pub/scm/linu…
…x/kernel/git/tip/tip Pull x86 cpuid updates from Borislav Petkov: - Cache the AMD debug registers in per-CPU variables to avoid MSR writes where possible, when supporting a debug registers swap feature for SEV-ES guests - Add support for AMD's version of eIBRS called Automatic IBRS which is a set-and-forget control of indirect branch restriction speculation resources on privilege change - Add support for a new x86 instruction - LKGS - Load kernel GS which is part of the FRED infrastructure - Reset SPEC_CTRL upon init to accomodate use cases like kexec which rediscover - Other smaller fixes and cleanups * tag 'x86_cpu_for_v6.3_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/amd: Cache debug register values in percpu variables KVM: x86: Propagate the AMD Automatic IBRS feature to the guest x86/cpu: Support AMD Automatic IBRS x86/cpu, kvm: Add the SMM_CTL MSR not present feature x86/cpu, kvm: Add the Null Selector Clears Base feature x86/cpu, kvm: Move X86_FEATURE_LFENCE_RDTSC to its native leaf x86/cpu, kvm: Add the NO_NESTED_DATA_BP feature KVM: x86: Move open-coded CPUID leaf 0x80000021 EAX bit propagation code x86/cpu, kvm: Add support for CPUID_80000021_EAX x86/gsseg: Add the new <asm/gsseg.h> header to <asm/asm-prototypes.h> x86/gsseg: Use the LKGS instruction if available for load_gs_index() x86/gsseg: Move load_gs_index() to its own new header file x86/gsseg: Make asm_load_gs_index() take an u16 x86/opcode: Add the LKGS instruction to x86-opcode-map x86/cpufeature: Add the CPU feature bit for LKGS x86/bugs: Reset speculation control settings on init x86/cpu: Remove redundant extern x86_read_arch_cap_msr()
- Loading branch information
Showing
30 changed files
with
218 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only */ | ||
#ifndef _ASM_X86_GSSEG_H | ||
#define _ASM_X86_GSSEG_H | ||
|
||
#include <linux/types.h> | ||
|
||
#include <asm/asm.h> | ||
#include <asm/cpufeature.h> | ||
#include <asm/alternative.h> | ||
#include <asm/processor.h> | ||
#include <asm/nops.h> | ||
|
||
#ifdef CONFIG_X86_64 | ||
|
||
extern asmlinkage void asm_load_gs_index(u16 selector); | ||
|
||
/* Replace with "lkgs %di" once binutils support LKGS instruction */ | ||
#define LKGS_DI _ASM_BYTES(0xf2,0x0f,0x00,0xf7) | ||
|
||
static inline void native_lkgs(unsigned int selector) | ||
{ | ||
u16 sel = selector; | ||
asm_inline volatile("1: " LKGS_DI | ||
_ASM_EXTABLE_TYPE_REG(1b, 1b, EX_TYPE_ZERO_REG, %k[sel]) | ||
: [sel] "+D" (sel)); | ||
} | ||
|
||
static inline void native_load_gs_index(unsigned int selector) | ||
{ | ||
if (cpu_feature_enabled(X86_FEATURE_LKGS)) { | ||
native_lkgs(selector); | ||
} else { | ||
unsigned long flags; | ||
|
||
local_irq_save(flags); | ||
asm_load_gs_index(selector); | ||
local_irq_restore(flags); | ||
} | ||
} | ||
|
||
#endif /* CONFIG_X86_64 */ | ||
|
||
static inline void __init lkgs_init(void) | ||
{ | ||
#ifdef CONFIG_PARAVIRT_XXL | ||
#ifdef CONFIG_X86_64 | ||
if (cpu_feature_enabled(X86_FEATURE_LKGS)) | ||
pv_ops.cpu.load_gs_index = native_lkgs; | ||
#endif | ||
#endif | ||
} | ||
|
||
#ifndef CONFIG_PARAVIRT_XXL | ||
|
||
static inline void load_gs_index(unsigned int selector) | ||
{ | ||
#ifdef CONFIG_X86_64 | ||
native_load_gs_index(selector); | ||
#else | ||
loadsegment(gs, selector); | ||
#endif | ||
} | ||
|
||
#endif /* CONFIG_PARAVIRT_XXL */ | ||
|
||
#endif /* _ASM_X86_GSSEG_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.