On Fri, Nov 08, 2024 at 11:25:37AM -0400, Jason Gunthorpe wrote: > I'm asking how it will work if you change the struct page argument to > physical, because today dma_direct_map_page() has: > > if (is_pci_p2pdma_page(page)) > return DMA_MAPPING_ERROR; > > Which is exactly the sorts of things I'm looking at when when I say to > get rid of struct page. It will have to look up the page from the physical address obviously. But at least only in the error path. > What I'm thinking about is replacing code like the above with something like: > > if (p2p_provider) > return DMA_MAPPING_ERROR; > > And the caller is the one that would have done is_pci_p2pdma_page() > and either passes p2p_provider=NULL or page->pgmap->p2p_provider. And where do you get that one from?