Skip to contentSkip to conversation

VT-d: correct a comment and remove an useless if() statement

PATCH In review Chao Gao 4 participants 4 messages Apr 12, 2017 – Apr 13, 2017

lore
Share & tools
lore

Chao Gao

author
#0 lore raw

PATCH v2 1/1 VT-d: correct a comment and remove an useless if() statement

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

---
 xen/drivers/passthrough/vtd/intremap.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
xen/drivers/passthrough/vtd/intremap.c +5 -4
index 699239b..1e0317c 100644
@@ -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);
Signature · 7 lines
1.8.3.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 12.04.17 at 07:35, <[email protected]> wrote:

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

Julien,

I think this is simple enough a change (and an adjustment to a patch which went in just recently) to be allowed in.

Chao,

please remember to Cc Julien on patches which you mean to go in for 4.9.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by on v2 1/1
#3 lore raw
In reply to Chao Gao
Quoted 11 lines

From: Gao, Chao
Sent: Wednesday, April 12, 2017 1:35 PM

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

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
In reply to Jan Beulich

Hi Jan,

Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 12.04.17 at 07:35, <[email protected]> wrote:

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

Quoted 8 lines
Quoted 1 line

Julien,

I think this is simple enough a change (and an adjustment to a patch which went in just recently) to be allowed in.

Cheers,

Quoted 9 lines

Chao,

please remember to Cc Julien on patches which you mean to go in for 4.9.

Jan

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel