From patchwork Wed Nov 8 18:29:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Xin3" X-Patchwork-Id: 163153 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp1125869vqo; Wed, 8 Nov 2023 11:05:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGQ4Ku3eGtwEsjQAjhyARy+glo8YIV8j/G5Y4qloXbB3tPd8ibqIOKIOVisNU+GQ6Vzhwo0 X-Received: by 2002:a17:903:22c5:b0:1ca:8629:829f with SMTP id y5-20020a17090322c500b001ca8629829fmr3278912plg.26.1699470305880; Wed, 08 Nov 2023 11:05:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699470305; cv=none; d=google.com; s=arc-20160816; b=Y5j9ikKct3efYJmPfQhKq0BBWpRigNMKtpBLDvi76N9LBmu6sx5xARRNaRKVn1tnHc 04hrWlO1758Y2GByJ4oWpkGphTAchEbHAE6ceHq8eLmE+FODQnRWR1EGVm+IEU6lAMsd 9m45Cf3h0IrYW934ZFEiOr9xXHPYS+ILWnslxviRlGKBL/fJM6dsCinAc6dpphrcnvF6 vxoKFUCa9bT/lshJenuOjqFXWvETIwE0YGJT3TVfU1eFtBzQLeXS1edGJzyDHt/2GiV9 EjkAbmmXJCism6GNjnqy5BQDOCKldoNznlsxssDIdpVaAprLZMvJEmtiogsUC/kw99bv 6V1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZVvtVL6oOspTwS+4yBWmJTZ8AMtJ6ZJIkVG/RE/pGPs=; fh=jyCs2STAghiemYCMqutk2CMon3BCEX6sSSqaVLqDaaU=; b=tWqUIaulENC6QZQKVOI8rEONYXrACVlGCYSNtZ/oIQT6X1aR6XV6MMf/1J2gHYnE9K ZBvXuVP+AXWl1tHpyey1E2eKeM1asVz5yAiSc0Qq/VukpGaX/dLQOmjpyFs7s9LETjjm UKl+CORkSAlVfZJ9bQ2BHmt0wc6aq1dF8E4YmwxeA9FdYNBlIPNxXnfdnZncElrSGBkt wRtTFneBe5B9lyXOJwhlHAin4NgMsruMoFULIS3QTq8qgj25dnXhcLuH5lSe1kuqKnXr yU9MDUM2KjqGmHEm3BR6QNkCIIkpYQ3VO6ZDD3CopBeKKpMbAaxnbygdKMG/ZIGufdcH t72g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=E4Rkjg2J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id m15-20020a170902db0f00b001c7249f5e40si3175262plx.469.2023.11.08.11.05.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Nov 2023 11:05:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=E4Rkjg2J; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 50720822CE08; Wed, 8 Nov 2023 11:01:56 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233065AbjKHTBV (ORCPT + 32 others); Wed, 8 Nov 2023 14:01:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232761AbjKHTAb (ORCPT ); Wed, 8 Nov 2023 14:00:31 -0500 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8157D2137; Wed, 8 Nov 2023 11:00:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1699470027; x=1731006027; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=owKcodjX01Nc+bGT/BhDGevJXqRWWYTr/t4Iq7+49FI=; b=E4Rkjg2JGvnRfyZPZE1d+gKxv04E9DhFHOYxXARkVjwuax0bjTctCPXp Qv3HcSwqge+YUHymqWGvjnmr+NnNX2N8po/ZtFECWXA5daR40oea1tX68 4cUP1pxXXAaKjQ+/WCue8vsa5hM6VJ2b4ulq+v5Icjr86SOD/16F1v1HQ Rdr572cpodWtd1eE60l/aHDzLPXNByi7RDEYfy7fMAtVY3Kb7LCrb9nmd 3l+1Sk3RSIP+FrmPE7OVSDta2YJ1qw0pl/1lhxzkjPNqDehAZlK5d0Boi p6wajhSu2Fc60lcCq7PH3hWTLlE7COMx9bRA6KRXTJnOuj5rC4NoFvojF w==; X-IronPort-AV: E=McAfee;i="6600,9927,10888"; a="8486433" X-IronPort-AV: E=Sophos;i="6.03,287,1694761200"; d="scan'208";a="8486433" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2023 11:00:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,287,1694761200"; d="scan'208";a="10892503" Received: from unknown (HELO fred..) ([172.25.112.68]) by orviesa001.jf.intel.com with ESMTP; 08 Nov 2023 11:00:25 -0800 From: Xin Li To: kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: seanjc@google.com, pbonzini@redhat.com, corbet@lwn.net, kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, vkuznets@redhat.com, peterz@infradead.org, ravi.v.shankar@intel.com Subject: [PATCH v1 19/23] KVM: x86: Allow FRED/LKGS/WRMSRNS to be exposed to guests Date: Wed, 8 Nov 2023 10:29:59 -0800 Message-ID: <20231108183003.5981-20-xin3.li@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231108183003.5981-1-xin3.li@intel.com> References: <20231108183003.5981-1-xin3.li@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 08 Nov 2023 11:01:56 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782023775751328452 X-GMAIL-MSGID: 1782023775751328452 Allow FRED/LKGS/WRMSRNS to be exposed to guests, thus a guest OS could see these features when the guest is configured with FRED/LKGS/WRMSRNS in Qemu. A qemu patch is required to expose FRED/LKGS/WRMSRNS to KVM guests. Tested-by: Shan Kang Signed-off-by: Xin Li --- arch/x86/kvm/cpuid.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index dda6fc4cfae8..aa11b3e394ae 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -670,8 +670,8 @@ void kvm_set_cpu_caps(void) kvm_cpu_cap_mask(CPUID_7_1_EAX, F(AVX_VNNI) | F(AVX512_BF16) | F(CMPCCXADD) | - F(FZRM) | F(FSRS) | F(FSRC) | - F(AMX_FP16) | F(AVX_IFMA) + F(FZRM) | F(FSRS) | F(FSRC) | F(FRED) | F(LKGS) | + F(WRMSRNS) | F(AMX_FP16) | F(AVX_IFMA) ); kvm_cpu_cap_init_kvm_defined(CPUID_7_1_EDX,