Skip to content

Commit

Permalink
AMD IOMMU: add domain destroy function for IOMMU API
Browse files Browse the repository at this point in the history
Impact: add a generic function for releasing protection domains

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
  • Loading branch information
Joerg Roedel committed Jan 3, 2009
1 parent c156e34 commit 98383fc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions arch/x86/kernel/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1636,4 +1636,25 @@ static int amd_iommu_domain_init(struct iommu_domain *dom)
return -ENOMEM;
}

static void amd_iommu_domain_destroy(struct iommu_domain *dom)
{
struct protection_domain *domain = dom->priv;

if (!domain)
return;

if (domain->dev_cnt > 0)
cleanup_domain(domain);

BUG_ON(domain->dev_cnt != 0);

free_pagetable(domain);

domain_id_free(domain->id);

kfree(domain);

dom->priv = NULL;
}

#endif

0 comments on commit 98383fc

Please sign in to comment.