On Thu, Mar 12, 2026 at 09:20:58AM -0300, Jason Gunthorpe wrote:
> On Wed, Mar 11, 2026 at 09:08:48PM +0200, Leon Romanovsky wrote:
> > From: Leon Romanovsky <[email protected]>
> > 
> > DMA_ATTR_REQUIRE_COHERENT indicates that SWIOTLB must not be used.
> > Ensure the SWIOTLB path is declined whenever the DMA direct path is
> > selected.
> > 
> > Signed-off-by: Leon Romanovsky <[email protected]>
> > ---
> >  kernel/dma/direct.h | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/kernel/dma/direct.h b/kernel/dma/direct.h
> > index e89f175e9c2d0..6184ff303f080 100644
> > --- a/kernel/dma/direct.h
> > +++ b/kernel/dma/direct.h
> > @@ -84,7 +84,7 @@ static inline dma_addr_t dma_direct_map_phys(struct 
> > device *dev,
> >     dma_addr_t dma_addr;
> >  
> >     if (is_swiotlb_force_bounce(dev)) {
> > -           if (attrs & DMA_ATTR_MMIO)
> > +           if (attrs & (DMA_ATTR_MMIO | DMA_ATTR_REQUIRE_COHERENT))
> >                     return DMA_MAPPING_ERROR;
> >  
> >             return swiotlb_map(dev, phys, size, dir, attrs);
> 
> Oh here it is, still maybe it is better to put it in swiotlb_map() ?

It is better do not call function which is not going to work. We have
same flow for DMA_ATTR_REQUIRE_COHERENT and DMA_ATTR_MMIO, which both
don't work with SWIOTLB.

Thanks

> 
> Jason
> 

Reply via email to