Skip to content

Commit

Permalink
iommu/amd: Remove amd_iommu_pd_list
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joerg Roedel committed Apr 26, 2019
1 parent 7a5dbf3 commit c805b42
Showing 3 changed files with 0 additions and 47 deletions.
33 changes: 0 additions & 33 deletions drivers/iommu/amd_iommu.c
Original file line number Diff line number Diff line change
@@ -1723,31 +1723,6 @@ static void dma_ops_free_iova(struct dma_ops_domain *dma_dom,
*
****************************************************************************/

/*
* This function adds a protection domain to the global protection domain list
*/
static void add_domain_to_list(struct protection_domain *domain)
{
unsigned long flags;

spin_lock_irqsave(&amd_iommu_pd_lock, flags);
list_add(&domain->list, &amd_iommu_pd_list);
spin_unlock_irqrestore(&amd_iommu_pd_lock, flags);
}

/*
* This function removes a protection domain to the global
* protection domain list
*/
static void del_domain_from_list(struct protection_domain *domain)
{
unsigned long flags;

spin_lock_irqsave(&amd_iommu_pd_lock, flags);
list_del(&domain->list);
spin_unlock_irqrestore(&amd_iommu_pd_lock, flags);
}

static u16 domain_id_alloc(void)
{
int id;
@@ -1838,8 +1813,6 @@ static void dma_ops_domain_free(struct dma_ops_domain *dom)
if (!dom)
return;

del_domain_from_list(&dom->domain);

put_iova_domain(&dom->iovad);

free_pagetable(&dom->domain);
@@ -1880,8 +1853,6 @@ static struct dma_ops_domain *dma_ops_domain_alloc(void)
/* Initialize reserved ranges */
copy_reserved_iova(&reserved_iova_ranges, &dma_dom->iovad);

add_domain_to_list(&dma_dom->domain);

return dma_dom;

free_dma_dom:
@@ -2834,8 +2805,6 @@ static void protection_domain_free(struct protection_domain *domain)
if (!domain)
return;

del_domain_from_list(domain);

if (domain->id)
domain_id_free(domain->id);

@@ -2865,8 +2834,6 @@ static struct protection_domain *protection_domain_alloc(void)
if (protection_domain_init(domain))
goto out_err;

add_domain_to_list(domain);

return domain;

out_err:
8 changes: 0 additions & 8 deletions drivers/iommu/amd_iommu_init.c
Original file line number Diff line number Diff line change
@@ -188,12 +188,6 @@ static bool amd_iommu_pc_present __read_mostly;

bool amd_iommu_force_isolation __read_mostly;

/*
* List of protection domains - used during resume
*/
LIST_HEAD(amd_iommu_pd_list);
spinlock_t amd_iommu_pd_lock;

/*
* Pointer to the device table which is shared by all AMD IOMMUs
* it is indexed by the PCI device id or the HT unit id and contains
@@ -2526,8 +2520,6 @@ static int __init early_amd_iommu_init(void)
*/
__set_bit(0, amd_iommu_pd_alloc_bitmap);

spin_lock_init(&amd_iommu_pd_lock);

/*
* now the data structures are allocated and basically initialized
* start the real acpi table scan
6 changes: 0 additions & 6 deletions drivers/iommu/amd_iommu_types.h
Original file line number Diff line number Diff line change
@@ -674,12 +674,6 @@ extern struct list_head amd_iommu_list;
*/
extern struct amd_iommu *amd_iommus[MAX_IOMMUS];

/*
* Declarations for the global list of all protection domains
*/
extern spinlock_t amd_iommu_pd_lock;
extern struct list_head amd_iommu_pd_list;

/*
* Structure defining one entry in the device table
*/

0 comments on commit c805b42

Please sign in to comment.