Skip to content

Commit f9b80f9

Browse files
jgunthorpejoergroedel
authored andcommitted
iommu/amd: Remove domain_alloc()
IOMMU drivers should not be sensitive to the domain type, a paging domain should be created based only on the flags passed in, the same for all callers. AMD was using the domain_alloc() path to force VFIO into a v1 domain type, because v1 gives higher performance. However now that IOMMU_HWPT_ALLOC_PASID is present, and a NULL device is not possible, domain_alloc_paging_flags() will do the right thing for VFIO. When invoked from VFIO flags will be 0 and the amd_iommu_pgtable type of domain will be selected. This is v1 by default unless the kernel command line has overridden it to v2. If the admin is forcing v2 assume they know what they are doing so force it everywhere, including for VFIO. Reviewed-by: Vasant Hegde <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 1a684b0 commit f9b80f9

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

drivers/iommu/amd/iommu.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2565,25 +2565,6 @@ static struct iommu_domain *do_iommu_domain_alloc(unsigned int type,
25652565
return &domain->domain;
25662566
}
25672567

2568-
static struct iommu_domain *amd_iommu_domain_alloc(unsigned int type)
2569-
{
2570-
struct iommu_domain *domain;
2571-
int pgtable = amd_iommu_pgtable;
2572-
2573-
/*
2574-
* Force IOMMU v1 page table when allocating
2575-
* domain for pass-through devices.
2576-
*/
2577-
if (type == IOMMU_DOMAIN_UNMANAGED)
2578-
pgtable = AMD_IOMMU_V1;
2579-
2580-
domain = do_iommu_domain_alloc(type, NULL, 0, pgtable);
2581-
if (IS_ERR(domain))
2582-
return NULL;
2583-
2584-
return domain;
2585-
}
2586-
25872568
static struct iommu_domain *
25882569
amd_iommu_domain_alloc_paging_flags(struct device *dev, u32 flags,
25892570
const struct iommu_user_data *user_data)
@@ -3059,7 +3040,6 @@ const struct iommu_ops amd_iommu_ops = {
30593040
.blocked_domain = &blocked_domain,
30603041
.release_domain = &release_domain,
30613042
.identity_domain = &identity_domain.domain,
3062-
.domain_alloc = amd_iommu_domain_alloc,
30633043
.domain_alloc_paging_flags = amd_iommu_domain_alloc_paging_flags,
30643044
.domain_alloc_sva = amd_iommu_domain_alloc_sva,
30653045
.probe_device = amd_iommu_probe_device,

0 commit comments

Comments
 (0)