Re: [PATCH 0/6] rust: page: Support borrowing `struct page` and physaddr conversion
From: Matthew Wilcox
Date: Wed Feb 05 2025 - 18:17:42 EST
On Tue, Feb 04, 2025 at 04:49:47PM -0400, Jason Gunthorpe wrote:
> The phys_to_virt() I mean is on the page table pages themselves, not
> on a leaf.
>
> All page table pages came from alloc_pages_node() and you'd do
> virt_to_phys() to stick them into a next-table PTE, then
> phys_to_virt() to bring them back:
>
> phys_to_virt(virt_to_phys(page_address(alloc_pages_node())))
>
> Effectively.
except for s390 & ppc where the page table can be smaller than
PAGE_SIZE, so you really only have a physical address that can be
converted to a virtual address.