[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [Patch RFC 04/13] vt-d: Clear invalidation table in invaidation interrupt handler



if it has no in-flight Device-TLB invalidation request.

Signed-off-by: Quan Xu <quan.xu@xxxxxxxxx>
---
 xen/drivers/passthrough/vtd/iommu.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/xen/drivers/passthrough/vtd/iommu.c 
b/xen/drivers/passthrough/vtd/iommu.c
index db6e3a2..0e912fb 100644
--- a/xen/drivers/passthrough/vtd/iommu.c
+++ b/xen/drivers/passthrough/vtd/iommu.c
@@ -1098,6 +1098,28 @@ static void _qi_msi_mask(struct iommu *iommu)
 
 static void _do_iommu_qi(struct iommu *iommu)
 {
+    unsigned long nr_dom, i;
+    struct domain *d = NULL;
+
+    nr_dom = cap_ndoms(iommu->cap);
+    i = find_first_bit(iommu->domid_bitmap, nr_dom);
+    while ( i < nr_dom )
+    {
+        if ( iommu->domid_map[i] > 0 )
+        {
+            d = rcu_lock_domain_by_id(iommu->domid_map[i]);
+            if ( d == NULL )
+                continue;
+
+            if ( qi_table_pollslot(d) == qi_table_data(d) )
+            {
+                qi_table_data(d) = 0;
+                qi_table_pollslot(d) = 0;
+            }
+            rcu_unlock_domain(d);
+        }
+        i = find_next_bit(iommu->domid_bitmap, nr_dom, i+1);
+    }
 }
 
 static void do_iommu_qi_completion(unsigned long data)
-- 
1.8.3.2


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.