Re: [PATCH v3 06/11] iommufd: Allow pt_id to carry viommu_id for IOMMU_HWPT_ALLOC
From: Jason Gunthorpe
Date: Thu Oct 17 2024 - 13:09:54 EST
On Wed, Oct 09, 2024 at 09:38:06AM -0700, Nicolin Chen wrote:
> @@ -317,6 +324,19 @@ int iommufd_hwpt_alloc(struct iommufd_ucmd *ucmd)
> goto out_unlock;
> }
> hwpt = &hwpt_nested->common;
> + } else if (pt_obj->type == IOMMUFD_OBJ_VIOMMU) {
> + struct iommufd_hwpt_nested *hwpt_nested;
> + struct iommufd_viommu *viommu;
> +
> + viommu = container_of(pt_obj, struct iommufd_viommu, obj);
One thought is to continue like we do with the domain and check that
the idev's iommu ops match the viommu's iommu ops (or is null for
default) before allowing the callback.
Jason