@@ -1454,27 +1454,6 @@ static bool first_level_by_default(unsigned int type)
14541454 return type != IOMMU_DOMAIN_UNMANAGED ;
14551455}
14561456
1457- static struct dmar_domain * alloc_domain (unsigned int type )
1458- {
1459- struct dmar_domain * domain ;
1460-
1461- domain = kzalloc (sizeof (* domain ), GFP_KERNEL );
1462- if (!domain )
1463- return NULL ;
1464-
1465- domain -> nid = NUMA_NO_NODE ;
1466- if (first_level_by_default (type ))
1467- domain -> use_first_level = true;
1468- INIT_LIST_HEAD (& domain -> devices );
1469- INIT_LIST_HEAD (& domain -> dev_pasids );
1470- INIT_LIST_HEAD (& domain -> cache_tags );
1471- spin_lock_init (& domain -> lock );
1472- spin_lock_init (& domain -> cache_lock );
1473- xa_init (& domain -> iommu_array );
1474-
1475- return domain ;
1476- }
1477-
14781457int domain_attach_iommu (struct dmar_domain * domain , struct intel_iommu * iommu )
14791458{
14801459 struct iommu_domain_info * info , * curr ;
@@ -1546,20 +1525,6 @@ void domain_detach_iommu(struct dmar_domain *domain, struct intel_iommu *iommu)
15461525 spin_unlock (& iommu -> lock );
15471526}
15481527
1549- static int guestwidth_to_adjustwidth (int gaw )
1550- {
1551- int agaw ;
1552- int r = (gaw - 12 ) % 9 ;
1553-
1554- if (r == 0 )
1555- agaw = gaw ;
1556- else
1557- agaw = gaw + 9 - r ;
1558- if (agaw > 64 )
1559- agaw = 64 ;
1560- return agaw ;
1561- }
1562-
15631528static void domain_exit (struct dmar_domain * domain )
15641529{
15651530 if (domain -> pgd ) {
@@ -3379,27 +3344,6 @@ void device_block_translation(struct device *dev)
33793344 info -> domain = NULL ;
33803345}
33813346
3382- static int md_domain_init (struct dmar_domain * domain , int guest_width )
3383- {
3384- int adjust_width ;
3385-
3386- /* calculate AGAW */
3387- domain -> gaw = guest_width ;
3388- adjust_width = guestwidth_to_adjustwidth (guest_width );
3389- domain -> agaw = width_to_agaw (adjust_width );
3390-
3391- domain -> iommu_coherency = false;
3392- domain -> iommu_superpage = 0 ;
3393- domain -> max_addr = 0 ;
3394-
3395- /* always allocate the top pgd */
3396- domain -> pgd = iommu_alloc_page_node (domain -> nid , GFP_ATOMIC );
3397- if (!domain -> pgd )
3398- return - ENOMEM ;
3399- domain_flush_cache (domain , domain -> pgd , PAGE_SIZE );
3400- return 0 ;
3401- }
3402-
34033347static int blocking_domain_attach_dev (struct iommu_domain * domain ,
34043348 struct device * dev )
34053349{
@@ -3486,39 +3430,6 @@ static struct dmar_domain *paging_domain_alloc(struct device *dev, bool first_st
34863430 return domain ;
34873431}
34883432
3489- static struct iommu_domain * intel_iommu_domain_alloc (unsigned type )
3490- {
3491- struct dmar_domain * dmar_domain ;
3492- struct iommu_domain * domain ;
3493-
3494- switch (type ) {
3495- case IOMMU_DOMAIN_DMA :
3496- case IOMMU_DOMAIN_UNMANAGED :
3497- dmar_domain = alloc_domain (type );
3498- if (!dmar_domain ) {
3499- pr_err ("Can't allocate dmar_domain\n" );
3500- return NULL ;
3501- }
3502- if (md_domain_init (dmar_domain , DEFAULT_DOMAIN_ADDRESS_WIDTH )) {
3503- pr_err ("Domain initialization failed\n" );
3504- domain_exit (dmar_domain );
3505- return NULL ;
3506- }
3507-
3508- domain = & dmar_domain -> domain ;
3509- domain -> geometry .aperture_start = 0 ;
3510- domain -> geometry .aperture_end =
3511- __DOMAIN_MAX_ADDR (dmar_domain -> gaw );
3512- domain -> geometry .force_aperture = true;
3513-
3514- return domain ;
3515- default :
3516- return NULL ;
3517- }
3518-
3519- return NULL ;
3520- }
3521-
35223433static struct iommu_domain *
35233434intel_iommu_domain_alloc_user (struct device * dev , u32 flags ,
35243435 struct iommu_domain * parent ,
@@ -4609,7 +4520,6 @@ const struct iommu_ops intel_iommu_ops = {
46094520 .identity_domain = & identity_domain ,
46104521 .capable = intel_iommu_capable ,
46114522 .hw_info = intel_iommu_hw_info ,
4612- .domain_alloc = intel_iommu_domain_alloc ,
46134523 .domain_alloc_user = intel_iommu_domain_alloc_user ,
46144524 .domain_alloc_sva = intel_svm_domain_alloc ,
46154525 .domain_alloc_paging = intel_iommu_domain_alloc_paging ,
0 commit comments