Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4370949rwb; Sun, 7 Aug 2022 22:48:15 -0700 (PDT) X-Google-Smtp-Source: AA6agR4w/rxO1x2TLeyrAQeA1fDW8w8UaQ5AapDKe1P6jg6qzq04d3HHIKESXJvOOwDv4HRyleqH X-Received: by 2002:a05:6402:13c1:b0:43b:e330:9bbf with SMTP id a1-20020a05640213c100b0043be3309bbfmr16193374edx.417.1659937695170; Sun, 07 Aug 2022 22:48:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659937695; cv=none; d=google.com; s=arc-20160816; b=o7oNDUy+sJFfA2mRyPcuiq8jp9S6FtdeO4Oa2QKeyk8qawMzzFx42rUoVNLsK8nYax uTu8BUvfllzjOl4gN7wNIUWKCV2sy157l7GSFYU7FiFhT+44QKL7rE8C54hkxJxwFnwL IWjyrsDoEokFYCJBh4H2WhnaLGID5FZvxUzQ4AWwUCq0s+85aZMV+sbMgAx0hdaeJ+mS QKpxguARL/B8qx+vp+l0IQmlhmuhBskeNz+CqoUc3jQaMbw25w9+jHh0LkxACCOXmfWz HxSromzxU8lbqkoV7jIXQxg8o8KYL2Mn1J681Jjf8DCSRuqKxW1JbGbMSro5vTWnCEcf 8S8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=1EPoFAJQMp3j5QzWRXXcgc2NMhUqoxdBS2t/p/LuriU=; b=AJUjXKQJdAE10Ge0/jIb8YgfH17L++WI3PFnXHPIVB43e7RUBP/weFbJagla08D1hy ZQUKdGqrC1ImmA0kHy4bu5kTGtEXh4pPCgjyiH9dEyf5YNwUDAiOlq+pXccR53g9NAJc 1dG8gnr8ibaMxYnrSEHN0YrlD9nsIsXpvJkneIBb6BWjveFv6ARVFKawX+Hn8urpJ93R SpyPf0Kp6nNbjEx+4a6kZ7l+sjPJW8MQKnA6EsoL91RKZz8ubFVWHQ+6555uuljPqT99 LDIAqCz2Dd0Ep0cE4pZNeL7bvHOGFzsz/mIgdBB9WAqg60at4O0RrTQkDmVsVevP60qT JkMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="TyPWU/yY"; 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 ds10-20020a170907724a00b00730a07ef039si9473355ejc.423.2022.08.07.22.47.50; Sun, 07 Aug 2022 22:48:15 -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="TyPWU/yY"; 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 S235329AbiHHFlD (ORCPT + 99 others); Mon, 8 Aug 2022 01:41:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230461AbiHHFlA (ORCPT ); Mon, 8 Aug 2022 01:41:00 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE3D62EA; Sun, 7 Aug 2022 22:40:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659937259; x=1691473259; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=akNgTm7cdedf1F6vbkF2TOqzk+nLQRL0d/XpdejauUo=; b=TyPWU/yY2ME3ZgNQnXi2VhG3m44N0IMbaU8OjQajVxRkCMO0Op/cXWhQ eli/R4nZYOzFOVOQvXFt//aYBebvQKKXwrIYa0HIn9TRR+ioFFuy0AMKh dHmALN42kCak3d65exqLKVVUtqIKu/x/rtpDA8iyU3+1V1uRj/kZDtSkx sUYaXzAQ1KVX+KLEJfrzWs7Gx6tI1GFymoQBLvRnyYCvpYOBKDFsV2fV9 Q+fdx+kZUku2nHxnaqGrUPcZRpA4VVcQ3uV6MKeymcpGec2PlVAcCg1oG FTPSZoUhS2UM/ggjhApcOa+R1dZ8Mwd/SD/AobCrup4RxeRJTIbQqpDYP A==; X-IronPort-AV: E=McAfee;i="6400,9594,10432"; a="291283923" X-IronPort-AV: E=Sophos;i="5.93,221,1654585200"; d="scan'208";a="291283923" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Aug 2022 22:40:59 -0700 X-IronPort-AV: E=Sophos;i="5.93,221,1654585200"; d="scan'208";a="632744483" Received: from xiaoyaol-hp-g830.ccr.corp.intel.com (HELO [10.249.175.11]) ([10.249.175.11]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Aug 2022 22:40:57 -0700 Message-ID: Date: Mon, 8 Aug 2022 13:40:53 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.11.0 Subject: Re: [RFC PATCH 13/13] KVM: x86: remove struct kvm_arch.tdp_max_page_level Content-Language: en-US To: isaku.yamahata@intel.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar References: <1469a0a4aabcaf51f67ed4b4e25155267e07bfd1.1659854957.git.isaku.yamahata@intel.com> From: Xiaoyao Li In-Reply-To: <1469a0a4aabcaf51f67ed4b4e25155267e07bfd1.1659854957.git.isaku.yamahata@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,HK_RANDOM_ENVFROM, HK_RANDOM_FROM,NICE_REPLY_A,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 8/8/2022 6:18 AM, isaku.yamahata@intel.com wrote: > From: Xiaoyao Li > > Now that everything is there to support large page for TD guest. Remove > tdp_max_page_level from struct kvm_arch that limits the page size. Isaku, we cannot do this to remove tdp_max_page_level. Instead, we need assign it as PG_LEVEL_2M, because TDX currently only supports AUG'ing a 4K/2M page, 1G is not supported yet. > Signed-off-by: Xiaoyao Li > Signed-off-by: Isaku Yamahata > --- > arch/x86/include/asm/kvm_host.h | 1 - > arch/x86/kvm/mmu/mmu.c | 1 - > arch/x86/kvm/mmu/mmu_internal.h | 2 +- > arch/x86/kvm/vmx/tdx.c | 3 --- > 4 files changed, 1 insertion(+), 6 deletions(-) > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > index a6bfcabcbbd7..80f2bc3fbf0c 100644 > --- a/arch/x86/include/asm/kvm_host.h > +++ b/arch/x86/include/asm/kvm_host.h > @@ -1190,7 +1190,6 @@ struct kvm_arch { > unsigned long n_requested_mmu_pages; > unsigned long n_max_mmu_pages; > unsigned int indirect_shadow_pages; > - int tdp_max_page_level; > u8 mmu_valid_gen; > struct hlist_head mmu_page_hash[KVM_NUM_MMU_PAGES]; > struct list_head active_mmu_pages; > diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c > index ba21503fa46f..0cbd52c476d7 100644 > --- a/arch/x86/kvm/mmu/mmu.c > +++ b/arch/x86/kvm/mmu/mmu.c > @@ -6232,7 +6232,6 @@ int kvm_mmu_init_vm(struct kvm *kvm) > kvm->arch.split_desc_cache.kmem_cache = pte_list_desc_cache; > kvm->arch.split_desc_cache.gfp_zero = __GFP_ZERO; > > - kvm->arch.tdp_max_page_level = KVM_MAX_HUGEPAGE_LEVEL; > return 0; > } > > diff --git a/arch/x86/kvm/mmu/mmu_internal.h b/arch/x86/kvm/mmu/mmu_internal.h > index e5d5fea29bfa..82b220c4d1bd 100644 > --- a/arch/x86/kvm/mmu/mmu_internal.h > +++ b/arch/x86/kvm/mmu/mmu_internal.h > @@ -395,7 +395,7 @@ static inline int kvm_mmu_do_page_fault(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, > is_nx_huge_page_enabled(vcpu->kvm), > .is_private = kvm_is_private_gpa(vcpu->kvm, cr2_or_gpa), > > - .max_level = vcpu->kvm->arch.tdp_max_page_level, > + .max_level = KVM_MAX_HUGEPAGE_LEVEL, > .req_level = PG_LEVEL_4K, > .goal_level = PG_LEVEL_4K, > }; > diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c > index a340caeb9c62..72f21f5f78af 100644 > --- a/arch/x86/kvm/vmx/tdx.c > +++ b/arch/x86/kvm/vmx/tdx.c > @@ -460,9 +460,6 @@ int tdx_vm_init(struct kvm *kvm) > */ > kvm_mmu_set_mmio_spte_mask(kvm, 0, VMX_EPT_RWX_MASK); > > - /* TODO: Enable 2mb and 1gb large page support. */ > - kvm->arch.tdp_max_page_level = PG_LEVEL_4K; > - > /* vCPUs can't be created until after KVM_TDX_INIT_VM. */ > kvm->max_vcpus = 0; >