Commit 04b18e65 authored by David Woodhouse's avatar David Woodhouse

intel-iommu: Make dma_pte_clear_range() use pfns

Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 66eae846
...@@ -779,21 +779,17 @@ static void dma_pte_clear_one(struct dmar_domain *domain, unsigned long pfn) ...@@ -779,21 +779,17 @@ static void dma_pte_clear_one(struct dmar_domain *domain, unsigned long pfn)
/* clear last level pte, a tlb flush should be followed */ /* clear last level pte, a tlb flush should be followed */
static void dma_pte_clear_range(struct dmar_domain *domain, u64 start, u64 end) static void dma_pte_clear_range(struct dmar_domain *domain, u64 start, u64 end)
{ {
int addr_width = agaw_to_width(domain->agaw); unsigned long start_pfn = IOVA_PFN(start);
int npages; unsigned long end_pfn = IOVA_PFN(end-1);
int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT;
BUG_ON(start >> addr_width);
BUG_ON((end-1) >> addr_width);
/* in case it's partial page */ BUG_ON(addr_width < BITS_PER_LONG && start_pfn >> addr_width);
start &= PAGE_MASK; BUG_ON(addr_width < BITS_PER_LONG && end_pfn >> addr_width);
end = PAGE_ALIGN(end);
npages = (end - start) / VTD_PAGE_SIZE;
/* we don't need lock here, nobody else touches the iova range */ /* we don't need lock here; nobody else touches the iova range */
while (npages--) { while (start_pfn <= end_pfn) {
dma_pte_clear_one(domain, start >> VTD_PAGE_SHIFT); dma_pte_clear_one(domain, start_pfn);
start += VTD_PAGE_SIZE; start_pfn++;
} }
} }
......
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