@@ -1454,27 +1454,6 @@ static bool first_level_by_default(unsigned int type)
1454
1454
return type != IOMMU_DOMAIN_UNMANAGED ;
1455
1455
}
1456
1456
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
-
1478
1457
int domain_attach_iommu (struct dmar_domain * domain , struct intel_iommu * iommu )
1479
1458
{
1480
1459
struct iommu_domain_info * info , * curr ;
@@ -1546,20 +1525,6 @@ void domain_detach_iommu(struct dmar_domain *domain, struct intel_iommu *iommu)
1546
1525
spin_unlock (& iommu -> lock );
1547
1526
}
1548
1527
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
-
1563
1528
static void domain_exit (struct dmar_domain * domain )
1564
1529
{
1565
1530
if (domain -> pgd ) {
@@ -3379,27 +3344,6 @@ void device_block_translation(struct device *dev)
3379
3344
info -> domain = NULL ;
3380
3345
}
3381
3346
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
-
3403
3347
static int blocking_domain_attach_dev (struct iommu_domain * domain ,
3404
3348
struct device * dev )
3405
3349
{
@@ -3486,39 +3430,6 @@ static struct dmar_domain *paging_domain_alloc(struct device *dev, bool first_st
3486
3430
return domain ;
3487
3431
}
3488
3432
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
-
3522
3433
static struct iommu_domain *
3523
3434
intel_iommu_domain_alloc_user (struct device * dev , u32 flags ,
3524
3435
struct iommu_domain * parent ,
@@ -4609,7 +4520,6 @@ const struct iommu_ops intel_iommu_ops = {
4609
4520
.identity_domain = & identity_domain ,
4610
4521
.capable = intel_iommu_capable ,
4611
4522
.hw_info = intel_iommu_hw_info ,
4612
- .domain_alloc = intel_iommu_domain_alloc ,
4613
4523
.domain_alloc_user = intel_iommu_domain_alloc_user ,
4614
4524
.domain_alloc_sva = intel_svm_domain_alloc ,
4615
4525
.domain_alloc_paging = intel_iommu_domain_alloc_paging ,
0 commit comments