Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2264651iob; Thu, 5 May 2022 21:11:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdGilizsL3D/PUnWVVWoVaYE90bLxh9aCkrrbEngqZJYWbYd/nHrvdTU+veFFvNr2Fj+UV X-Received: by 2002:a17:907:3f8a:b0:6f4:3f00:b1e9 with SMTP id hr10-20020a1709073f8a00b006f43f00b1e9mr1268577ejc.59.1651810278950; Thu, 05 May 2022 21:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651810278; cv=none; d=google.com; s=arc-20160816; b=XYpIyuTDfxYOyDu3rLzR3LWrrorNBP+Qya1cf/gktbRR4YavCNgONoTYTPy0CrPl6k i91HVpdlKqQW5gDbOvENhBUcVDvrKzOHmTqxxnPldBYdDdtu8q4qm+/wZZwaWKQzlsCG 56N91WPsbMGbaYcHCqNyF0pIcQzg5KLkMTJZh7Nh0Pfr7A5hreo9HZfSTF2zpa36mK88 ZQPeqIhYWNqz0Kf96L7iWH7W5sbeilHtCgbUT4BMi+DC9KU7Sr1wtP8ugrmr6Mx8J8ue LnodTY1qAKXg9lG43tb8g3e1pvesHwBhEWbFEGcCRdX20kkayf+2DMxGDYA4AQyNDJdM pTpA== 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=g74j3jYn98YX7PxCJwqxwP05p9K9vqjVc0vsg8ODgSs=; b=iIYcF/IKeKtKm1SxPcPjrTWAeMygdFQvlZn2Hj8lqnFn8QRuOJjuyOq5vGmM09OzM9 s9NSgvsznfV9cUVc/UReV6f2y+Zgc9B2G/SjWu+zSJsvsTaLdfoeBnjmypk6dIiBlwRL yGfg2JNfJ2dtSOhjnNJGxP/tzstbw4EBdvgSnjFcVds1qUqA5+buLsONvvmv+S+qFJGV u6h9TMUmE/fWwDyqYi4JP6rV/H0/POvyxizZPzqcnI4785yz+8ohtNE4dagTE/P8OAoj pTygJLzSn2hMxmO/gKl1jB14rfHP6A+9n3pJJmb+mxW8z8ipQItQ+rRwXOTbojW152C5 yjaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fQWAqhTY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g20-20020a170906869400b006f40efd4b88si3784420ejx.812.2022.05.05.21.10.55; Thu, 05 May 2022 21:11:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fQWAqhTY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384780AbiEES36 (ORCPT + 99 others); Thu, 5 May 2022 14:29:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383115AbiEEST3 (ORCPT ); Thu, 5 May 2022 14:19:29 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A5B0186F1; Thu, 5 May 2022 11:15:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651774548; x=1683310548; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=n0Cp++5LoPFGP8ehZslxep34XcZ0liOLwOyDKsAMJS4=; b=fQWAqhTYAWDStsjAIeYYqIB+YnmfO/h2AoEApCCAdU4qbOL0/FYVFyBh HjTexJrl0lPFZtIUI7WnigDFFgMjlTYuhuRhdeNCEQskdO49Zd7xx/BlA 8PBWaS3p2T79AGEdmbil7zQuS4IDVDGAgkxwJHpMRtut7JBtdY1dWMNIC 1pfdqh/mrcXe+h6TbUi3camLPDW6YJJby7ADkStNTtwz8UrDC03gixgqO laoibi2JkpdoWEX44mSaNkckRmZwdIy/YIHaA6c0+oxzG1mVqGUkM3D+u oUzSPSaLfn/XqKiNksZqLaRmXRypuEYeu2B6+mAnVSBRdI+MfYqGe8Ta5 g==; X-IronPort-AV: E=McAfee;i="6400,9594,10338"; a="293409459" X-IronPort-AV: E=Sophos;i="5.91,202,1647327600"; d="scan'208";a="293409459" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 11:15:48 -0700 X-IronPort-AV: E=Sophos;i="5.91,202,1647327600"; d="scan'208";a="665083325" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 11:15:47 -0700 From: isaku.yamahata@intel.com To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar Subject: [RFC PATCH v6 052/104] KVM: VMX: Move setting of EPT MMU masks to common VT-x code Date: Thu, 5 May 2022 11:14:46 -0700 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean Christopherson EPT MMU masks are used commonly for VMX and TDX. The value needs to be initialized in common code before both VMX/TDX-specific initialization code. Signed-off-by: Sean Christopherson Signed-off-by: Isaku Yamahata --- arch/x86/kvm/vmx/main.c | 5 +++++ arch/x86/kvm/vmx/vmx.c | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c index ce12cc8276ef..9f4c3a0bcc12 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -4,6 +4,7 @@ #include "x86_ops.h" #include "vmx.h" #include "nested.h" +#include "mmu.h" #include "pmu.h" #include "tdx.h" @@ -26,6 +27,10 @@ static __init int vt_hardware_setup(void) enable_tdx = enable_tdx && !tdx_hardware_setup(&vt_x86_ops); + if (enable_ept) + kvm_mmu_set_ept_masks(enable_ept_ad_bits, + cpu_has_vmx_ept_execute_only()); + return 0; } diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 1a2e8d195891..df78e2220fec 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -8021,10 +8021,6 @@ __init int vmx_hardware_setup(void) set_bit(0, vmx_vpid_bitmap); /* 0 is reserved for host */ - if (enable_ept) - kvm_mmu_set_ept_masks(enable_ept_ad_bits, - cpu_has_vmx_ept_execute_only()); - /* * Setup shadow_me_value/shadow_me_mask to include MKTME KeyID * bits to shadow_zero_check. -- 2.25.1