aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2019-04-26 09:17:20 -0400
committerJoerg Roedel <jroedel@suse.de>2019-04-26 09:17:20 -0400
commitc805b428f206a9097ef8c905d8b7e40bc411100e (patch)
tree5b12b4df54310d46584c9e3a29c3939b53ced51d
parent7a5dbf3ab2f04905cf8468c66fcdbfb643068bcb (diff)
iommu/amd: Remove amd_iommu_pd_list
This variable hold a global list of allocated protection domains in the AMD IOMMU driver. By now this list is never traversed anymore, so the list and the lock protecting it can be removed. Cc: Tom Murphy <tmurphy@arista.com> Signed-off-by: Joerg Roedel <jroedel@suse.de>
-rw-r--r--drivers/iommu/amd_iommu.c33
-rw-r--r--drivers/iommu/amd_iommu_init.c8
-rw-r--r--drivers/iommu/amd_iommu_types.h6
3 files changed, 0 insertions, 47 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index f467cc4b498e..3e0696cf965c 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -1723,31 +1723,6 @@ static void dma_ops_free_iova(struct dma_ops_domain *dma_dom,
1723 * 1723 *
1724 ****************************************************************************/ 1724 ****************************************************************************/
1725 1725
1726/*
1727 * This function adds a protection domain to the global protection domain list
1728 */
1729static void add_domain_to_list(struct protection_domain *domain)
1730{
1731 unsigned long flags;
1732
1733 spin_lock_irqsave(&amd_iommu_pd_lock, flags);
1734 list_add(&domain->list, &amd_iommu_pd_list);
1735 spin_unlock_irqrestore(&amd_iommu_pd_lock, flags);
1736}
1737
1738/*
1739 * This function removes a protection domain to the global
1740 * protection domain list
1741 */
1742static void del_domain_from_list(struct protection_domain *domain)
1743{
1744 unsigned long flags;
1745
1746 spin_lock_irqsave(&amd_iommu_pd_lock, flags);
1747 list_del(&domain->list);
1748 spin_unlock_irqrestore(&amd_iommu_pd_lock, flags);
1749}
1750
1751static u16 domain_id_alloc(void) 1726static u16 domain_id_alloc(void)
1752{ 1727{
1753 int id; 1728 int id;
@@ -1838,8 +1813,6 @@ static void dma_ops_domain_free(struct dma_ops_domain *dom)
1838 if (!dom) 1813 if (!dom)
1839 return; 1814 return;
1840 1815
1841 del_domain_from_list(&dom->domain);
1842
1843 put_iova_domain(&dom->iovad); 1816 put_iova_domain(&dom->iovad);
1844 1817
1845 free_pagetable(&dom->domain); 1818 free_pagetable(&dom->domain);
@@ -1880,8 +1853,6 @@ static struct dma_ops_domain *dma_ops_domain_alloc(void)
1880 /* Initialize reserved ranges */ 1853 /* Initialize reserved ranges */
1881 copy_reserved_iova(&reserved_iova_ranges, &dma_dom->iovad); 1854 copy_reserved_iova(&reserved_iova_ranges, &dma_dom->iovad);
1882 1855
1883 add_domain_to_list(&dma_dom->domain);
1884
1885 return dma_dom; 1856 return dma_dom;
1886 1857
1887free_dma_dom: 1858free_dma_dom:
@@ -2834,8 +2805,6 @@ static void protection_domain_free(struct protection_domain *domain)
2834 if (!domain) 2805 if (!domain)
2835 return; 2806 return;
2836 2807
2837 del_domain_from_list(domain);
2838
2839 if (domain->id) 2808 if (domain->id)
2840 domain_id_free(domain->id); 2809 domain_id_free(domain->id);
2841 2810
@@ -2865,8 +2834,6 @@ static struct protection_domain *protection_domain_alloc(void)
2865 if (protection_domain_init(domain)) 2834 if (protection_domain_init(domain))
2866 goto out_err; 2835 goto out_err;
2867 2836
2868 add_domain_to_list(domain);
2869
2870 return domain; 2837 return domain;
2871 2838
2872out_err: 2839out_err:
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 1b1378619fc9..4497c6bb9e70 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -189,12 +189,6 @@ static bool amd_iommu_pc_present __read_mostly;
189bool amd_iommu_force_isolation __read_mostly; 189bool amd_iommu_force_isolation __read_mostly;
190 190
191/* 191/*
192 * List of protection domains - used during resume
193 */
194LIST_HEAD(amd_iommu_pd_list);
195spinlock_t amd_iommu_pd_lock;
196
197/*
198 * Pointer to the device table which is shared by all AMD IOMMUs 192 * Pointer to the device table which is shared by all AMD IOMMUs
199 * it is indexed by the PCI device id or the HT unit id and contains 193 * it is indexed by the PCI device id or the HT unit id and contains
200 * information about the domain the device belongs to as well as the 194 * information about the domain the device belongs to as well as the
@@ -2526,8 +2520,6 @@ static int __init early_amd_iommu_init(void)
2526 */ 2520 */
2527 __set_bit(0, amd_iommu_pd_alloc_bitmap); 2521 __set_bit(0, amd_iommu_pd_alloc_bitmap);
2528 2522
2529 spin_lock_init(&amd_iommu_pd_lock);
2530
2531 /* 2523 /*
2532 * now the data structures are allocated and basically initialized 2524 * now the data structures are allocated and basically initialized
2533 * start the real acpi table scan 2525 * start the real acpi table scan
diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h
index 87965e4d9647..85c488b8daea 100644
--- a/drivers/iommu/amd_iommu_types.h
+++ b/drivers/iommu/amd_iommu_types.h
@@ -675,12 +675,6 @@ extern struct list_head amd_iommu_list;
675extern struct amd_iommu *amd_iommus[MAX_IOMMUS]; 675extern struct amd_iommu *amd_iommus[MAX_IOMMUS];
676 676
677/* 677/*
678 * Declarations for the global list of all protection domains
679 */
680extern spinlock_t amd_iommu_pd_lock;
681extern struct list_head amd_iommu_pd_list;
682
683/*
684 * Structure defining one entry in the device table 678 * Structure defining one entry in the device table
685 */ 679 */
686struct dev_table_entry { 680struct dev_table_entry {