Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3400861iog; Mon, 27 Jun 2022 15:31:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sy9U4txlyTJW4hXb4CB2gyv8CLOkVyxlHjVCRksq74M+dlQ0ykb9fCNAo4jeG893dVtvLL X-Received: by 2002:a05:6402:d05:b0:435:b2a6:94eb with SMTP id eb5-20020a0564020d0500b00435b2a694ebmr18929066edb.87.1656369106399; Mon, 27 Jun 2022 15:31:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656369106; cv=none; d=google.com; s=arc-20160816; b=xAIl9Pc8kZuHVGlYN1OuJ7WnXckKsSwczXPnDlTL3oKiTjPbz4eUmeF1aTIz4Y2e8p N9jVa/kQF+rMP0XbwS6eMFYqJmkDctU13nd7ye6/h0qkmwTgIuom5ibny5oYghWuGRf1 MaXEZMUwxCDJC3K+ynA73U37EqYB2UwgMoRwqEnuncX6fQD0cPkr/SWH5H4Z1rONcl5h YeTfXGZoyzcO5g1JQl3p88UGYhBaydzRKXfKBrRmFkkB5qEYjRYCpe3g+NQltXLOpT5I o+Y9loDs4dymQ0UuqCrkSJbylzsKRpMv30uo/kHGB99q/xD0BoK9guUzHxIgCWzfyRzL KLAw== 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=RmPOnff4kd8HUM7ghvVeu6A9fQtoTsspXW94zcHMmck=; b=Jfi4C3mJx5y575m9omF/jCRf4pGSwa3oTqJFgmz8JNByvCeEB8IN838QkLtmFqbgEi GRvlNZuEj2f/2WyD14gXpkwmJ/4zUdAbmFY2qPv5NpYSciF6B+hT6oNQmCHu6CGJR+Pt BWQnVq/J39iczY9a7vfjEEozv6F5YTfdnVG/PQONVHwdbAVAgRPMM2pTLACAXLtOUqeZ vjyBuT6usEYIY4T7SUNw4/xkbjR4qU3AL/SO3A5d5AezMhYog0OpLag6VpQogXAqT1PH +wq08rfUo8U7JR48Ho+th40bbYH01z1xbOl2cvcBGyMaEEz9yOQpSfbfHqh8GdHU2oD6 Ve3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dLIam9CN; 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 v25-20020a50d599000000b0043565b4bda3si13531576edi.521.2022.06.27.15.31.20; Mon, 27 Jun 2022 15:31:46 -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=dLIam9CN; 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 S242268AbiF0WAQ (ORCPT + 99 others); Mon, 27 Jun 2022 18:00:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241369AbiF0Vza (ORCPT ); Mon, 27 Jun 2022 17:55:30 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FCCA765D; Mon, 27 Jun 2022 14:55:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656366901; x=1687902901; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C5qnexNPI65FMQzXiabhoNYeDhLbZoID6UTYoyLFD0w=; b=dLIam9CNo++Y2QfHyWqoPekbRodQI+mweoMw8/J/I8+ffj2/5ux4hIrU f6qCt9soPgx7EQTjurZrmUcwLfgn1/UA+AYy29D8D9NAQeVh91llh3t9W HIcJZvNPXYp19y1OdqMSArVQrZcOxAqAnV4Fzf9u7gjC1qdhuGCZa+fZA L87oI9cYz9jM3ah9QBXQUqNDh+kw8iO47DW0ogyH3wcnBgegxV272Ver0 UlMjw/RfjmTPPOEEiVTp31Qre6JVS2cHlcrmeeTRzCF5XOyLuWt9L8Bt/ 5H2WgyV0fR6oflP1AtLILJy0ImEY16sciGXaXgdZFlIf2rrTZYNl+Xgt+ A==; X-IronPort-AV: E=McAfee;i="6400,9594,10391"; a="281609577" X-IronPort-AV: E=Sophos;i="5.92,227,1650956400"; d="scan'208";a="281609577" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 14:54:55 -0700 X-IronPort-AV: E=Sophos;i="5.92,227,1650956400"; d="scan'208";a="657863601" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 14:54:55 -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 , Sean Christopherson Subject: [PATCH v7 051/102] KVM: VMX: Move setting of EPT MMU masks to common VT-x code Date: Mon, 27 Jun 2022 14:53:43 -0700 Message-Id: <28893d81287bb7ca7367b8b7e16c2c9bf911abce.1656366338.git.isaku.yamahata@intel.com> 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.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 2f1dc06aec3c..3f231159fe3d 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -8139,10 +8139,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