diff options
-rw-r--r-- | drivers/iommu/intel-iommu.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 0badfa48b32b..9476c1b96090 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -1827,10 +1827,17 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, | |||
1827 | if (!pte) | 1827 | if (!pte) |
1828 | return -ENOMEM; | 1828 | return -ENOMEM; |
1829 | /* It is large page*/ | 1829 | /* It is large page*/ |
1830 | if (largepage_lvl > 1) | 1830 | if (largepage_lvl > 1) { |
1831 | pteval |= DMA_PTE_LARGE_PAGE; | 1831 | pteval |= DMA_PTE_LARGE_PAGE; |
1832 | else | 1832 | /* Ensure that old small page tables are removed to make room |
1833 | for superpage, if they exist. */ | ||
1834 | dma_pte_clear_range(domain, iov_pfn, | ||
1835 | iov_pfn + lvl_to_nr_pages(largepage_lvl) - 1); | ||
1836 | dma_pte_free_pagetable(domain, iov_pfn, | ||
1837 | iov_pfn + lvl_to_nr_pages(largepage_lvl) - 1); | ||
1838 | } else { | ||
1833 | pteval &= ~(uint64_t)DMA_PTE_LARGE_PAGE; | 1839 | pteval &= ~(uint64_t)DMA_PTE_LARGE_PAGE; |
1840 | } | ||
1834 | 1841 | ||
1835 | } | 1842 | } |
1836 | /* We don't need lock here, nobody else | 1843 | /* We don't need lock here, nobody else |