Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iommufd: Use iommu_paging_domain_alloc()

If the iommu driver doesn't implement its domain_alloc_user callback,
iommufd_hwpt_paging_alloc() rolls back to allocate an iommu paging domain.
Replace iommu_domain_alloc() with iommu_user_domain_alloc() to pass the
device pointer along the path.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20240610085555.88197-3-baolu.lu@linux.intel.com
Signed-off-by: Will Deacon <will@kernel.org>

authored by

Lu Baolu and committed by
Will Deacon
26a58160 a27bf274

+4 -3
+4 -3
drivers/iommu/iommufd/hw_pagetable.c
··· 137 137 } 138 138 hwpt->domain->owner = ops; 139 139 } else { 140 - hwpt->domain = iommu_domain_alloc(idev->dev->bus); 141 - if (!hwpt->domain) { 142 - rc = -ENOMEM; 140 + hwpt->domain = iommu_paging_domain_alloc(idev->dev); 141 + if (IS_ERR(hwpt->domain)) { 142 + rc = PTR_ERR(hwpt->domain); 143 + hwpt->domain = NULL; 143 144 goto out_abort; 144 145 } 145 146 }