On Wed, Jul 22, 2026 at 04:59:12PM -0300, Jason Gunthorpe wrote:
> On Tue, Jul 21, 2026 at 06:33:21PM +0300, Leon Romanovsky wrote:
> 
> > Something like, but probably void* needs to be phys_addr_t:
> > 
> > static inline struct page *dma_phys_to_page(void *addr)
> > {
> > #ifdef CONFIG_DMA_DIRECT_REMAP
> >     return vmalloc_to_page(addr);
> > #else
> >     return virt_to_page(addr);
> > #endif
> > }
> 
> I don't like this, we don't know for sure the addr will be in a vmap
> and this will fail if it isn't.

Of course we know. The existing "#ifdef CONFIG_DMA_DIRECT_REMAP" is
relevant for addresses acquired from pool.

dma_phys_to_page() is a bad name for some low-level conversion function.
It needs to be internal to DMA logic, in the level when we convert from
phys to page.

Thanks

> 
> Jason
> 

Reply via email to