Commit 86db2e5d authored by Joerg Roedel's avatar Joerg Roedel

AMD IOMMU: make dma_ops_free_pagetable generic

Impact: change code to free pagetables from protection domains

The dma_ops_free_pagetable function can only free pagetables from
dma_ops domains. Change that to free pagetables of pure protection
domains.
Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
parent 38e817fe
...@@ -587,12 +587,12 @@ static void dma_ops_reserve_addresses(struct dma_ops_domain *dom, ...@@ -587,12 +587,12 @@ static void dma_ops_reserve_addresses(struct dma_ops_domain *dom,
iommu_area_reserve(dom->bitmap, start_page, pages); iommu_area_reserve(dom->bitmap, start_page, pages);
} }
static void dma_ops_free_pagetable(struct dma_ops_domain *dma_dom) static void free_pagetable(struct protection_domain *domain)
{ {
int i, j; int i, j;
u64 *p1, *p2, *p3; u64 *p1, *p2, *p3;
p1 = dma_dom->domain.pt_root; p1 = domain->pt_root;
if (!p1) if (!p1)
return; return;
...@@ -613,6 +613,8 @@ static void dma_ops_free_pagetable(struct dma_ops_domain *dma_dom) ...@@ -613,6 +613,8 @@ static void dma_ops_free_pagetable(struct dma_ops_domain *dma_dom)
} }
free_page((unsigned long)p1); free_page((unsigned long)p1);
domain->pt_root = NULL;
} }
/* /*
...@@ -624,7 +626,7 @@ static void dma_ops_domain_free(struct dma_ops_domain *dom) ...@@ -624,7 +626,7 @@ static void dma_ops_domain_free(struct dma_ops_domain *dom)
if (!dom) if (!dom)
return; return;
dma_ops_free_pagetable(dom); free_pagetable(&dom->domain);
kfree(dom->pte_pages); kfree(dom->pte_pages);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment