Re: [PATCH v7 1/3] iommufd: Add data structure for Intel VT-d stage-1 cache invalidation

From: Jason Gunthorpe
Date: Wed Jan 03 2024 - 19:02:21 EST


On Wed, Jan 03, 2024 at 12:18:35PM -0800, Nicolin Chen wrote:
> > The driver would have to create it and there would be some driver
> > specific enclosing struct to go with it
> >
> > Perhaps device_ids goes in the driver specific struct, I don't know.
>
> +struct iommufd_viommu {
> + struct iommufd_object obj;
> + struct iommufd_ctx *ictx;
> + struct iommu_device *iommu_dev;
> + struct iommufd_hwpt_paging *hwpt; /* maybe unneeded */
> +
> + int vmid;
> +
> + union iommu_driver_user_data {
> + struct iommu_driver_user_vtd;
> + struct iommu_driver_user_arm_smmuv3;
> + struct iommu_driver_user_amd_viommu;
> + };

Not like that, in the usual container_of way

Jason