[PATCH v5 13/29] iommufd/viommu: Introduce IOMMUFD_OBJ_HW_QUEUE and its related struct

Jason Gunthorpe jgg at nvidia.com
Fri May 30 09:07:53 PDT 2025


On Sat, May 17, 2025 at 08:21:30PM -0700, Nicolin Chen wrote:
>  struct iommufd_viommu_ops {
> +	u32 flags;
>  	void (*destroy)(struct iommufd_viommu *viommu);
>  	struct iommu_domain *(*alloc_domain_nested)(
>  		struct iommufd_viommu *viommu, u32 flags,
> @@ -171,6 +200,10 @@ struct iommufd_viommu_ops {
>  						 struct device *dev,
>  						 u64 virt_id);
>  	void (*vdevice_destroy)(struct iommufd_vdevice *vdev);
> +	struct iommufd_hw_queue *(*hw_queue_alloc)(
> +		struct iommufd_ucmd *ucmd, struct iommufd_viommu *viommu,
> +		unsigned int type, u32 index, u64 base_addr, size_t length);

I think it would better to have two function pointers here than the flags:

 +	struct iommufd_hw_queue *(*hw_queue_alloc)(
 +		struct iommufd_ucmd *ucmd, struct iommufd_viommu *viommu,
 +		unsigned int type, u32 index, u64 s2_iova, size_t length);


 +	struct iommufd_hw_queue *(*hw_queue_alloc_phys)(
 +		struct iommufd_ucmd *ucmd, struct iommufd_viommu *viommu,
 +		unsigned int type, u32 index, phys_addr_t phys, size_t length);

Jason



More information about the linux-arm-kernel mailing list