Re: [PATCH] iommu: Sort out domain user data

From: Robin Murphy
Date: Mon Mar 03 2025 - 13:01:15 EST


On 03/03/2025 5:27 pm, Jason Gunthorpe wrote:
On Fri, Feb 28, 2025 at 12:20:53PM -0800, Nicolin Chen wrote:
On Fri, Feb 28, 2025 at 11:31:11AM +0000, Robin Murphy wrote:
+enum iommu_domain_cookie_type {
+ IOMMU_NO_COOKIE,
+ IOMMU_DMA_IOVA_COOKIE,
+ IOMMU_DMA_MSI_COOKIE,
+ IOMMU_FAULT_HANDLER_COOKIE,
+ IOMMU_SVA_COOKIE,

I would like to change them to IOMMU_COOKIE_* so the iommufd one
wouldn't feel redundant like "IOMMU_IOMMUFD_COOKIE".

Heh, I guess strictly it might just be IOMMUFD_COOKIE, since what I've really done here is messily overlap a new IOMMU_x namespace with the original IOMMU_DMA_x one... :)

If you don't mind, I will make the following list:
- IOMMU_NO_COOKIE,
- IOMMU_DMA_IOVA_COOKIE,
- IOMMU_DMA_MSI_COOKIE,
- IOMMU_FAULT_HANDLER_COOKIE,
- IOMMU_SVA_COOKIE,
+ IOMMU_COOKIE_NONE,
+ IOMMU_COOKIE_DMA_IOVA,
+ IOMMU_COOKIE_DMA_MSI,
+ IOMMU_COOKIE_FAULT_HANDLER,
+ IOMMU_COOKIE_SVA,
+ IOMMU_COOKIE_IOMMUFD,

I like that better too

...but yeah, no objection to going this way for consistency - splitting into IOMMU_x_DMA does seem more logical and understandable than the other alternative of having one weird IOMMU_FD_x symbol.

Thanks,
Robin.