Skip to content

Commit 26a5816

Browse files
LuBaoluwilldeacon
authored andcommitted
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 <[email protected]> Reviewed-by: Jason Gunthorpe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent a27bf27 commit 26a5816

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

drivers/iommu/iommufd/hw_pagetable.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,10 @@ iommufd_hwpt_paging_alloc(struct iommufd_ctx *ictx, struct iommufd_ioas *ioas,
137137
}
138138
hwpt->domain->owner = ops;
139139
} 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;
143144
goto out_abort;
144145
}
145146
}

0 commit comments

Comments
 (0)