This is a note to let you know that I've just added the patch titled

    [stable PATCH] iommu/vt-d: Fix missing IOTLB flush in intel_iommu_unmap()

to the 3.14-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     iommu-vt-d-fix-missing-iotlb-flush-in-intel_iommu_unmap.patch
and it can be found in the queue-3.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From dw...@infradead.org  Mon Jun  9 15:43:20 2014
From: David Woodhouse <dw...@infradead.org>
Date: Mon, 09 Jun 2014 14:09:53 +0100
Subject: [stable PATCH] iommu/vt-d: Fix missing IOTLB flush in 
intel_iommu_unmap()
To: sta...@kernel.org
Cc: io...@lists.linux-foundation.org
Message-ID: <1402319285.7595.9.ca...@i7.infradead.org>

From: David Woodhouse <dw...@infradead.org>

Based on commit ea8ea460c9ace60bbb5ac6e5521d637d5c15293d upstream

This missing IOTLB flush was added as a minor, inconsequential bug-fix
in commit ea8ea460c ("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.woodho...@intel.com>
---
For 3.14 and earlier. As noted, this fix is in 3.15 already.

 drivers/iommu/intel-iommu.c |   18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -4075,7 +4075,7 @@ static size_t intel_iommu_unmap(struct i
                             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);
@@ -4083,6 +4083,22 @@ static size_t intel_iommu_unmap(struct i
        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;
 }
 


Patches currently in stable-queue which might be from dw...@infradead.org are

queue-3.14/iommu-vt-d-fix-missing-iotlb-flush-in-intel_iommu_unmap.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to