Re: [PATCH v11 10/20] x86/virt/tdx: Add placeholder to construct TDMRs to cover all TDX memory regions

From: kirill . shutemov
Date: Thu Jun 08 2023 - 18:52:58 EST


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 <kirill.shutemov@xxxxxxxxxxxxxxx>

--
Kiryl Shutsemau / Kirill A. Shutemov