Skip to content

Commit 2a01801

Browse files
pa1guptahansendc
authored andcommitted
KVM/x86: Export RFDS_NO and RFDS_CLEAR to guests
Mitigation for RFDS requires RFDS_CLEAR capability which is enumerated by MSR_IA32_ARCH_CAPABILITIES bit 27. If the host has it set, export it to guests so that they can deploy the mitigation. RFDS_NO indicates that the system is not vulnerable to RFDS, export it to guests so that they don't deploy the mitigation unnecessarily. When the host is not affected by X86_BUG_RFDS, but has RFDS_NO=0, synthesize RFDS_NO to the guest. Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
1 parent 8076fcd commit 2a01801

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arch/x86/kvm/x86.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1623,7 +1623,8 @@ static bool kvm_is_immutable_feature_msr(u32 msr)
16231623
ARCH_CAP_SKIP_VMENTRY_L1DFLUSH | ARCH_CAP_SSB_NO | ARCH_CAP_MDS_NO | \
16241624
ARCH_CAP_PSCHANGE_MC_NO | ARCH_CAP_TSX_CTRL_MSR | ARCH_CAP_TAA_NO | \
16251625
ARCH_CAP_SBDR_SSDP_NO | ARCH_CAP_FBSDP_NO | ARCH_CAP_PSDP_NO | \
1626-
ARCH_CAP_FB_CLEAR | ARCH_CAP_RRSBA | ARCH_CAP_PBRSB_NO | ARCH_CAP_GDS_NO)
1626+
ARCH_CAP_FB_CLEAR | ARCH_CAP_RRSBA | ARCH_CAP_PBRSB_NO | ARCH_CAP_GDS_NO | \
1627+
ARCH_CAP_RFDS_NO | ARCH_CAP_RFDS_CLEAR)
16271628

16281629
static u64 kvm_get_arch_capabilities(void)
16291630
{
@@ -1655,6 +1656,8 @@ static u64 kvm_get_arch_capabilities(void)
16551656
data |= ARCH_CAP_SSB_NO;
16561657
if (!boot_cpu_has_bug(X86_BUG_MDS))
16571658
data |= ARCH_CAP_MDS_NO;
1659+
if (!boot_cpu_has_bug(X86_BUG_RFDS))
1660+
data |= ARCH_CAP_RFDS_NO;
16581661

16591662
if (!boot_cpu_has(X86_FEATURE_RTM)) {
16601663
/*

0 commit comments

Comments
 (0)