On Wed, Oct 16, 2024 at 12:44:28PM -0300, Jason Gunthorpe wrote: > > We are talking about P2P memory here. How do you manage to get a page > > that dma_map_page can be used on? All P2P memory needs to use the P2P > > aware dma_map_sg as the pages for P2P memory are just fake zone device > > pages. > > FWIW, I've been expecting this series to be rebased on top of Leon's > new DMA API series so it doesn't have this issue.. That's not going to make a difference at this level. > I'm guessing they got their testing done so far on a system without an > iommu translation? IOMMU or not doens't matter much for P2P. The important difference is through the host bridge or through a switch. dma_map_page will work for P2P through the host brige (assuming the host bridge even support it as it also lacks the error handling for when not), but it lacks the handling for P2P through a switch. > > > which also makes it clear that returning a page from the method is > > not that great, a PFN might work a lot better, e.g. > > > > unsigned long (*device_private_dma_pfn)(struct page *page); > > Ideally I think we should not have the struct page * at all through > these APIs if we can avoid it.. The input page is the device private page that we have at hand anyway. Until that scheme is complete redone it is the right kind of parameter.