Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4119504rwb; Sun, 7 Aug 2022 15:36:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR4h2v7Oebk2GfGNZgqBf2wThtGrk4BL+zwEJtvYZgOtPuYiNhGqj2eCcIdDhj9ShTOZXcH6 X-Received: by 2002:a17:902:d64a:b0:16c:2755:428d with SMTP id y10-20020a170902d64a00b0016c2755428dmr16351744plh.79.1659911779040; Sun, 07 Aug 2022 15:36:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659911779; cv=none; d=google.com; s=arc-20160816; b=ebnP4gz968FyvyiOuoalRbbGNhbqu+8asb9xbdIrCvrpV6D5oWwKmN0YjtoilkN4/I jx6xNEqaFVUR5PFP72YhmKC8PkXCnLbWAa1VPSTJ0RvhlJeNtcWAyYMMv0nbHRyZXPAE Vi9wjx1P3oqrq+Msc/K0gKG6ubqJKaZP6S/4kkQ/BcDXl/Vqebx818dj/dhK9xlDOm/2 e+i2SdM3RuyUU28cfqyWAlmzQKHUydOyWGktbC68yb3CmuwjYKx9mSiGoi2b/6VcVHJD qlQ3qcUJDxyDkKX7BCbPlGXwvmMeSQt33z10ZFsMEH+UshO5a6AerRfsdnsh0XuuYgk5 C0rg== 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=kHM9z7t9aBzGXnqGQtG2m3qZI3KvoKZCeLgOt+AvEOM=; b=xwFiDay48vmlnWvOUvlkUWFrRcqInNdZcGykYosLy3s0zqyDFJBc0CFjfl2K2oQEkf +ZS95NYYSD9xXofWGfXEAcT0C4DeBqGs61UsYUnnXO9rL6Tf8z8AU+9aMKQ2O3bNuH6j Dbha+ANnhAgXDZWF8tmcI63QmpHH8wAJarrBjEQQ5mVV7VhMs++02jAxHflJBKXTNSga /iWL2rmYR0Fi3S2WsAkl8s1ljbCVGLybzClSK2CXpAAx7LpGWimAkD70edx8mZpFDf6r gWZeU/Myb6f57ixWKSUL9Du90ed5Xj1rPd4in95HEm/dVFp1EKuetGzRZY/8JoLUpLXP BFZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TuDFSAps; 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 a27-20020a630b5b000000b00415c14120fasi9111584pgl.34.2022.08.07.15.36.04; Sun, 07 Aug 2022 15:36:19 -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=TuDFSAps; 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 S242498AbiHGWLR (ORCPT + 99 others); Sun, 7 Aug 2022 18:11:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241893AbiHGWHY (ORCPT ); Sun, 7 Aug 2022 18:07:24 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51AD895B3; Sun, 7 Aug 2022 15:03:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659909802; x=1691445802; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BGE1IqqoIT2HSZ4X/S376ezqsadEg+k+xZKmYNmSrwQ=; b=TuDFSAps+lpJcpLeHgFQYxN2L7OLjePOyB/7sbe3TFfmiIGcQEMaN+1z 7zaymMMQxK5ApPKNvMsAyJldok1RGoZ/GiaQONVFPsGXJEEXz+ky0gq/d 9OX7DHwnho5uhmztJpEvo6mYRZuYuXFmoudQ+f12pSdR5wKayQvzd9KFR xuTIxkxHqT1XZFURLJbF9mTLcJTG4KspTUwKEuBuE4JZeKGxlkdw+brcy QbgxjrRvOS+CjsAlQvNwxkIjJyYAVXosCNjTJlZnA22hsmWPNcQc38SOv TppgC4ex2xr4loDj6M1fjJGP8Gv0lJmwYyVi7ir3h42XiSSACaCSDhTEW g==; X-IronPort-AV: E=McAfee;i="6400,9594,10432"; a="289224146" X-IronPort-AV: E=Sophos;i="5.93,220,1654585200"; d="scan'208";a="289224146" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Aug 2022 15:02:36 -0700 X-IronPort-AV: E=Sophos;i="5.93,220,1654585200"; d="scan'208";a="663682603" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Aug 2022 15:02:36 -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: [PATCH v8 049/103] KVM: VMX: Move setting of EPT MMU masks to common VT-x code Date: Sun, 7 Aug 2022 15:01:34 -0700 Message-Id: <9ddd48b7a5458d3e0612af8265f36ca7f3255dc4.1659854790.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=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 3af8cd164274..db33c2808e0e 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -8209,10 +8209,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