[PATCH v4 05/23] iommufd/driver: Let iommufd_viommu_alloc helper save ictx to viommu->ictx

Tian, Kevin kevin.tian at intel.com
Wed May 14 22:48:19 PDT 2025


> From: Nicolin Chen <nicolinc at nvidia.com>
> Sent: Friday, May 9, 2025 11:02 AM
> 
> When an IOMMU driver calls iommufd_viommu_alloc(), it must pass in an
> ictx
> pointer as the underlying _iommufd_object_alloc() helper function requires
> that to allocate a new object. However, neither the iommufd_viommu_alloc()
> nor its underlying _iommufd_object_alloc() saves the ictx in the allocated
> viommu object, although viommu could hold an ictx pointer.
> 
> When the IOMMU driver wants to use another iommufd function passing in
> the
> allocated viommu, it could have avoided passing in the ictx pointer again,
> if viommu->ictx is valid.
> 
> Save ictx to viommu->ictx in the iommufd_viommu_alloc(), in order to ease
> a new vIOMMU-based helper that would then get the ictx from viommu->ictx.
> 
> Signed-off-by: Nicolin Chen <nicolinc at nvidia.com>

Reviewed-by: Kevin Tian <kevin.tian at intel.com>



More information about the linux-arm-kernel mailing list