Re: [PATCH v3 09/23] iommu/pages: Formalize the freelist API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 26, 2025 at 02:56:29PM +0800, Baolu Lu wrote:
> On 2/26/25 03:39, Jason Gunthorpe wrote:
> > diff --git a/include/linux/iommu.h b/include/linux/iommu.h
> > index 38c65e92ecd091..e414951c0af83f 100644
> > --- a/include/linux/iommu.h
> > +++ b/include/linux/iommu.h
> > @@ -326,6 +326,18 @@ typedef unsigned int ioasid_t;
> >   /* Read but do not clear any dirty bits */
> >   #define IOMMU_DIRTY_NO_CLEAR (1 << 0)
> > +/*
> > + * Pages allocated through iommu_alloc_pages_node() can be placed on this list
> > + * using iommu_pages_list_add(). Note: ONLY pages from iommu_alloc_pages_node()
> > + * can be used this way!
> > + */
> > +struct iommu_pages_list {
> > +	struct list_head pages;
> > +};
> > +
> > +#define IOMMU_PAGES_LIST_INIT(name) \
> > +	((struct iommu_pages_list){ .pages = LIST_HEAD_INIT(name.pages) })
> > +
> >   #ifdef CONFIG_IOMMU_API
> 
> Any reason why the above cannot be placed in the iommu-pages.h header
> file? My understanding is that iommu-pages is only for the iommu drivers
> and should not be accessible for external subsystems.

I wanted to do that, but the issue is the gather:

struct iommu_iotlb_gather {
	unsigned long		start;
	unsigned long		end;
	size_t			pgsize;
	struct iommu_pages_list	freelist;

The struct is inlined so it must be declared. I do not want to include
iommu-pages.h in this header.

Once the struct itself is there it made sense to include the INIT too.

FWIW I have a longstanding desire to split iommu.h into
internal-driver-facing and external-user-facing files..

Thanks,
Jason




[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux