Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp479918rdh; Wed, 7 Feb 2024 10:07:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IF4ozqVkFhoHVKxru+RbA1VljgUo8QbfwzhXe/AU3GexGYXVoex8ZRbsKsih8i9Yv97ZHRt X-Received: by 2002:a17:907:971f:b0:a38:92af:98fb with SMTP id jg31-20020a170907971f00b00a3892af98fbmr1513833ejc.14.1707329275240; Wed, 07 Feb 2024 10:07:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707329275; cv=pass; d=google.com; s=arc-20160816; b=dzkW1hJtIP5875fPhCCDSZkdkMx0GLDAF93iXYxlAnxzTxfsb2CTdGiR6EALcM8Jl0 7+JxYbcLb2a2ey9ViIKNlZHLlN47Aw/3oGTi8owlI3hjZXdYPUrnI0+mn41aQOeAeldO slhxeOOpTSouOYRCA+xykYhJ7392Nv4mGJlhaoIenrqeBiVQrouOsS+Njq+3v0tSoAPl K7EgyKoaF0/Wey9t6Io9DyDT9GArOt4gol1mvRj1w7Ez/vSASvTXdSti8b12ogWEED9A docgJNe9xw26kdcc5mzx3Vewkd+b/I7oBKYod6qcnqVIMXh0tTfTrGbB4VDaSI0Bv5W6 xLcQ== 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=DIu4L7W0j6X/xGmRGLOBGj0fYKmZ7pfHZk7mC6Qo+mU=; fh=VYoTgch3nWlFfdfem+Lk3SllwNTi1WuQz+X2c4F9hCE=; b=ShyfEDHDTgvmSn78mgSgcSwVkMpx/wIL8F4H/8VSHchvu5nGfK0RfWAS85gbIpedJU 7g5qfbM6ADa4TdX8LqduPPXnJJaulvtI5QioqHop+Q/TDNIuo4dFpiKzGnx4OHHisOmf yE7+jxZpIfcE7MAjhqEfXu9Tu4EW3SACtqRDuLhWVgpmjyC4783EmHemyRhu6OXVX7Kk Edq2F9vTgrewBHQfzqTwrSLsjuZcCuA8f5T2S52Nbh2Vo6WAo3X8ppSgCweJ3QERZiSm FX6R2fSJ3mEtjUTcDMel0LxgNU+zeh6vGmYZOmW/YF4nX6NKD38WkVoQg4wV4dqZr4j3 V5hw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hAQGWwPc; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-56876-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56876-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=2; AJvYcCXQ/d+8kKZaW8EleSfcaXLnMNP7ZES8doM2TvAFxbJautWz1s6sCynh7L4eJYwIMT+Fv5BFU8sQs93KNfidC1IqAJ2siVLQkGbbA2zAFA== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z21-20020a17090655d500b00a382f1a9df2si1246462ejp.151.2024.02.07.10.07.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 10:07:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56876-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=@intel.com header.s=Intel header.b=hAQGWwPc; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-56876-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56876-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 017541F219C4 for ; Wed, 7 Feb 2024 18:07:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B0CE913699B; Wed, 7 Feb 2024 17:59:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hAQGWwPc" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (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 2259A13541B; Wed, 7 Feb 2024 17:59:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707328763; cv=none; b=DyHcAdKbVnFLldBVf+0MtoE1sGE4N8O/IaPCKeacKMGUusKK2qpewEmSYIFXTNECJbqUJuMLPnt8FH6FxURsidL54y6N3FIEConjL8pdYk35QGfVHjBfkIcIQs4NwELLt4LnUpsHSbdkr0Q80LHwa3dwWaK0YHuI5JWLmUjilu8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707328763; c=relaxed/simple; bh=gY2JzDeF5jrwJMCmaKGSaYZDR3/rk8mwy1w2IX+fWds=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rp2+JRlbNEEaTgj2PxYDudUrHFLcf43WF10aev62ndxWtZfjmsyYJ0cMSVqlMaiSdEalx131b92PpmvWBDUuynKpcDnLgvtd4DJt31RR6KUkfAtNZqUyaEg1CNRKeShJwaldoW/jN9bZ9m4XfCpFJeVLzwc2Db2Kp/PREXJZM2Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=hAQGWwPc; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1707328762; x=1738864762; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gY2JzDeF5jrwJMCmaKGSaYZDR3/rk8mwy1w2IX+fWds=; b=hAQGWwPce/F3knbJgkrpM+1aBaOvcVsWOrHp24cc1F9iW2UNacHs3o5K opVvsjAstIjkqh/cZuz+Aroz/4ES7DsAp78ZOcyIfI6ul9O5uFcJ6MGTN jrzsrtIfU2moUTHpqBfEqQ4AN4X5KLOmIIGOakHdje37lv3I/fvEF8/5p WQrz3bfs+mhXQzcRx1tbCN9oqRdSLhW41PlesapGxNK3irVn+oSEbD89l ZjZ8coCqYq7/P/ircZaTWx40uFkPxEhCxc91EQCVqzQnH0dxuOq7PzjmX kaYnd7YDwWoKdsME1EkApPYF11Tvh1EZvsJboupjIYmeP4tbtXl6yrugl A==; X-IronPort-AV: E=McAfee;i="6600,9927,10977"; a="11622679" X-IronPort-AV: E=Sophos;i="6.05,251,1701158400"; d="scan'208";a="11622679" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Feb 2024 09:59:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,251,1701158400"; d="scan'208";a="6020765" Received: from unknown (HELO fred..) ([172.25.112.68]) by fmviesa004.fm.intel.com with ESMTP; 07 Feb 2024 09:58:59 -0800 From: Xin Li To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: seanjc@google.com, pbonzini@redhat.com, corbet@lwn.net, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, shuah@kernel.org, vkuznets@redhat.com, peterz@infradead.org, ravi.v.shankar@intel.com, xin@zytor.com Subject: [PATCH v2 22/25] KVM: x86: Allow FRED/LKGS/WRMSRNS to be exposed to guests Date: Wed, 7 Feb 2024 09:26:42 -0800 Message-ID: <20240207172646.3981-23-xin3.li@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240207172646.3981-1-xin3.li@intel.com> References: <20240207172646.3981-1-xin3.li@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. Signed-off-by: Xin Li Tested-by: Shan Kang --- 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 adba49afb5fe..afc1316d78ad 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -676,8 +676,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(LAM) + F(FZRM) | F(FSRS) | F(FSRC) | F(FRED) | F(LKGS) | + F(WRMSRNS) | F(AMX_FP16) | F(AVX_IFMA) | F(LAM) ); kvm_cpu_cap_init_kvm_defined(CPUID_7_1_EDX, -- 2.43.0