diff options
-rw-r--r-- | drivers/pci/intel-iommu.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 5493c79dde47..52026d1797ec 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -735,7 +735,7 @@ static struct dma_pte *pfn_to_dma_pte(struct dmar_domain *domain, | |||
735 | return NULL; | 735 | return NULL; |
736 | 736 | ||
737 | domain_flush_cache(domain, tmp_page, VTD_PAGE_SIZE); | 737 | domain_flush_cache(domain, tmp_page, VTD_PAGE_SIZE); |
738 | pteval = (virt_to_dma_pfn(tmp_page) << VTD_PAGE_SHIFT) | DMA_PTE_READ | DMA_PTE_WRITE; | 738 | pteval = ((uint64_t)virt_to_dma_pfn(tmp_page) << VTD_PAGE_SHIFT) | DMA_PTE_READ | DMA_PTE_WRITE; |
739 | if (cmpxchg64(&pte->val, 0ULL, pteval)) { | 739 | if (cmpxchg64(&pte->val, 0ULL, pteval)) { |
740 | /* Someone else set it while we were thinking; use theirs. */ | 740 | /* Someone else set it while we were thinking; use theirs. */ |
741 | free_pgtable_page(tmp_page); | 741 | free_pgtable_page(tmp_page); |
@@ -2648,10 +2648,9 @@ static void flush_unmaps(void) | |||
2648 | unsigned long mask; | 2648 | unsigned long mask; |
2649 | struct iova *iova = deferred_flush[i].iova[j]; | 2649 | struct iova *iova = deferred_flush[i].iova[j]; |
2650 | 2650 | ||
2651 | mask = (iova->pfn_hi - iova->pfn_lo + 1) << PAGE_SHIFT; | 2651 | mask = ilog2(mm_to_dma_pfn(iova->pfn_hi - iova->pfn_lo + 1)); |
2652 | mask = ilog2(mask >> VTD_PAGE_SHIFT); | ||
2653 | iommu_flush_dev_iotlb(deferred_flush[i].domain[j], | 2652 | iommu_flush_dev_iotlb(deferred_flush[i].domain[j], |
2654 | iova->pfn_lo << PAGE_SHIFT, mask); | 2653 | (uint64_t)iova->pfn_lo << PAGE_SHIFT, mask); |
2655 | __free_iova(&deferred_flush[i].domain[j]->iovad, iova); | 2654 | __free_iova(&deferred_flush[i].domain[j]->iovad, iova); |
2656 | } | 2655 | } |
2657 | deferred_flush[i].next = 0; | 2656 | deferred_flush[i].next = 0; |