From nobody Mon Feb 9 01:44:54 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E2935763FE; Wed, 13 Mar 2024 16:38:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710347901; cv=none; b=kSx2iRviDg68DSAcOM+SvNpf9Tvds4uQ6SddE8JncNJQRMHLsR0O8u4zmr4mzsMaW11IFfuaC33oisq2YUh1pt80wd+SNAJlXqP5jHSEgrh6HcogPX2wbBGJxkWoxsarZdb/CBHMqrABJNy87X6xAXUjKwCV3uGAfA7uEkY8/80= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710347901; c=relaxed/simple; bh=Y8NsNLMhYeoXY1OHFz39pWnQtP46nGvqevZaFSPVxJk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OozLeMGW2TVxEcTcTO3nmPitG7zRbAxqwtLqqOj/3s+XTmbExLc9xl5LtmzACqu4SZmR3U27wOn2MyiT3nb5/GJmVKVm0JNL9b2qL5QAyo0hza+T2ZpprFWwjaz7GvUMFXmJDwYKYvNKo/YoLRYP5a7JZRVbLDZyrdWxH1NQVXY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SIr9q2UY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SIr9q2UY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A496CC433B1; Wed, 13 Mar 2024 16:38:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710347900; bh=Y8NsNLMhYeoXY1OHFz39pWnQtP46nGvqevZaFSPVxJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SIr9q2UYuuiZbRCEQW3MpNf4PNwHdlV+JV/BTsRvkaMTw7Ngf88P7UV5Hmj6ZYrjP ReepHBjdklFfUmFI0Na3D+x//eWhqrlFdfnQFDk5T20oklcEX3M3MUl+WuFER1P6Ys IbCZQy9GLCpaobOSUACUE9/ik0hKxXnr2d5aIrXuDbcjxW2b9ftlHc2ypISNvlXQkP rgYtJ3IpKm4CpEqw7OtcL7EBt1nbsrslIcij0uT92H5w0DNMAnoM0Djjrz+95BYVq6 qOqe+TusHC6IKGcRGY+VzVNFuqQDV72QX0i3PrX6VJvW6b3J6NmgO924mW/vp6yAG7 gzW7XK40WcXLg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Pawan Gupta , Dave Hansen , Thomas Gleixner , Josh Poimboeuf , Greg Kroah-Hartman Subject: [PATCH 6.6 59/60] KVM/x86: Export RFDS_NO and RFDS_CLEAR to guests Date: Wed, 13 Mar 2024 12:37:06 -0400 Message-ID: <20240313163707.615000-60-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240313163707.615000-1-sashal@kernel.org> References: <20240313163707.615000-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.22-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-6.6.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 6.6.22-rc1 X-KernelTest-Deadline: 2024-03-15T16:36+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Pawan Gupta commit 2a0180129d726a4b953232175857d442651b55a0 upstream. 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=3D0, synthesize RFDS_NO to the guest. Signed-off-by: Pawan Gupta Signed-off-by: Dave Hansen Reviewed-by: Thomas Gleixner Acked-by: Josh Poimboeuf Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/x86.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 3d8472d00024c..9b6639d87a62e 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1620,7 +1620,8 @@ static bool kvm_is_immutable_feature_msr(u32 msr) ARCH_CAP_SKIP_VMENTRY_L1DFLUSH | ARCH_CAP_SSB_NO | ARCH_CAP_MDS_NO | \ ARCH_CAP_PSCHANGE_MC_NO | ARCH_CAP_TSX_CTRL_MSR | ARCH_CAP_TAA_NO | \ ARCH_CAP_SBDR_SSDP_NO | ARCH_CAP_FBSDP_NO | ARCH_CAP_PSDP_NO | \ - ARCH_CAP_FB_CLEAR | ARCH_CAP_RRSBA | ARCH_CAP_PBRSB_NO | ARCH_CAP_GDS_NO) + ARCH_CAP_FB_CLEAR | ARCH_CAP_RRSBA | ARCH_CAP_PBRSB_NO | ARCH_CAP_GDS_NO= | \ + ARCH_CAP_RFDS_NO | ARCH_CAP_RFDS_CLEAR) =20 static u64 kvm_get_arch_capabilities(void) { @@ -1652,6 +1653,8 @@ static u64 kvm_get_arch_capabilities(void) data |=3D ARCH_CAP_SSB_NO; if (!boot_cpu_has_bug(X86_BUG_MDS)) data |=3D ARCH_CAP_MDS_NO; + if (!boot_cpu_has_bug(X86_BUG_RFDS)) + data |=3D ARCH_CAP_RFDS_NO; =20 if (!boot_cpu_has(X86_FEATURE_RTM)) { /* --=20 2.43.0