diff options
Diffstat (limited to '')
-rw-r--r-- | drivers/iommu/amd/amd_iommu.h | 2 | ||||
-rw-r--r-- | drivers/iommu/amd/iommu.c | 22 | ||||
-rw-r--r-- | drivers/iommu/amd/pasid.c | 2 |
3 files changed, 11 insertions, 15 deletions
diff --git a/drivers/iommu/amd/amd_iommu.h b/drivers/iommu/amd/amd_iommu.h index 0fb0c8392b53..68debf5ee2d7 100644 --- a/drivers/iommu/amd/amd_iommu.h +++ b/drivers/iommu/amd/amd_iommu.h @@ -46,7 +46,7 @@ extern unsigned long amd_iommu_pgsize_bitmap; /* Protection domain ops */ void amd_iommu_init_identity_domain(void); -struct protection_domain *protection_domain_alloc(int nid); +struct protection_domain *protection_domain_alloc(void); void protection_domain_free(struct protection_domain *domain); struct iommu_domain *amd_iommu_domain_alloc_sva(struct device *dev, struct mm_struct *mm); diff --git a/drivers/iommu/amd/iommu.c b/drivers/iommu/amd/iommu.c index 3a12ef96e7ea..0600f0682b91 100644 --- a/drivers/iommu/amd/iommu.c +++ b/drivers/iommu/amd/iommu.c @@ -2177,7 +2177,6 @@ static int pdom_attach_iommu(struct amd_iommu *iommu, struct protection_domain *pdom) { struct pdom_iommu_info *pdom_iommu_info, *curr; - struct io_pgtable_cfg *cfg = &pdom->iop.pgtbl.cfg; unsigned long flags; int ret = 0; @@ -2206,10 +2205,6 @@ static int pdom_attach_iommu(struct amd_iommu *iommu, goto out_unlock; } - /* Update NUMA Node ID */ - if (cfg->amd.nid == NUMA_NO_NODE) - cfg->amd.nid = dev_to_node(&iommu->dev->dev); - out_unlock: spin_unlock_irqrestore(&pdom->lock, flags); return ret; @@ -2446,16 +2441,15 @@ void protection_domain_free(struct protection_domain *domain) kfree(domain); } -static void protection_domain_init(struct protection_domain *domain, int nid) +static void protection_domain_init(struct protection_domain *domain) { spin_lock_init(&domain->lock); INIT_LIST_HEAD(&domain->dev_list); INIT_LIST_HEAD(&domain->dev_data_list); xa_init(&domain->iommu_array); - domain->iop.pgtbl.cfg.amd.nid = nid; } -struct protection_domain *protection_domain_alloc(int nid) +struct protection_domain *protection_domain_alloc(void) { struct protection_domain *domain; int domid; @@ -2471,12 +2465,13 @@ struct protection_domain *protection_domain_alloc(int nid) } domain->id = domid; - protection_domain_init(domain, nid); + protection_domain_init(domain); return domain; } -static int pdom_setup_pgtable(struct protection_domain *domain) +static int pdom_setup_pgtable(struct protection_domain *domain, + struct device *dev) { struct io_pgtable_ops *pgtbl_ops; enum io_pgtable_fmt fmt; @@ -2490,6 +2485,7 @@ static int pdom_setup_pgtable(struct protection_domain *domain) break; } + domain->iop.pgtbl.cfg.amd.nid = dev_to_node(dev); pgtbl_ops = alloc_io_pgtable_ops(fmt, &domain->iop.pgtbl.cfg, domain); if (!pgtbl_ops) return -ENOMEM; @@ -2520,12 +2516,12 @@ do_iommu_domain_alloc(struct device *dev, u32 flags, struct protection_domain *domain; int ret; - domain = protection_domain_alloc(dev_to_node(dev)); + domain = protection_domain_alloc(); if (!domain) return ERR_PTR(-ENOMEM); domain->pd_mode = pgtable; - ret = pdom_setup_pgtable(domain); + ret = pdom_setup_pgtable(domain, dev); if (ret) { pdom_id_free(domain->id); kfree(domain); @@ -2624,7 +2620,7 @@ void amd_iommu_init_identity_domain(void) identity_domain.id = pdom_id_alloc(); - protection_domain_init(&identity_domain, NUMA_NO_NODE); + protection_domain_init(&identity_domain); } /* Same as blocked domain except it supports only ops->attach_dev() */ diff --git a/drivers/iommu/amd/pasid.c b/drivers/iommu/amd/pasid.c index 9101d07b11d3..11150cfd6718 100644 --- a/drivers/iommu/amd/pasid.c +++ b/drivers/iommu/amd/pasid.c @@ -185,7 +185,7 @@ struct iommu_domain *amd_iommu_domain_alloc_sva(struct device *dev, struct protection_domain *pdom; int ret; - pdom = protection_domain_alloc(dev_to_node(dev)); + pdom = protection_domain_alloc(); if (!pdom) return ERR_PTR(-ENOMEM); |