diff options
-rw-r--r-- | drivers/pci/intel-iommu.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index fc593adb049a..21dc77311863 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -3491,7 +3491,7 @@ static int intel_iommu_map_range(struct iommu_domain *domain, | |||
3491 | if ((iommu_prot & IOMMU_CACHE) && dmar_domain->iommu_snooping) | 3491 | if ((iommu_prot & IOMMU_CACHE) && dmar_domain->iommu_snooping) |
3492 | prot |= DMA_PTE_SNP; | 3492 | prot |= DMA_PTE_SNP; |
3493 | 3493 | ||
3494 | max_addr = (iova & VTD_PAGE_MASK) + VTD_PAGE_ALIGN(size); | 3494 | max_addr = iova + size; |
3495 | if (dmar_domain->max_addr < max_addr) { | 3495 | if (dmar_domain->max_addr < max_addr) { |
3496 | int min_agaw; | 3496 | int min_agaw; |
3497 | u64 end; | 3497 | u64 end; |
@@ -3518,16 +3518,12 @@ static void intel_iommu_unmap_range(struct iommu_domain *domain, | |||
3518 | unsigned long iova, size_t size) | 3518 | unsigned long iova, size_t size) |
3519 | { | 3519 | { |
3520 | struct dmar_domain *dmar_domain = domain->priv; | 3520 | struct dmar_domain *dmar_domain = domain->priv; |
3521 | dma_addr_t base; | ||
3522 | 3521 | ||
3523 | /* The address might not be aligned */ | 3522 | dma_pte_clear_range(dmar_domain, iova >> VTD_PAGE_SHIFT, |
3524 | base = iova & VTD_PAGE_MASK; | 3523 | (iova + size - 1) >> VTD_PAGE_SHIFT); |
3525 | size = VTD_PAGE_ALIGN(size); | ||
3526 | dma_pte_clear_range(dmar_domain, base >> VTD_PAGE_SHIFT, | ||
3527 | (base + size - 1) >> VTD_PAGE_SHIFT); | ||
3528 | 3524 | ||
3529 | if (dmar_domain->max_addr == base + size) | 3525 | if (dmar_domain->max_addr == iova + size) |
3530 | dmar_domain->max_addr = base; | 3526 | dmar_domain->max_addr = iova; |
3531 | } | 3527 | } |
3532 | 3528 | ||
3533 | static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain, | 3529 | static phys_addr_t intel_iommu_iova_to_phys(struct iommu_domain *domain, |