@@ -1817,15 +1817,6 @@ static void free_gcr3_table(struct protection_domain *domain)
1817
1817
free_page ((unsigned long )domain -> gcr3_tbl );
1818
1818
}
1819
1819
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
-
1829
1820
static void set_dte_entry (u16 devid , struct protection_domain * domain ,
1830
1821
struct domain_pgtable * pgtable ,
1831
1822
bool ats , bool ppr )
@@ -2408,11 +2399,9 @@ static struct iommu_domain *amd_iommu_domain_alloc(unsigned type)
2408
2399
domain -> domain .geometry .aperture_end = ~0ULL ;
2409
2400
domain -> domain .geometry .force_aperture = true;
2410
2401
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 ;
2416
2405
2417
2406
return & domain -> domain ;
2418
2407
@@ -3024,17 +3013,18 @@ struct iommu_domain *amd_iommu_get_v2_domain(struct pci_dev *pdev)
3024
3013
if (!check_device (dev ))
3025
3014
return NULL ;
3026
3015
3027
- pdomain = get_dev_data (dev )-> domain ;
3016
+ pdomain = get_dev_data (dev )-> domain ;
3017
+ io_domain = iommu_get_domain_for_dev (dev );
3028
3018
if (pdomain == NULL && get_dev_data (dev )-> defer_attach ) {
3029
3019
get_dev_data (dev )-> defer_attach = false;
3030
- io_domain = iommu_get_domain_for_dev (dev );
3031
3020
pdomain = to_pdomain (io_domain );
3032
3021
attach_device (dev , pdomain );
3033
3022
}
3023
+
3034
3024
if (pdomain == NULL )
3035
3025
return NULL ;
3036
3026
3037
- if (! dma_ops_domain ( pdomain ) )
3027
+ if (io_domain -> type != IOMMU_DOMAIN_DMA )
3038
3028
return NULL ;
3039
3029
3040
3030
/* Only return IOMMUv2 domains */
0 commit comments