Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1848431lql; Wed, 13 Mar 2024 09:44:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXpJOe/VAnfHHxnfT+bMQPDwq5swVFBfr9GtPGw66vc+aCT/D3GfALf1QW0Wd7z39yPHe+B13AwMx+ubTfJ2JwZyZ/hIsZQRGe2BZFLOA== X-Google-Smtp-Source: AGHT+IHdXheq7fa12HVPZNfjtT85Q1paWaZJMIXzjumC15GgkBWXB0H+D7RkOI5IyCx/7w5KqzIS X-Received: by 2002:a17:902:ce91:b0:1dd:8a51:7b3e with SMTP id f17-20020a170902ce9100b001dd8a517b3emr13077998plg.11.1710348254005; Wed, 13 Mar 2024 09:44:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710348253; cv=pass; d=google.com; s=arc-20160816; b=prcQxUIkJWKCgc8VnvGBVAGCD7ge5Lt1qHAn3ZAhWzaxVprixIy0sq/fHuANK4QuXx +VUnK+0TDI2u0JleVCTs8KQG3kWb+xBzcH+m/zyekG5KJF8qhQAeVJY3WkgSC+vPjh27 GrxbIHBpb1s4ZxB/3Ui60Hs3kT1eMpuKABLN9Xm0N4GOylRFPsosgp45mOTbgkIpC9F7 nsSoZMyQMA/Mfy1R8rpTy4a98Tw+bJszyZJNXQ7z2rriPCgDVrtIi0iRAOMhweoaGqd+ dSo2MSoKxsm4mh9BBk0WjiGCM24m5wpQjt6ORyVH1OklwTuGvK8UXjaEZMyqDdsUWk7A ajcA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=jQXycXMntPDw84q/Y4x4lERTVus7Gcjdb8339GGR8iw=; fh=yt9bdIl5jWBWQShzSObvYJRlp1hhkB1Bsv7jf7n/3yc=; b=fd3wXHjlCeiUWebw2SJcbdoruuZNgh/CSfkzExc/D/LmpWFSEmoCwu9pzM7hOtQjCc s1rcQXGGNca534bo6shtRV/3K/2rKxLtj/NlZOKcNbjd4NfnO5Ol2s0vcPC5ZLBH9BXu UqSf5PlFyuK/uRZuFNeoicFhOXTaR0b9BMaGsTcMKBsFGpLusVpx7auAgGn2ll1Oktpi vc0KEobf9+0bo2H+F0VjJH08oxBuUxfxqZKoFsNgezRXctyAQR1/1YimvXz3/knT40Tv uyXuJH6lnLEI3n2+iUZ6VwupHr9NINua4MQtX1eoWqveLvJrzp1GziSJRRPFUKvjtyxd EyJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A4WMCU1Q; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101743-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l4-20020a170903244400b001dd645ca74esi9675034pls.115.2024.03.13.09.44.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 09:44:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A4WMCU1Q; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101743-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id F166D287F06 for ; Wed, 13 Mar 2024 16:33:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 534BF52F9B; Wed, 13 Mar 2024 16:32:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="A4WMCU1Q" 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 73B3C51037; Wed, 13 Mar 2024 16:32:44 +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=1710347564; cv=none; b=TzeZbLpLfAoAFGfsiHF0ze3swtpLMuE9rujVz9tsSQrTXu3MIRKK59YPHjJAccYGz5dCj+OFCYNl6dcfV02lFt5u2yYWSS2H7Qm1tFJJZZRp1iAQFFgC1cNCVNxuHmqAIeaBlyf5o8ntKL+edGqMAJZYgtGCQgKb0HAm0sGxb00= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710347564; c=relaxed/simple; bh=5itnuw8rkfFsHoEsvM+/W5bVCEbxe4whwlPwsjtLUOo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TGbz6CWnZA71T/tZIdnoBP9Y4DXXM/1JeWxv09vN/1c1h6z4+qmPhSEBncFbVUAm18J0XAv4evTKYSMGwrXi9JFP7ohCUUFJ5z6UfyTSfqe30HqQVUamp2MGid/9zOTu2k5lxhwpxd9LMn/SoMCydnOBC+7Vg1J7lx50JJZgfNg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=A4WMCU1Q; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 551B6C433F1; Wed, 13 Mar 2024 16:32:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710347564; bh=5itnuw8rkfFsHoEsvM+/W5bVCEbxe4whwlPwsjtLUOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A4WMCU1QGdIKHISLwwUqyKTtieJg7x8Wq8CBf8OLNiBkcIMbTSVT6FDPPj+d9a/rA 7c5wL5ECSnQo24p8nhFFP2dXtdYjVHRMXllx/oYeAZ8WXvVgVugSwoii1J3dK3tC6l 8ngX1INYOj2b4ARejjGpbT+QxlLKAasFkaejdVSIyPy7EzK6Xsj1wCuXZRSJqVKVrE 5SvtdgpZelQP0R+zCdnHs0bp4qO5LVcPT8dlrBftbX+eadl5yQCWiQGrDGe9FMafA2 35ZEE1t/41/CLA5jLMvijvk/nkhAhPHxpMuuLH4l01Tz5C7llBMs1kvsTsEWgxHRcr bSFZdTdilcCSw== 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.7 04/61] KVM/x86: Export RFDS_NO and RFDS_CLEAR to guests Date: Wed, 13 Mar 2024 12:31:39 -0400 Message-ID: <20240313163236.613880-5-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240313163236.613880-1-sashal@kernel.org> References: <20240313163236.613880-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.7.10-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-6.7.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 6.7.10-rc1 X-KernelTest-Deadline: 2024-03-15T16:32+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 468870450b8ba..8021c62b0e7b0 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) static u64 kvm_get_arch_capabilities(void) { @@ -1652,6 +1653,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