mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-05 22:28:00 +00:00
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>
This commit is contained in:
parent
9355a08186
commit
38a76eeeaf
1 changed files with 3 additions and 16 deletions
|
@ -546,23 +546,10 @@ static int iommu_map_page(struct protection_domain *dom,
|
||||||
static void iommu_unmap_page(struct protection_domain *dom,
|
static void iommu_unmap_page(struct protection_domain *dom,
|
||||||
unsigned long bus_addr)
|
unsigned long bus_addr)
|
||||||
{
|
{
|
||||||
u64 *pte;
|
u64 *pte = fetch_pte(dom, bus_addr);
|
||||||
|
|
||||||
pte = &dom->pt_root[IOMMU_PTE_L2_INDEX(bus_addr)];
|
if (pte)
|
||||||
|
*pte = 0;
|
||||||
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)];
|
|
||||||
|
|
||||||
*pte = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue