diff options
-rw-r--r-- | drivers/pci/intel-iommu.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 0c12d06bade6..002c8b95edf8 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -718,15 +718,17 @@ static void dma_pte_clear_one(struct dmar_domain *domain, u64 addr) | |||
718 | static void dma_pte_clear_range(struct dmar_domain *domain, u64 start, u64 end) | 718 | static void dma_pte_clear_range(struct dmar_domain *domain, u64 start, u64 end) |
719 | { | 719 | { |
720 | int addr_width = agaw_to_width(domain->agaw); | 720 | int addr_width = agaw_to_width(domain->agaw); |
721 | int npages; | ||
721 | 722 | ||
722 | start &= (((u64)1) << addr_width) - 1; | 723 | start &= (((u64)1) << addr_width) - 1; |
723 | end &= (((u64)1) << addr_width) - 1; | 724 | end &= (((u64)1) << addr_width) - 1; |
724 | /* in case it's partial page */ | 725 | /* in case it's partial page */ |
725 | start = PAGE_ALIGN(start); | 726 | start = PAGE_ALIGN(start); |
726 | end &= PAGE_MASK; | 727 | end &= PAGE_MASK; |
728 | npages = (end - start) / VTD_PAGE_SIZE; | ||
727 | 729 | ||
728 | /* we don't need lock here, nobody else touches the iova range */ | 730 | /* we don't need lock here, nobody else touches the iova range */ |
729 | while (start < end) { | 731 | while (npages--) { |
730 | dma_pte_clear_one(domain, start); | 732 | dma_pte_clear_one(domain, start); |
731 | start += VTD_PAGE_SIZE; | 733 | start += VTD_PAGE_SIZE; |
732 | } | 734 | } |