From 491d4c75d51b16b0a2bd42862d999849da1f03d3 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Sat, 27 Jun 2009 19:15:01 +0100 Subject: [PATCH] --- yaml --- r: 154767 b: refs/heads/master c: 04b18e65dd5a3e544f07f4bcfa8fb52704a1833b h: refs/heads/master i: 154765: e1a829cc3e6e432b5538cce3fefaf10f3b26f7e7 154763: 754afc34b9bc4608c43a90390854632fbe0d5e5e 154759: 998da21d7d5b41544ba4d90d7413a0ccb903f049 154751: 5d4bc1dbed3c014e022ba0e57e2da9966c138ace v: v3 --- [refs] | 2 +- trunk/drivers/pci/intel-iommu.c | 22 +++++++++------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/[refs] b/[refs] index eefec6ca616e..fefcd0d9619a 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 66eae8469e4e4ba6f4ca7ef82103c78f6d645583 +refs/heads/master: 04b18e65dd5a3e544f07f4bcfa8fb52704a1833b diff --git a/trunk/drivers/pci/intel-iommu.c b/trunk/drivers/pci/intel-iommu.c index ad367f53a2bb..d4217f737159 100644 --- a/trunk/drivers/pci/intel-iommu.c +++ b/trunk/drivers/pci/intel-iommu.c @@ -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 */ static void dma_pte_clear_range(struct dmar_domain *domain, u64 start, u64 end) { - int addr_width = agaw_to_width(domain->agaw); - int npages; - - BUG_ON(start >> addr_width); - BUG_ON((end-1) >> addr_width); + unsigned long start_pfn = IOVA_PFN(start); + unsigned long end_pfn = IOVA_PFN(end-1); + int addr_width = agaw_to_width(domain->agaw) - VTD_PAGE_SHIFT; - /* in case it's partial page */ - start &= PAGE_MASK; - end = PAGE_ALIGN(end); - npages = (end - start) / VTD_PAGE_SIZE; + BUG_ON(addr_width < BITS_PER_LONG && start_pfn >> addr_width); + BUG_ON(addr_width < BITS_PER_LONG && end_pfn >> addr_width); - /* we don't need lock here, nobody else touches the iova range */ - while (npages--) { - dma_pte_clear_one(domain, start >> VTD_PAGE_SHIFT); - start += VTD_PAGE_SIZE; + /* we don't need lock here; nobody else touches the iova range */ + while (start_pfn <= end_pfn) { + dma_pte_clear_one(domain, start_pfn); + start_pfn++; } }