Re: [PATCH v4 4/4] iommufd/vdevice: add TSM guest request ioctl

From: Jason Gunthorpe

Date: Mon Apr 27 2026 - 10:11:19 EST


On Mon, Apr 27, 2026 at 11:40:05AM +0530, Aneesh Kumar K.V (Arm) wrote:
> +/**
> + * struct iommu_vdevice_tsm_guest_request - ioctl(IOMMU_VDEVICE_TSM_GUEST_REQUEST)
> + * @size: sizeof(struct iommu_vdevice_tsm_guest_request)
> + * @vdevice_id: vDevice ID the guest request is for
> + * @scope: Bus-specific scope classification for the guest request
> + * @req_len: Size in bytes of the input payload at @req_uptr
> + * @resp_len: Size in bytes of the output buffer at @resp_uptr
> + * @__reserved: Must be 0
> + * @req_uptr: Userspace pointer to the guest-provided request payload
> + * @resp_uptr: Userspace pointer to the guest response buffer
> + *
> + * Forward a guest request to the TSM bound vDevice. This is intended for
> + * guest TSM/TDISP message transport where the host kernel only marshals
> + * bytes between userspace and the TSM implementation.
> + *
> + * The meaning and valid values of @scope are defined by the TSM backend for
> + * the device bus type.

If you want to do this then you have to also provide a way to discover
what the TSM backend is so userspace can form the correct numbers.

Also, since scope is now a uapi whatever in tsm is defining the values
must be moved to the uapi headers.

Probably this is not a good idea and iommufd should just have its own
enum with unique numbers for every bus and do the validation and
translation.

Jason