]> xenbits.xensource.com Git - xen.git/commitdiff
VT-d: correct a comment and remove an useless if() statement
authorChao Gao <chao.gao@intel.com>
Thu, 13 Apr 2017 15:34:29 +0000 (17:34 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 13 Apr 2017 15:34:29 +0000 (17:34 +0200)
Fix two flaws in the patch (93358e8e VT-d: introduce update_irte to update
irte safely):
1. Expand a comment in update_irte() to make it clear that VT-d hardware
doesn't update IRTE and software can't update IRTE behind us since we hold
iremap_lock.
2. remove an useless if() statement

Signed-off-by: Chao Gao <chao.gao@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
Release-acked-by: Julien Grall <julien.grall@arm.com>
xen/drivers/passthrough/vtd/intremap.c

index 699239b00692b35a96bafb859a19d12487707633..1e0317c47ac8ba89c4db86f62d8966cc2eff0c1e 100644 (file)
@@ -200,8 +200,10 @@ static void update_irte(struct iommu *iommu, struct iremap_entry *entry,
     else
     {
         /*
-         * If the caller requests an atomic update but we can't meet it, 
-         * a bug will be raised.
+         * VT-d hardware doesn't update IRTEs behind us, nor the software
+         * since we hold iremap_lock. If the caller wants VT-d hardware to
+         * always see a consistent entry, but we can't meet it, a bug will
+         * be raised.
          */
         if ( entry->lo == new_ire->lo )
             write_atomic(&entry->hi, new_ire->hi);
@@ -690,8 +692,7 @@ static int msi_msg_to_remap_entry(
     remap_rte->data = index - i;
 
     update_irte(iommu, iremap_entry, &new_ire, msi_desc->irte_initialized);
-    if ( !msi_desc->irte_initialized )
-        msi_desc->irte_initialized = true;
+    msi_desc->irte_initialized = true;
 
     iommu_flush_cache_entry(iremap_entry, sizeof(*iremap_entry));
     iommu_flush_iec_index(iommu, 0, index);