diff mbox series

[v3,2/2] KVM: x86: Expose CPUID.(EAX=7,ECX=1).EAX[12:10] to the guest

Message ID 20220901211811.2883855-2-jmattson@google.com (mailing list archive)
State New, archived
Headers show
Series [v3,1/2] x86/cpufeatures: Add macros for Intel's new fast rep string features | expand

Commit Message

Jim Mattson Sept. 1, 2022, 9:18 p.m. UTC
Fast zero-length REP MOVSB, fast short REP STOSB, and fast short REP
{CMPSB,SCASB} are inherent features of the processor that cannot be
hidden by the hypervisor. When these features are present on the host,
enumerate them in KVM_GET_SUPPORTED_CPUID.

Signed-off-by: Jim Mattson <jmattson@google.com>
---
 arch/x86/kvm/cpuid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sean Christopherson Oct. 7, 2022, 1:45 a.m. UTC | #1
The shortlog is trying to win some kind of award.

And technically, KVM_GET_SUPPORTED_CPUID advertises features to userspace, not
to the guest.  How about this?

  KVM: x86: Advertise fast REP string features inherent to the CPU

On Thu, Sep 01, 2022, Jim Mattson wrote:
> Fast zero-length REP MOVSB, fast short REP STOSB, and fast short REP
> {CMPSB,SCASB} are inherent features of the processor that cannot be
> hidden by the hypervisor. When these features are present on the host,
> enumerate them in KVM_GET_SUPPORTED_CPUID.
> 
> Signed-off-by: Jim Mattson <jmattson@google.com>

With a less cryptic shortlog,

Reviewed-by: Sean Christopherson <seanjc@google.com>
diff mbox series

Patch

diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 75dcf7a72605..172cbfd60946 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -636,7 +636,7 @@  void kvm_set_cpu_caps(void)
 		kvm_cpu_cap_set(X86_FEATURE_SPEC_CTRL_SSBD);
 
 	kvm_cpu_cap_mask(CPUID_7_1_EAX,
-		F(AVX_VNNI) | F(AVX512_BF16)
+		F(AVX_VNNI) | F(AVX512_BF16) | F(FZRM) | F(FSRS) | F(FSRC)
 	);
 
 	kvm_cpu_cap_mask(CPUID_D_1_EAX,