Re: [PATCH v2 3/7] iommu: Make iommu_dma_prepare_msi() into a generic operation

From: Jason Gunthorpe
Date: Thu Feb 27 2025 - 14:48:05 EST


On Thu, Feb 27, 2025 at 09:46:55AM -0800, Nicolin Chen wrote:
> I found a bit confusing to use "owner" as the domain->owner isn't
> the same thing in this context. Maybe it should be "driver_ops"?

Maybe, but I wouldn't churn it

> Then, "owner" could be another op structure that holds the owner-
> specific things, such as:
> enum iommu_domain_owner { DMA/VFIO/IOMMUFD}; // or flag?

I was thinking about breaking type into something like this:

u32 private_data_owner:2 // DMA/IOMMUFD/None
u32 translation_type:3 // paging/identity/sva/platform/blocked/nested
u32 dma_fq:1 // true/false
u32 dma_api_domain:1 // true/false

Which is close to how it already is with just some breaking up of the
bits differently.. Get rid of the word unmanaged and drop the
IOMMU_DOMAIN_* defines.

I also wanted to separate the "policy" enum that determines which of
the three default domains you get from the type. Lots of type
combinations are not allowed as policy.

Jason