Messages in this thread |  | | Date | Sun, 12 May 2024 22:24:13 -0700 | | From | Nicolin Chen <> | | Subject | Re: [PATCH RFCv1 08/14] iommufd: Add IOMMU_VIOMMU_SET_DEV_ID ioctl |
| |
On Sun, May 12, 2024 at 11:58:27AM -0300, Jason Gunthorpe wrote: > On Fri, Apr 12, 2024 at 08:47:05PM -0700, Nicolin Chen wrote: > > Introduce a new ioctl to set a per-viommu device virtual id that should be > > linked to the physical device id (or just a struct device pointer). > > > > Since a viommu (user space IOMMU instance) can have multiple devices while > > it's not ideal to confine a device to one single user space IOMMU instance > > either, these two shouldn't just do a 1:1 mapping. Add two xarrays in their > > structures to bind them bidirectionally. > > Since I would like to retain the dev_id, I think this is probably > better done with an allocated struct per dev-id: > > struct dev_id { > struct iommufd_device *idev; > struct iommufd_viommu *viommu; > u64 vdev_id; > u64 driver_private; // Ie the driver can store the pSID here > struct list_head idev_entry; > };
Oh, I needed a better solution to store the HW slot number of a VINTF configuration that links a pSID and a vSID, which I hacked into struct arm_smmu_stream for now. So, with this struct dev_id, likely I can tie it to this structure.
For a driver, pSID is known with a device pointer, while likely no use to the iommufd core?
Also, I will address the other comments in your reply.
Thanks Nicolin
|  |