Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1868221lql; Wed, 13 Mar 2024 10:14:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWyfG9eWvvqzPmDPN4jMVGwxz4phXU7x5LNsl799ltijRaMubXONifI7xQorBw1i6YNeP1kBXKN3LHtwZqyrLHFHkXwN6NF//tdNi8OlA== X-Google-Smtp-Source: AGHT+IEheqjR0J7fl01dysVfaQWwL3ITclM/bCbwRlN3YbsXbu2cagpHd0fuuwCELjmSYq6CHG3y X-Received: by 2002:a50:9f67:0:b0:567:f511:37ea with SMTP id b94-20020a509f67000000b00567f51137eamr9074686edf.13.1710350064125; Wed, 13 Mar 2024 10:14:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710350064; cv=pass; d=google.com; s=arc-20160816; b=VZCCubxhSreygmWCRai+nA6rdq8F0FSIGbVZdsC7U6zKh/gSQkCFoS7xGwJSIv/65H ncsx/0TEGhDhhGM0NlGwZP0VxCnSiXiu3Zp2vgT6em+jQ44dCdZsQLn3qiwLzFoTGmdf BbTI17fP1meaiULCsH/5GshAjhA5hFg6e7baE9+G+k4nxtCGhu3xhQUp71oWclY86lEU eKo/3eehOYinzXrOBxoJOzQoihiZS+E9/vyjOG2Q++PkwVn3wuagYgPJP6UzlNPAxn5U Xl8mB/1tVqSCCVigb01HKhSzbRu2M6/fRRKbAXqhgPivOyDnZA4s+nkxoyWL9MVVkOdv cZOg== 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=S8qLFqN2OtRNRdbhkmiZ3EWiupcTZTkhB39Bi7c09hg=; fh=yt9bdIl5jWBWQShzSObvYJRlp1hhkB1Bsv7jf7n/3yc=; b=nwCiRIa+BchxwR0Hs7WNlZny7R0+VTA4F8klwgYAUm90yjOcBqIch5DVIDSZAKT5f7 GJYs/rVGCWL00G1EU0DvbPICmmVPvGQDjpx9IQfSMosRo95f+6BArX+s4XuBGDf0AuHR 1vkERvlyZ9AguCHl1v+y6YNt4lMEM7luSKMleyrnxVexOPxNkWJnRlpywcGArbKTVZRm Dz2XYOnH0dbvJW48RiuVRcny3mjie4Fm3BAbWsHcpUyXjkn3F3+SG9syao7jkRxHP69q MxZlG9sYx8EUVNQseVIPTpDNeOmrHfn3RFiRhgx4BPwCcHKoyVp5sAwaj0qSpDxIOIuZ SfQA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Wz2LQo7h; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101914-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id w8-20020a05640234c800b005688ec356a9si244600edc.118.2024.03.13.10.14.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 10:14:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Wz2LQo7h; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101914-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101914-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 am.mirrors.kernel.org (Postfix) with ESMTPS id CFF621F2FF30 for ; Wed, 13 Mar 2024 17:14:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2AAEA86242; Wed, 13 Mar 2024 16:40:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Wz2LQo7h" 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 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: 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.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