From mboxrd@z Thu Jan 1 00:00:00 1970 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 46DAA84A54; Wed, 13 Mar 2024 16:40:54 +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=1710348054; cv=none; b=d04V8+xNfY04ivSC56HQywmrQ5uOW3gEZgy6MFRHC3fHsjL1yacIJwzFerrGTT7O5St9AP3OudwzxvBcbl9tw+PlbR4iOwaojAQQUi8l8xKIYD0xBy42CsYaBnBlgpfJpXT+JXTB9xkTif+T8y4igO1RD//5inErVQl/2DilZiw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710348054; c=relaxed/simple; bh=sNoxLVjrPoo95Yw3BWo7eps67bRpz9m866wf6XMDmIM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CFKLDrOwfg2aWvoyqYWyHJi77jcPulZoVjjcxLv4BdqUeakpb24NSiCndKJIS6o4bRtCG4aIGR0/FtoTW+LjLUGMpx7SL3Qy094dyor8ag++VnDfJr0fuYrm/sAS4X5lqpsqAbNXriov67p+B8vqmMovPZKGUIDs7nM1sFneMRA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Wz2LQo7h; 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="Wz2LQo7h" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2019BC43394; Wed, 13 Mar 2024 16:40:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710348054; bh=sNoxLVjrPoo95Yw3BWo7eps67bRpz9m866wf6XMDmIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wz2LQo7hQfJv5zd60ILboQP1LVlV7JEfgAqiLelA4iXxWdMmSg9zUHOYXTEdngqOl ONLyQt6FWwwTRd+pTRUOKzsrLBNk/yRXuoAJq7oVVmzDhE3BiALoopBAhKNIEY6cmI r5qS40wRL6X6GfNMiCetjd7EzH33VBZ3UiqKDyZxpXP/Q+qX/fXMMJAOrLmNGeZW16 QxJMjxCSIME2j7nJFU5v7wpgdtuBrY7UAjQHNRchLjTsItsEoxZHODwOt9hwIL2uxD F+EzPP6edGCPPtVrj256ZgpF/GLpg/gC3bb8nLtWhDquUHbf1F5APYzdBSJtE45PWm bt1n4nrgCylZw== 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.1 46/71] KVM/x86: Export RFDS_NO and RFDS_CLEAR to guests Date: Wed, 13 Mar 2024 12:39:32 -0400 Message-ID: <20240313163957.615276-47-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240313163957.615276-1-sashal@kernel.org> References: <20240313163957.615276-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@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.1.82-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-6.1.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 6.1.82-rc1 X-KernelTest-Deadline: 2024-03-15T16:39+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit 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=0, 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 7144e51668136..688bc7b72eb66 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1613,7 +1613,8 @@ static unsigned int num_msr_based_features; 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) static u64 kvm_get_arch_capabilities(void) { @@ -1650,6 +1651,8 @@ static u64 kvm_get_arch_capabilities(void) data |= ARCH_CAP_SSB_NO; if (!boot_cpu_has_bug(X86_BUG_MDS)) data |= ARCH_CAP_MDS_NO; + if (!boot_cpu_has_bug(X86_BUG_RFDS)) + data |= ARCH_CAP_RFDS_NO; if (!boot_cpu_has(X86_FEATURE_RTM)) { /* -- 2.43.0