From patchwork Sun Mar 19 08:49:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binbin Wu X-Patchwork-Id: 13180275 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86E58C7618A for ; Sun, 19 Mar 2023 08:50:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230249AbjCSIuP (ORCPT ); Sun, 19 Mar 2023 04:50:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230335AbjCSIt6 (ORCPT ); Sun, 19 Mar 2023 04:49:58 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43011E1AF for ; Sun, 19 Mar 2023 01:49:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679215795; x=1710751795; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zjfiq805HsblC/KH/UQG7FEhBjf125By5Er7e8elbeA=; b=GWx5iWji2MXKEO/fmZ8Ox89m1f22Ipj+ofCNLi7VNx8lRtUERvaU5sdU HfVl/4/Ajqkcnf8ncXiIm6W+qTnmfGNg9/pDlLv29Pc6IXYDH6BRG9D62 wMNsd1P/fUR71NdUHoGaZr26QZjnwjhMFMADDG2aSRYP/QK41kbkBG2Qh fqn1JwHs/IBXqclryDe7aI9GMMSX6aFXu56MANIKz8J5YvRpMcEIISyvf HxCpO28KO3GzvTCPRbcvth4RPROWRtfkMGBPw4iXlLG4zdPkU+A2MbkJh meuEf7jVMe5zt1S5LmWHt18sM3GFqWV8Ey+ihDYZdvQ3AFk6GTMA5MWAZ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10653"; a="424767890" X-IronPort-AV: E=Sophos;i="5.98,273,1673942400"; d="scan'208";a="424767890" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Mar 2023 01:49:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10653"; a="683146397" X-IronPort-AV: E=Sophos;i="5.98,273,1673942400"; d="scan'208";a="683146397" Received: from binbinwu-mobl.ccr.corp.intel.com ([10.254.209.111]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Mar 2023 01:49:52 -0700 From: Binbin Wu To: kvm@vger.kernel.org, seanjc@google.com, pbonzini@redhat.com Cc: chao.gao@intel.com, robert.hu@linux.intel.com, binbin.wu@linux.intel.com, Jingqi Liu Subject: [PATCH v6 7/7] KVM: x86: Expose LAM feature to userspace VMM Date: Sun, 19 Mar 2023 16:49:27 +0800 Message-Id: <20230319084927.29607-8-binbin.wu@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230319084927.29607-1-binbin.wu@linux.intel.com> References: <20230319084927.29607-1-binbin.wu@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org From: Robert Hoo LAM feature is enumerated by CPUID.7.1:EAX.LAM[bit 26]. Expose the feature to guest as the final step after the following supports: - CR4.LAM_SUP virtualization - CR3.LAM_U48 and CR3.LAM_U57 virtualization - Check and untag 64-bit linear address when LAM applies in instruction emulations and vmexit handlers. Signed-off-by: Robert Hoo Signed-off-by: Binbin Wu Reviewed-by: Jingqi Liu Reviewed-by: Chao Gao --- arch/x86/kvm/cpuid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 8f8edeaf8177..13840ef897c7 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -670,7 +670,7 @@ 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(AMX_FP16) | F(AVX_IFMA) | F(LAM) ); kvm_cpu_cap_init_kvm_defined(CPUID_7_1_EDX,