[PATCH RFCv1 07/14] iommufd: Add viommu set/unset_dev_id ops

Jason Gunthorpe jgg at nvidia.com
Sun May 12 07:51:31 PDT 2024


On Fri, Apr 12, 2024 at 08:47:04PM -0700, Nicolin Chen wrote:
> @@ -94,9 +94,13 @@ struct iommufd_viommu {
>   * struct iommufd_viommu_ops - viommu specific operations
>   * @free: Free all driver-specific parts of an iommufd_viommu. The memory
>   *        of the entire viommu will be free-ed by iommufd core
> + * @set/unset_dev_id: set/unset a user space virtual id for a device
>   */
>  struct iommufd_viommu_ops {
>  	void (*free)(struct iommufd_viommu *viommu);
> +	int (*set_dev_id)(struct iommufd_viommu *viommu,
> +			  struct device *dev, u64 dev_id);
> +	void (*unset_dev_id)(struct iommufd_viommu *viommu, struct
> device *dev);

Actually, looking at this more closely, why doesn't the core pass in
dev_id to unset_dev_id? Not doing so seems like it will crease a bunch
of unnecessary work for the driver.

Jason



More information about the linux-arm-kernel mailing list