summaryrefslogtreecommitdiff
path: root/drivers/iommu/intel-iommu.c
diff options
context:
space:
mode:
authorMarcel Ziswiler <marcel.ziswiler@toradex.com>2015-12-15 14:51:17 +0100
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2015-12-15 14:51:17 +0100
commite6d111cd909551cec5902358db1e25dcaa8c86bb (patch)
tree99673aec563c76a1a4d7ca2d31b90b47549ae40b /drivers/iommu/intel-iommu.c
parent1dcb97e485420a25461cc44d43f987c8bbf50e7a (diff)
parent07cc49f66973f49a391c91bf4b158fa0f2562ca8 (diff)
Merge tag 'v4.1.15' into toradex_vf_4.1-nextColibri_VF_LinuxImageV2.5Beta3_20151215
This is the 4.1.15 stable release
Diffstat (limited to 'drivers/iommu/intel-iommu.c')
-rw-r--r--drivers/iommu/intel-iommu.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index c23427951ec1..8b0178db6a04 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -2033,15 +2033,19 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn,
return -ENOMEM;
/* It is large page*/
if (largepage_lvl > 1) {
+ unsigned long nr_superpages, end_pfn;
+
pteval |= DMA_PTE_LARGE_PAGE;
lvl_pages = lvl_to_nr_pages(largepage_lvl);
+
+ nr_superpages = sg_res / lvl_pages;
+ end_pfn = iov_pfn + nr_superpages * lvl_pages - 1;
+
/*
* Ensure that old small page tables are
- * removed to make room for superpage,
- * if they exist.
+ * removed to make room for superpage(s).
*/
- dma_pte_free_pagetable(domain, iov_pfn,
- iov_pfn + lvl_pages - 1);
+ dma_pte_free_pagetable(domain, iov_pfn, end_pfn);
} else {
pteval &= ~(uint64_t)DMA_PTE_LARGE_PAGE;
}