Skip to content

Commit

Permalink
iommu/vt-d: Fix missing IOTLB flush in intel_iommu_unmap()
Browse files Browse the repository at this point in the history
Based on commit ea8ea46 upstream

This missing IOTLB flush was added as a minor, inconsequential bug-fix
in commit ea8ea46 ("iommu/vt-d: Clean up and fix page table clear/free
behaviour") in 3.15. It wasn't originally intended for -stable but a
couple of users have reported issues which turn out to be fixed by
adding the missing flush.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and Greg Kroah-Hartman committed Jun 11, 2014
1 parent f10acdb commit 51d20e1
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion drivers/iommu/intel-iommu.c
Original file line number Diff line number Diff line change
@@ -4075,14 +4075,30 @@ static size_t intel_iommu_unmap(struct iommu_domain *domain,
unsigned long iova, size_t size)
{
struct dmar_domain *dmar_domain = domain->priv;
int order;
int order, iommu_id;

order = dma_pte_clear_range(dmar_domain, iova >> VTD_PAGE_SHIFT,
(iova + size - 1) >> VTD_PAGE_SHIFT);

if (dmar_domain->max_addr == iova + size)
dmar_domain->max_addr = iova;

for_each_set_bit(iommu_id, dmar_domain->iommu_bmp, g_num_of_iommus) {
struct intel_iommu *iommu = g_iommus[iommu_id];
int num, ndomains;

/*
* find bit position of dmar_domain
*/
ndomains = cap_ndoms(iommu->cap);
for_each_set_bit(num, iommu->domain_ids, ndomains) {
if (iommu->domains[num] == dmar_domain)
iommu_flush_iotlb_psi(iommu, num,
iova >> VTD_PAGE_SHIFT,
1 << order, 0);
}
}

return PAGE_SIZE << order;
}

0 comments on commit 51d20e1

Please sign in to comment.