Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1623932rwe; Fri, 2 Sep 2022 00:27:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR5neKv4rueVMdaElhRe/4ECeVy0Q6Rczken6Lh/do3TJfj57rkNWFeCTETYQ1Fp2JHED33t X-Received: by 2002:a17:906:6a03:b0:730:a20e:cf33 with SMTP id qw3-20020a1709066a0300b00730a20ecf33mr27308426ejc.620.1662103626069; Fri, 02 Sep 2022 00:27:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662103626; cv=none; d=google.com; s=arc-20160816; b=ZLNYeyEW4j6ugwRmCtoy7l2hbOp5C+rY81Jiqn0Y8Do5kU0qguNeyfuHMjy5XQH72p jQzGW6jGDCfn2/3pjvotkdusILNe6RMQImV0XCawruxc5TETVUo7O6ujeCAr8jMR/FN4 XDANLXOSO86KfAJ/zXEAxhLrJjjfVBAFIFoa3ydSJronGCrXhqh/61USKr6f8+gjPyhn xdFFD7fvAwQzMd9Xb79j3BGsLMpcrmcngkb06sV1pkf+XakHP41lwYcfuiqPrt0c6ZJz iz40lJP3eWK7Hub2vqiPxJIRKqqyIt14m3Xe1WmpR34WkYxVTSp7PvSb61ZS+UyGk0NN cPrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=jIf8Kemqo7NBCI/l6b3N+FEBMBD/qpLRR4YjRg0bs+k=; b=A2Y9+F4CdHy8H1h9AaRdQB6+LcYvKccA/wGysuYqwhN+vQYgS/izbW9hJ6CeZjjbCZ lIpbDFOnIbQ+q/27SsijsW9MWlW1DByWNjLJaCTTfoTu2LsEoOd7Hs/ZX5bhxDLchIsz 2+ltlE2jZ8Oj+XSZCusk+HpC+rUlLrVZLSS6zWLgt5p2AxEQIeY5MyYRr0va59AN1xg1 3OYB7cRahno4qWRlBWUAhf95dH+9Q01k/4EUW4LtGcnkwcs7KwaxRDVr7NjCODtxAWmk 7ZBiibdOJniVInSHIke34Qzi9ztCeSnNXc2lvZow94jzz3n4mbcqT2+K4hgTvuNMim9U RWIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Qx/2iA+U"; 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 sd17-20020a1709076e1100b0073da56756b8si1296512ejc.607.2022.09.02.00.26.39; Fri, 02 Sep 2022 00:27:06 -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="Qx/2iA+U"; 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 S235099AbiIBHXj (ORCPT + 99 others); Fri, 2 Sep 2022 03:23:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230317AbiIBHXh (ORCPT ); Fri, 2 Sep 2022 03:23:37 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7CC5B3B3B; Fri, 2 Sep 2022 00:23:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662103416; x=1693639416; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=wZLQ2iSOhVUnOj3UfwaOf+/iZIGe4r2AZ6Zr30yTZJE=; b=Qx/2iA+Uw70R3TKNse3DyqL0GE3oWvxKTJ+QF69qJG+BPJfD507s3kgH uT0q5/uiwF3jxw9fy+XGpWU9XQk6TVP7Ig5j9dmK13entODHdf1zGeLED RDXAqEygddF119wjzqZiD0J3GEzkUJ/4mS+ZNmf7CPsODUZDm0jlNYMcP HfXQA9jflY5HVwiUA15OvkuYE9uLWGtxG2iI34dgAlyHXYdHssl0ezzvG l9kFTQ9Es1M1bZX146mhyWM1t0TLXwI2Dap76Hdfo3heXhachzd3LF91d cZPfRgf9zffMDu9glcj9L0Vn9Z3RMoGJdevQ6qhPJqrUPdEaHuO6K6T0B g==; X-IronPort-AV: E=McAfee;i="6500,9779,10457"; a="296699235" X-IronPort-AV: E=Sophos;i="5.93,283,1654585200"; d="scan'208";a="296699235" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2022 00:23:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,283,1654585200"; d="scan'208";a="674242310" Received: from yy-desk-7060.sh.intel.com (HELO localhost) ([10.239.159.76]) by fmsmga008.fm.intel.com with ESMTP; 02 Sep 2022 00:23:33 -0700 Date: Fri, 2 Sep 2022 15:23:33 +0800 From: Yuan Yao To: isaku.yamahata@intel.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar Subject: Re: [PATCH v8 049/103] KVM: VMX: Move setting of EPT MMU masks to common VT-x code Message-ID: <20220902072333.mz2wk76isdnenqph@yy-desk-7060> References: <9ddd48b7a5458d3e0612af8265f36ca7f3255dc4.1659854790.git.isaku.yamahata@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9ddd48b7a5458d3e0612af8265f36ca7f3255dc4.1659854790.git.isaku.yamahata@intel.com> User-Agent: NeoMutt/20171215 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 On Sun, Aug 07, 2022 at 03:01:34PM -0700, isaku.yamahata@intel.com wrote: > 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. The "VMX/TDX-specific initialization code" is not clear enough, the patch moves the EPT MMU masks initialization AFTER vmx_hardware_setup() and tdx_hardware_setup(), and these 2 hardware_setup functions are ahead of other VMX/TDX initializtion code. I guess we can drop this patch ? > > 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 >