Skip to content

Commit

Permalink
x86/amd-iommu: Use fetch_pte in iommu_unmap_page
Browse files Browse the repository at this point in the history
Instead of reimplementing existing logic use fetch_pte to
walk the page table in iommu_unmap_page.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
  • Loading branch information
Joerg Roedel committed Sep 3, 2009
1 parent 9355a08 commit 38a76ee
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions arch/x86/kernel/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -546,23 +546,10 @@ static int iommu_map_page(struct protection_domain *dom,
static void iommu_unmap_page(struct protection_domain *dom,
unsigned long bus_addr)
{
u64 *pte;

pte = &dom->pt_root[IOMMU_PTE_L2_INDEX(bus_addr)];

if (!IOMMU_PTE_PRESENT(*pte))
return;

pte = IOMMU_PTE_PAGE(*pte);
pte = &pte[IOMMU_PTE_L1_INDEX(bus_addr)];

if (!IOMMU_PTE_PRESENT(*pte))
return;

pte = IOMMU_PTE_PAGE(*pte);
pte = &pte[IOMMU_PTE_L1_INDEX(bus_addr)];
u64 *pte = fetch_pte(dom, bus_addr);

*pte = 0;
if (pte)
*pte = 0;
}

/*
Expand Down

0 comments on commit 38a76ee

Please sign in to comment.