Skip to content

Commit f24ef00

Browse files
trueptolemysean-jc
authored andcommitted
KVM: x86: Advertise MOVRS CPUID to userspace
Define the feature flag for MOVRS and advertise support to userspace when the feature is supported by the host. MOVRS is a new set of instructions introduced in the Intel platform Diamond Rapids, to provide load instructions that carry a read-shared hint. Functionally, MOVRS family is equivalent to existing load instructions, but its read-shared hint indicates that the source memory location is likely to become read-shared by multiple processors, i.e., read in the future by at least one other processor before it is written (assuming it is ever written in the future). This hint could optimize the behavior of the caches, especially shared caches, for this data for future reads by multiple processors. Additionally, MOVRS family also includes a software prefetch instruction, PREFETCHRST2, that carries the same read-shared hint. [*] MOVRS family is enumerated by CPUID single-bit (0x7.0x1.EAX[bit 31]). Since it's on a densely-populated CPUID leaf and some other bits on this leaf have kernel usages, define this new feature in cpufeatures.h, but hide it in /proc/cpuinfo due to lack of current kernel usage. Advertise MOVRS bit to userspace directly. It's safe, since there's no new VMX controls or additional host enabling required for guests to use this feature. [*]: Intel Architecture Instruction Set Extensions and Future Features (rev.059). Tested-by: Xudong Hao <xudong.hao@intel.com> Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Link: https://patch.msgid.link/20251120050720.931449-2-zhao1.liu@intel.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent c4a365c commit f24ef00

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
@@ -326,6 +326,7 @@
326326
#define X86_FEATURE_AMX_FP16 (12*32+21) /* AMX fp16 Support */
327327
#define X86_FEATURE_AVX_IFMA (12*32+23) /* Support for VPMADD52[H,L]UQ */
328328
#define X86_FEATURE_LAM (12*32+26) /* "lam" Linear Address Masking */
329+
#define X86_FEATURE_MOVRS (12*32+31) /* MOVRS instructions */
329330

330331
/* AMD-defined CPU features, CPUID level 0x80000008 (EBX), word 13 */
331332
#define X86_FEATURE_CLZERO (13*32+ 0) /* "clzero" CLZERO instruction */

arch/x86/kvm/cpuid.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,7 @@ void kvm_set_cpu_caps(void)
10281028
F(AMX_FP16),
10291029
F(AVX_IFMA),
10301030
F(LAM),
1031+
F(MOVRS),
10311032
);
10321033

10331034
kvm_cpu_cap_init(CPUID_7_1_ECX,

0 commit comments

Comments
 (0)