Skip to content

Commit d88bb2d

Browse files
babumogersean-jc
authored andcommitted
KVM: x86: Advertise support for AMD's PREFETCHI
The latest AMD platform has introduced a new instruction called PREFETCHI. This instruction loads a cache line from a specified memory address into the indicated data or instruction cache level, based on locality reference hints. Feature bit definition: CPUID_Fn80000021_EAX [bit 20] - Indicates support for IC prefetch. This feature is analogous to Intel's PREFETCHITI (CPUID.(EAX=7,ECX=1):EDX), though the CPUID bit definitions differ between AMD and Intel. Advertise support to userspace, as no additional enabling is necessary (PREFETCHI can't be intercepted as there's no instruction specific behavior that needs to be virtualize). The feature is documented in Processor Programming Reference (PPR) for AMD Family 1Ah Model 02h, Revision C1 (Link below). Link: https://bugzilla.kernel.org/show_bug.cgi?id=206537 Signed-off-by: Babu Moger <[email protected]> Acked-by: Borislav Petkov (AMD) <[email protected]> Link: https://lore.kernel.org/r/ee1c08fc400bb574a2b8f2c6a0bd9def10a29d35.1744130533.git.babu.moger@amd.com [sean: rewrite shortlog to highlight the KVM functionality] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 49c140d commit d88bb2d

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

arch/x86/include/asm/cpufeatures.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@
458458
#define X86_FEATURE_AUTOIBRS (20*32+ 8) /* Automatic IBRS */
459459
#define X86_FEATURE_NO_SMM_CTL_MSR (20*32+ 9) /* SMM_CTL MSR is not present */
460460

461+
#define X86_FEATURE_PREFETCHI (20*32+20) /* Prefetch Data/Instruction to Cache Level */
461462
#define X86_FEATURE_SBPB (20*32+27) /* Selective Branch Prediction Barrier */
462463
#define X86_FEATURE_IBPB_BRTYPE (20*32+28) /* MSR_PRED_CMD[IBPB] flushes all branch type predictions */
463464
#define X86_FEATURE_SRSO_NO (20*32+29) /* CPU is not affected by SRSO */

arch/x86/kvm/cpuid.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,7 @@ void kvm_set_cpu_caps(void)
11681168
F(NULL_SEL_CLR_BASE),
11691169
/* UpperAddressIgnore */
11701170
F(AUTOIBRS),
1171+
F(PREFETCHI),
11711172
EMULATED_F(NO_SMM_CTL_MSR),
11721173
/* PrefetchCtlMsr */
11731174
/* GpOnUserCpuid */

0 commit comments

Comments
 (0)