aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/amd_iommu.c
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2009-09-02 17:02:47 +0200
committerJoerg Roedel <joerg.roedel@amd.com>2009-09-03 16:03:41 +0200
commit38a76eeeafb251bf67d143a34b37a8105cff302e (patch)
treef5fbe58002425e7424937678fd87b35f9e3c9280 /arch/x86/kernel/amd_iommu.c
parentx86/amd-iommu: Make fetch_pte aware of dynamic mapping levels (diff)
downloadlinux-dev-38a76eeeafb251bf67d143a34b37a8105cff302e.tar.xz
linux-dev-38a76eeeafb251bf67d143a34b37a8105cff302e.zip
x86/amd-iommu: Use fetch_pte in iommu_unmap_page
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>
Diffstat (limited to 'arch/x86/kernel/amd_iommu.c')
-rw-r--r--arch/x86/kernel/amd_iommu.c19
1 files changed, 3 insertions, 16 deletions
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 29bcd358b6ce..5e5279899994 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -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;
}
/*