aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2009-06-27 14:15:01 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-06-29 08:26:36 -0400
commit04b18e65dd5a3e544f07f4bcfa8fb52704a1833b (patch)
tree51b6c12b122a1c186c3f8fea3f723c602a4465d7 /drivers
parent66eae8469e4e4ba6f4ca7ef82103c78f6d645583 (diff)
intel-iommu: Make dma_pte_clear_range() use pfns
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/intel-iommu.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index ad367f53a2bb..d4217f737159 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -779,21 +779,17 @@ static void dma_pte_clear_one(struct dmar_domain *domain, unsigned long pfn)
779/* clear last level pte, a tlb flush should be followed */ 779/* clear last level pte, a tlb flush should be followed */
780static void dma_pte_clear_range(struct dmar_domain *domain, u64 start, u64 end) 780static void dma_pte_clear_range(struct dmar_domain *domain, u64 start, u64 end)
781{ 781{
782 int addr_width = agaw_to_width(domain->agaw); 782 unsigned long start_pfn = IOVA_PFN(start);
783 int npages; 783 unsigned long end_pfn = IOVA_PFN(end-1);
784 784 int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT;
785 BUG_ON(start >> addr_width);
786 BUG_ON((end-1) >> addr_width);
787 785
788 /* in case it's partial page */ 786 BUG_ON(addr_width < BITS_PER_LONG && start_pfn >> addr_width);
789 start &= PAGE_MASK; 787 BUG_ON(addr_width < BITS_PER_LONG && end_pfn >> addr_width);
790 end = PAGE_ALIGN(end);
791 npages = (end - start) / VTD_PAGE_SIZE;
792 788
793 /* we don't need lock here, nobody else touches the iova range */ 789 /* we don't need lock here; nobody else touches the iova range */
794 while (npages--) { 790 while (start_pfn <= end_pfn) {
795 dma_pte_clear_one(domain, start >> VTD_PAGE_SHIFT); 791 dma_pte_clear_one(domain, start_pfn);
796 start += VTD_PAGE_SIZE; 792 start_pfn++;
797 } 793 }
798} 794}
799 795