On Sat, May 27, 2023 at 12:36:30AM +0800, Jisheng Zhang wrote: > On Wed, May 24, 2023 at 06:19:02PM +0100, Catalin Marinas wrote: > > diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h > > index 87aaf8b5cdb4..330a157c5501 100644 > > --- a/include/linux/scatterlist.h > > +++ b/include/linux/scatterlist.h > > @@ -248,6 +248,29 @@ static inline void sg_unmark_end(struct scatterlist *sg) > > sg->page_link &= ~SG_END; > > } > > > > +#define SG_DMA_BUS_ADDRESS (1 << 0) > > +#define SG_DMA_USE_SWIOTLB (1 << 1) > > + > > +#ifdef CONFIG_SWIOTLB > > s/CONFIG_SWIOTLB/CONFIG_NEED_SG_DMA_FLAGS ? > Otherwise, there's compiler error if SWIOTLB=y but IOMMU=n Yes, I pushed a fixup to the kmalloc-minalign branch. > > +static inline bool sg_is_dma_use_swiotlb(struct scatterlist *sg) > > +{ > > + return sg->dma_flags & SG_DMA_USE_SWIOTLB; > > +} > > + > > +static inline void sg_dma_mark_use_swiotlb(struct scatterlist *sg) > > +{ > > + sg->dma_flags |= SG_DMA_USE_SWIOTLB; > > +} > > +#else > > +static inline bool sg_is_dma_use_swiotlb(struct scatterlist *sg) > > +{ > > + return false; > > +} > > +static inline void sg_dma_mark_use_swiotlb(struct scatterlist *sg) > > +{ > > +} > > +#endif And I wonder whether we should keep these accessors in the scatterlist.h file. They are only used by the dma-iommu.c code. -- Catalin