Skip to content

Commit 1eaafe9

Browse files
jsmattsonjrrkrcmar
authored andcommitted
kvm: x86: IA32_ARCH_CAPABILITIES is always supported
If there is a possibility that a VM may migrate to a Skylake host, then the hypervisor should report IA32_ARCH_CAPABILITIES.RSBA[bit 2] as being set (future work, of course). This implies that CPUID.(EAX=7,ECX=0):EDX.ARCH_CAPABILITIES[bit 29] should be set. Therefore, kvm should report this CPUID bit as being supported whether or not the host supports it. Userspace is still free to clear the bit if it chooses. For more information on RSBA, see Intel's white paper, "Retpoline: A Branch Target Injection Mitigation" (Document Number 337131-001), currently available at https://bugzilla.kernel.org/show_bug.cgi?id=199511. Since the IA32_ARCH_CAPABILITIES MSR is emulated in kvm, there is no dependency on hardware support for this feature. Signed-off-by: Jim Mattson <jmattson@google.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Fixes: 28c1c9f ("KVM/VMX: Emulate MSR_IA32_ARCH_CAPABILITIES") Cc: stable@vger.kernel.org Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
1 parent c4d2188 commit 1eaafe9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/x86/kvm/cpuid.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,11 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
495495
entry->ecx &= ~F(PKU);
496496
entry->edx &= kvm_cpuid_7_0_edx_x86_features;
497497
cpuid_mask(&entry->edx, CPUID_7_EDX);
498+
/*
499+
* We emulate ARCH_CAPABILITIES in software even
500+
* if the host doesn't support it.
501+
*/
502+
entry->edx |= F(ARCH_CAPABILITIES);
498503
} else {
499504
entry->ebx = 0;
500505
entry->ecx = 0;

0 commit comments

Comments
 (0)