deferred_flush[] uses the iommu seq_id to index, so its iommu is fixed and can 
get it from g_iommus.

Signed-off-by: Weidong Han <[EMAIL PROTECTED]>
---
 drivers/pci/intel-iommu.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 3414708..d7dda66 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -2099,10 +2099,11 @@ static void flush_unmaps(void)
 
        /* just flush them all */
        for (i = 0; i < g_num_of_iommus; i++) {
-               if (deferred_flush[i].next) {
-                       struct intel_iommu *iommu =
-                               deferred_flush[i].domain[0]->iommu;
+               struct intel_iommu *iommu = g_iommus[i];
+               if (!iommu)
+                       continue;
 
+               if (deferred_flush[i].next) {
                        iommu->flush.flush_iotlb(iommu, 0, 0, 0,
                                                 DMA_TLB_GLOBAL_FLUSH, 0);
                        for (j = 0; j < deferred_flush[i].next; j++) {
-- 
1.6.0.4

Attachment: 0004-get-iommu-from-g_iommus-for-deferred-flush.patch
Description: 0004-get-iommu-from-g_iommus-for-deferred-flush.patch

Reply via email to