Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1313959rwd; Thu, 8 Jun 2023 16:11:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4GeHChjLst0hVZTs8zH+KtnKLkMVLLZVs+Gi3DMaUPZf0UkEzsXU+02Hz5PyuvqWekjuqY X-Received: by 2002:a05:6a20:1585:b0:10e:de4f:3437 with SMTP id h5-20020a056a20158500b0010ede4f3437mr8913208pzj.39.1686265870248; Thu, 08 Jun 2023 16:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686265870; cv=none; d=google.com; s=arc-20160816; b=llwWlrdDbzavkCaE2gshX39tCoIzaQadKGzBl8sU37gNfII6pKOtjMnXZv7BsAU97L cGlCM0jsUG9LYYe7Wegs2aMpiLZzmf/RoNn7HvZZdnXZUs36nf7xwBk+HqQhwmPI98J+ IAY2s7Gmr943C3Hv80YMPV+h0Cg8JFR+SW2csxsC4/inqcN9e+BsGXDth4LGkxj+cijq 3WMi2gJM75ZYnyrLHZpFRnWfaURQisk4LjVc2XV1TAM7j7l5RNqLeawwbEuF/LEcj6cS v2PBPW1/G6Z1t2WbcgW8cMjl8LMYYgMAs6cAMzMjh7c8xiFy1cR7X1iRhM5nJT+cuvU5 GhqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=k4Y7WiwayXbM3BsktTRl5XMUCYR8lzlMmncKAkkX8tw=; b=vL58hxNUoamlRH94A2JaONZtlnisa3f+GUbHXb7U1/K87ASvVOof7hgSnds7Xz2og7 /kh2OBzH2TuirmrSKVYhxEyGfZMNC63jkzCxOF6H0ephjfG+z+OGFsbD3qjCf3sFnbzE 6Ti0xsWuOfuyLystXZ6PiWJ3QuiiQsNAerlKRYS57n41JtW1WHwRHe5XBFIoGZrg6x37 xxyBY2l7SvT+hG2YbC8/nbWw+Ubh/De+IENNix61KWaLRj1BPhKnwSvDuu61KvaUYsz4 c6BSVSsnIxRo/68NiAgAtfFIwf8ur3Q9dtse6gJOQPLTVl1Atyx/6gzx9vqCFAmjSSFv oHnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SJEVaLgO; 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 d7-20020aa797a7000000b0064d3fb487cbsi1488322pfq.72.2023.06.08.16.10.57; Thu, 08 Jun 2023 16:11:10 -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=SJEVaLgO; 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 S236934AbjFHWw4 (ORCPT + 99 others); Thu, 8 Jun 2023 18:52:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236906AbjFHWwz (ORCPT ); Thu, 8 Jun 2023 18:52:55 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 317932D78; Thu, 8 Jun 2023 15:52:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686264774; x=1717800774; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=21zWUj9vAPSBXRfUhmtCO8AmWkPwEC5zfq8Lbo30rO8=; b=SJEVaLgOQP0Ix4g7gnqGoEU5vuAZAGdWYncSrdAdnNZjXVC8Bjdf7Zzw vxXKp2Ze281ZiqaXgurvl6O5LfKSeZcgI5wkg7TCG6b9s7fFXYJs+yTyO cnY52jYVuYMfxiB7qR74iKkqpDU3bHw9xrgG0+97griZgvSJfnaQ/HIM3 tWdPLdbjyIzRZWEGmj/1r0ENWeTAz/0kWBmkGDmj8tl4oKAWbAPzKQ2cc Sh0ccV/ZgJ5cWIweKSkXEjLVinN87g+rB3FjVp8KOBe38OZS7F2+N/qIV mPdYG6POno6FWWEYFMqCjnH2ymgkmqpXIVEMmYWr3kePXklYQqUmKxMk6 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10735"; a="342129258" X-IronPort-AV: E=Sophos;i="6.00,227,1681196400"; d="scan'208";a="342129258" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2023 15:52:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10735"; a="780071573" X-IronPort-AV: E=Sophos;i="6.00,227,1681196400"; d="scan'208";a="780071573" Received: from fgorter-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.252.59.89]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2023 15:52:48 -0700 Received: by box.shutemov.name (Postfix, from userid 1000) id B87CF104C0F; Fri, 9 Jun 2023 01:52:45 +0300 (+03) Date: Fri, 9 Jun 2023 01:52:45 +0300 From: kirill.shutemov@linux.intel.com To: Kai Huang Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, dave.hansen@intel.com, tony.luck@intel.com, peterz@infradead.org, tglx@linutronix.de, seanjc@google.com, pbonzini@redhat.com, david@redhat.com, dan.j.williams@intel.com, rafael.j.wysocki@intel.com, ying.huang@intel.com, reinette.chatre@intel.com, len.brown@intel.com, ak@linux.intel.com, isaku.yamahata@intel.com, chao.gao@intel.com, sathyanarayanan.kuppuswamy@linux.intel.com, bagasdotme@gmail.com, sagis@google.com, imammedo@redhat.com Subject: Re: [PATCH v11 10/20] x86/virt/tdx: Add placeholder to construct TDMRs to cover all TDX memory regions Message-ID: <20230608225245.rvygi5zkr2niolsj@box> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,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 Mon, Jun 05, 2023 at 02:27:23AM +1200, Kai Huang wrote: > @@ -50,6 +51,8 @@ static DEFINE_MUTEX(tdx_module_lock); > /* All TDX-usable memory regions. Protected by mem_hotplug_lock. */ > static LIST_HEAD(tdx_memlist); > > +static struct tdmr_info_list tdx_tdmr_list; > + > /* > * Wrapper of __seamcall() to convert SEAMCALL leaf function error code > * to kernel error code. @seamcall_ret and @out contain the SEAMCALL The name is misleading. It is not list, it is an array. ... > @@ -112,6 +135,15 @@ struct tdx_memblock { > unsigned long end_pfn; > }; > > +struct tdmr_info_list { > + void *tdmrs; /* Flexible array to hold 'tdmr_info's */ > + int nr_consumed_tdmrs; /* How many 'tdmr_info's are in use */ > + > + /* Metadata for finding target 'tdmr_info' and freeing @tdmrs */ > + int tdmr_sz; /* Size of one 'tdmr_info' */ > + int max_tdmrs; /* How many 'tdmr_info's are allocated */ > +}; > + > struct tdx_module_output; > u64 __seamcall(u64 fn, u64 rcx, u64 rdx, u64 r8, u64 r9, > struct tdx_module_output *out); Otherwise, looks okay. Reviewed-by: Kirill A. Shutemov -- Kiryl Shutsemau / Kirill A. Shutemov