Skip to content

Commit e1980df

Browse files
committed
iommu/amd: Remove PD_DMA_OPS_MASK
This is covered by IOMMU_DOMAIN_DMA from the IOMMU core code already, so remove it. Signed-off-by: Joerg Roedel <[email protected]> Reviewed-by: Suravee Suthikulpanit <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 301441a commit e1980df

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

drivers/iommu/amd_iommu.c

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1817,15 +1817,6 @@ static void free_gcr3_table(struct protection_domain *domain)
18171817
free_page((unsigned long)domain->gcr3_tbl);
18181818
}
18191819

1820-
/*
1821-
* little helper function to check whether a given protection domain is a
1822-
* dma_ops domain
1823-
*/
1824-
static bool dma_ops_domain(struct protection_domain *domain)
1825-
{
1826-
return domain->flags & PD_DMA_OPS_MASK;
1827-
}
1828-
18291820
static void set_dte_entry(u16 devid, struct protection_domain *domain,
18301821
struct domain_pgtable *pgtable,
18311822
bool ats, bool ppr)
@@ -2408,11 +2399,9 @@ static struct iommu_domain *amd_iommu_domain_alloc(unsigned type)
24082399
domain->domain.geometry.aperture_end = ~0ULL;
24092400
domain->domain.geometry.force_aperture = true;
24102401

2411-
if (type == IOMMU_DOMAIN_DMA) {
2412-
if (iommu_get_dma_cookie(&domain->domain) == -ENOMEM)
2413-
goto free_domain;
2414-
domain->flags = PD_DMA_OPS_MASK;
2415-
}
2402+
if (type == IOMMU_DOMAIN_DMA &&
2403+
iommu_get_dma_cookie(&domain->domain) == -ENOMEM)
2404+
goto free_domain;
24162405

24172406
return &domain->domain;
24182407

@@ -3024,17 +3013,18 @@ struct iommu_domain *amd_iommu_get_v2_domain(struct pci_dev *pdev)
30243013
if (!check_device(dev))
30253014
return NULL;
30263015

3027-
pdomain = get_dev_data(dev)->domain;
3016+
pdomain = get_dev_data(dev)->domain;
3017+
io_domain = iommu_get_domain_for_dev(dev);
30283018
if (pdomain == NULL && get_dev_data(dev)->defer_attach) {
30293019
get_dev_data(dev)->defer_attach = false;
3030-
io_domain = iommu_get_domain_for_dev(dev);
30313020
pdomain = to_pdomain(io_domain);
30323021
attach_device(dev, pdomain);
30333022
}
3023+
30343024
if (pdomain == NULL)
30353025
return NULL;
30363026

3037-
if (!dma_ops_domain(pdomain))
3027+
if (io_domain->type != IOMMU_DOMAIN_DMA)
30383028
return NULL;
30393029

30403030
/* Only return IOMMUv2 domains */

0 commit comments

Comments
 (0)