Re: [PATCH v2 10/31] x86/virt/tdx: Add extra memory to TDX Module for Extensions

Xu Yilun
2026-04-08T07:49:47Z

> > @@ -643,7 +643,7 @@ EXPORT_SYMBOL_GPL(tdx_page_array_create_iommu_mt);
> > #define HPA_LIST_INFO_PFN GENMASK_U64(51, 12)
> > #define HPA_LIST_INFO_LAST_ENTRY GENMASK_U64(63, 55)
> > -static u64 __maybe_unused hpa_list_info_assign_raw(struct tdx_page_array *array)
> > +static u64 hpa_list_info_assign_raw(struct tdx_page_array *array)
> > {
> > return FIELD_PREP(HPA_LIST_INFO_FIRST_ENTRY, 0) |
> > FIELD_PREP(HPA_LIST_INFO_PFN,
> > @@ -1513,6 +1513,94 @@ static void tdx_clflush_page(struct page *page)
> > clflush_cache_range(page_to_virt(page), PAGE_SIZE);
> > }
> > +static void tdx_clflush_page_array(struct tdx_page_array *array)
> > +{
> > + for (int i = 0; i < array->nents; i++)
>
> shouldn't the actual number of entries be adjusted as per offset, similarly
> to how 'nents' in tdx_page_array_validate_release is calculated?

Actually array->nents is calculated the same way:

static int tdx_page_array_populate(struct tdx_page_array *array,
unsigned int offset)
{
...

array->offset = offset;
array->nents = umin(array->nr_pages - offset,
TDX_PAGE_ARRAY_MAX_NENTS);
...
}

so IIUC we are good here.