Re: [PATCH RFC v2 0/3] Add set_dev_data and unset_dev_data support

From: Jason Gunthorpe
Date: Fri Apr 21 2023 - 09:09:44 EST


On Fri, Apr 21, 2023 at 01:20:13AM -0700, Nicolin Chen wrote:

> +/**
> + * struct iommufd_device_set_data - ioctl(IOMMU_DEVICE_SET_DATA)
> + * @size: sizeof(struct iommufd_device_set_data)
> + * @dev_id: The device to set a device data
> + * @data_uptr: User pointer of the device user data.
> + * @data_len: Length of the device user data.
> + */
> +struct iommufd_device_set_data {
> + __u32 size;
> + __u32 dev_id;
> + __aligned_u64 data_uptr;
> + __u32 data_len;
> +};
> +#define IOMMU_DEVICE_SET_DATA _IO(IOMMUFD_TYPE, IOMMUFD_CMD_DEVICE_SET_DATA)
> +
> +/**
> + * struct iommufd_device_unset_data - ioctl(IOMMU_DEVICE_UNSET_DATA)
> + * @size: sizeof(struct iommufd_device_unset_data)
> + * @dev_id: The device to unset its device data
> + */
> +struct iommufd_device_unset_data {
> + __u32 size;
> + __u32 dev_id;
> +};
> +#define IOMMU_DEVICE_UNSET_DATA _IO(IOMMUFD_TYPE, IOMMUFD_CMD_DEVICE_UNSET_DATA)
>
> Maybe just like this?

How would the iommu_ops backing this work?

Jason