On Fri, 2025-05-02 at 16:08 +0300, Kirill A. Shutemov wrote: > > +static struct page *tdx_alloc_page(void) > +{ > + struct page *page; > + > + page = alloc_page(GFP_KERNEL); > + if (!page) > + return NULL; > + > + if (tdx_pamt_get(page)) { > + __free_page(page); > + return NULL; > + } > + > + return page; > +} > + > +static void tdx_free_page(struct page *page) > +{ > + if (!page) > + return; > + > + tdx_pamt_put(page); > + __free_page(page); > +} > + IMO the two should be moved to the TDX core code, and exported for KVM to use. They can be used for other kernel components for TDX Connect.