]> xenbits.xensource.com Git - xen.git/commitdiff
IOMMU/MMU: propagate IOMMU Device-TLB flush error up to iommu_iotlb_flush{,_all}...
authorQuan Xu <quan.xu@intel.com>
Fri, 17 Jun 2016 08:24:56 +0000 (10:24 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 17 Jun 2016 08:24:56 +0000 (10:24 +0200)
Signed-off-by: Quan Xu <quan.xu@intel.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/arm/p2m.c
xen/common/memory.c
xen/drivers/passthrough/iommu.c
xen/drivers/passthrough/x86/iommu.c
xen/include/xen/iommu.h

index 6a19c57d74e3d298b9e4a4c9b0ea1cb07b19e2b9..65d8f1af585ebac782f7373134d315a474f4724f 100644 (file)
@@ -1178,7 +1178,9 @@ out:
     if ( flush )
     {
         flush_tlb_domain(d);
-        iommu_iotlb_flush(d, sgfn, egfn - sgfn);
+        ret = iommu_iotlb_flush(d, sgfn, egfn - sgfn);
+        if ( !rc )
+            rc = ret;
     }
 
     while ( (pg = page_list_remove_head(&free_pages)) )
index ccc643664d11301b2f3458bcabbe980f46e302b9..46b1d9f5126f791358c203d1025903d123d63cd2 100644 (file)
@@ -683,9 +683,17 @@ static int xenmem_add_to_physmap(struct domain *d,
 #ifdef CONFIG_HAS_PASSTHROUGH
     if ( need_iommu(d) )
     {
+        int ret;
+
         this_cpu(iommu_dont_flush_iotlb) = 0;
-        iommu_iotlb_flush(d, xatp->idx - done, done);
-        iommu_iotlb_flush(d, xatp->gpfn - done, done);
+
+        ret = iommu_iotlb_flush(d, xatp->idx - done, done);
+        if ( unlikely(ret) && rc >= 0 )
+            rc = ret;
+
+        ret = iommu_iotlb_flush(d, xatp->gpfn - done, done);
+        if ( unlikely(ret) && rc >= 0 )
+            rc = ret;
     }
 #endif
 
index ec85352ab2cfd3424dbf72cd5d7cbcdc49862f1d..3a73fab4ac835a307492c1cf9601d216e6af553d 100644 (file)
@@ -311,24 +311,29 @@ static void iommu_free_pagetables(unsigned long unused)
                             cpumask_cycle(smp_processor_id(), &cpu_online_map));
 }
 
-void iommu_iotlb_flush(struct domain *d, unsigned long gfn, unsigned int page_count)
+int iommu_iotlb_flush(struct domain *d, unsigned long gfn,
+                      unsigned int page_count)
 {
     const struct domain_iommu *hd = dom_iommu(d);
 
     if ( !iommu_enabled || !hd->platform_ops || !hd->platform_ops->iotlb_flush )
-        return;
+        return 0;
 
     hd->platform_ops->iotlb_flush(d, gfn, page_count);
+
+    return 0;
 }
 
-void iommu_iotlb_flush_all(struct domain *d)
+int iommu_iotlb_flush_all(struct domain *d)
 {
     const struct domain_iommu *hd = dom_iommu(d);
 
     if ( !iommu_enabled || !hd->platform_ops || !hd->platform_ops->iotlb_flush_all )
-        return;
+        return 0;
 
     hd->platform_ops->iotlb_flush_all(d);
+
+    return 0;
 }
 
 int __init iommu_setup(void)
index b64b98f0de083bdbeeb0690264f2d6e763a43e77..a18a6089127f694985192e362dbfd42e1bb41b84 100644 (file)
@@ -104,8 +104,9 @@ int arch_iommu_populate_page_table(struct domain *d)
     this_cpu(iommu_dont_flush_iotlb) = 0;
 
     if ( !rc )
-        iommu_iotlb_flush_all(d);
-    else if ( rc != -ERESTART )
+        rc = iommu_iotlb_flush_all(d);
+
+    if ( rc && rc != -ERESTART )
         iommu_teardown(d);
 
     return rc;
index 2b86710222856e376eb2df5fa2043a4df3a87ff8..57c9fbc2c219624afc7ea83870f21c3da3eea54d 100644 (file)
@@ -200,8 +200,9 @@ int iommu_do_pci_domctl(struct xen_domctl *, struct domain *d,
 int iommu_do_domctl(struct xen_domctl *, struct domain *d,
                     XEN_GUEST_HANDLE_PARAM(xen_domctl_t));
 
-void iommu_iotlb_flush(struct domain *d, unsigned long gfn, unsigned int page_count);
-void iommu_iotlb_flush_all(struct domain *d);
+int __must_check iommu_iotlb_flush(struct domain *d, unsigned long gfn,
+                                   unsigned int page_count);
+int __must_check iommu_iotlb_flush_all(struct domain *d);
 
 /*
  * The purpose of the iommu_dont_flush_iotlb optional cpu flag is to