> -----Original Message-----
> From: Zhenzhong Duan <[email protected]>
> Sent: 05 February 2026 03:11
> To: [email protected]
> Cc: [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; Jason Gunthorpe
> <[email protected]>; Nicolin Chen <[email protected]>; Shameer Kolothum
> Thodi <[email protected]>; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; Zhenzhong Duan <[email protected]>
> Subject: [RFC PATCH 01/14] backends/iommufd: Add pasid attach/detach
> callbacks
> 
> External email: Use caution opening links or attachments
> 
> 
> Add two wrappers host_iommu_device_iommufd_pasid_[at|de]tach_hwpt to
> wrap the two callbacks.
> 
> Use assert to ensure the corresponding callbacks exist.
> 
> Signed-off-by: Yi Liu <[email protected]>
> Signed-off-by: Zhenzhong Duan <[email protected]>
> ---
>  include/system/iommufd.h | 40
> ++++++++++++++++++++++++++++++++++++++++
>  backends/iommufd.c       | 23 +++++++++++++++++++++++
>  2 files changed, 63 insertions(+)
> 
> diff --git a/include/system/iommufd.h b/include/system/iommufd.h
> index 80d72469a9..615be10aed 100644
> --- a/include/system/iommufd.h
> +++ b/include/system/iommufd.h
> @@ -145,10 +145,50 @@ struct HostIOMMUDeviceIOMMUFDClass {
>       * Returns: true on success, false on failure.
>       */
>      bool (*detach_hwpt)(HostIOMMUDeviceIOMMUFD *idev, Error **errp);
> +    /**
> +     * @attach_hwpt: attach host IOMMU device's pasid to IOMMUFD

s/@attach_hwpt/@pasid_attach_hwpt/

> hardware page
> +     * table. VFIO and VDPA device can have different implementation.
> +     *
> +     * Mandatory callback.

This currently appears Intel specific and calling it "Mandatory"
may be confusing. Have you considered extending attach_hwpt() to
take a PASID instead of introducing a separate callback?

> +     *
> +     * @idev: host IOMMU device backed by IOMMUFD backend.
> +     *
> +     * @pasid: pasid of host IOMMU device.
> +     *
> +     * @hwpt_id: ID of IOMMUFD hardware page table.
> +     *
> +     * @errp: pass an Error out when attachment fails.
> +     *
> +     * Returns: true on success, false on failure.
> +     */
> +    bool (*pasid_attach_hwpt)(HostIOMMUDeviceIOMMUFD *idev, uint32_t
> pasid,
> +                              uint32_t hwpt_id, Error **errp);
> +    /**
> +     * @detach_hwpt: detach host IOMMU device's from IOMMUFD hardware

s/@detach_hwpt/@pasid_detach_hwpt/

Also comment needs update?

Thanks,
Shameer


Reply via email to