Skip to content

Commit 3c7cb84

Browse files
xinli-intelsean-jc
authored andcommitted
x86/cpufeatures: Add a CPU feature bit for MSR immediate form instructions
The immediate form of MSR access instructions are primarily motivated by performance, not code size: by having the MSR number in an immediate, it is available *much* earlier in the pipeline, which allows the hardware much more leeway about how a particular MSR is handled. Use a scattered CPU feature bit for MSR immediate form instructions. Suggested-by: Borislav Petkov (AMD) <bp@alien8.de> Signed-off-by: Xin Li (Intel) <xin@zytor.com> Link: https://lore.kernel.org/r/20250805202224.1475590-2-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 6c3d4b9 commit 3c7cb84

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

arch/x86/include/asm/cpufeatures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,7 @@
495495
#define X86_FEATURE_TSA_SQ_NO (21*32+11) /* AMD CPU not vulnerable to TSA-SQ */
496496
#define X86_FEATURE_TSA_L1_NO (21*32+12) /* AMD CPU not vulnerable to TSA-L1 */
497497
#define X86_FEATURE_CLEAR_CPU_BUF_VM (21*32+13) /* Clear CPU buffers using VERW before VMRUN */
498+
#define X86_FEATURE_MSR_IMM (21*32+14) /* MSR immediate form instructions */
498499

499500
/*
500501
* BUG word(s)

arch/x86/kernel/cpu/scattered.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ static const struct cpuid_bit cpuid_bits[] = {
2727
{ X86_FEATURE_APERFMPERF, CPUID_ECX, 0, 0x00000006, 0 },
2828
{ X86_FEATURE_EPB, CPUID_ECX, 3, 0x00000006, 0 },
2929
{ X86_FEATURE_INTEL_PPIN, CPUID_EBX, 0, 0x00000007, 1 },
30+
{ X86_FEATURE_MSR_IMM, CPUID_ECX, 5, 0x00000007, 1 },
3031
{ X86_FEATURE_APX, CPUID_EDX, 21, 0x00000007, 1 },
3132
{ X86_FEATURE_RRSBA_CTRL, CPUID_EDX, 2, 0x00000007, 2 },
3233
{ X86_FEATURE_BHI_CTRL, CPUID_EDX, 4, 0x00000007, 2 },

0 commit comments

Comments
 (0)