Skip to contentSkip to conversation

VT-d: avoid multi-message-MSI check for HPET

PATCH In review Jan Beulich 2 participants 4 messages Apr 1 – Apr 10

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 VT-d: avoid multi-message-MSI check for HPET

Having this immediately below a PCI-dev vs HPET conditional is (mildly) confusing. Move that if() into the body of the earlier one.

xen/drivers/passthrough/vtd/intremap.c +3 -3
@@ -513,13 +513,13 @@ static int msi_msg_to_remap_entry(
 
         if ( rc )
             return rc;
+
+        if ( msi_desc->msi_attrib.type == PCI_CAP_ID_MSI )
+            nr = msi_desc->msi.nvec;
     }
     else
         set_hpet_source_id(msi_desc->hpet_id, &new_ire);
 
-    if ( msi_desc->msi_attrib.type == PCI_CAP_ID_MSI )
-        nr = msi_desc->msi.nvec;
-
     spin_lock_irqsave(&iommu->intremap.lock, flags);
 
     if ( msg == NULL )
#1 lore raw
Quoted 11 lines · Jan Beulich

Having this immediately below a PCI-dev vs HPET conditional is (mildly) confusing. Move that if() into the body of the earlier one.

xen/drivers/passthrough/vtd/intremap.c +0 -0
@@ -513,13 +513,13 @@ static int msi_msg_to_remap_entry(
 
         if ( rc )
             return rc;

xen/drivers/passthrough/vtd/intremap.c static int msi_msg_to_remap_entry( · line 522

Quoted 10 lines
xen/drivers/passthrough/vtd/intremap.c +3 -3
+
+        if ( msi_desc->msi_attrib.type == PCI_CAP_ID_MSI )
+            nr = msi_desc->msi.nvec;
     }
     else
         set_hpet_source_id(msi_desc->hpet_id, &new_ire);
 
-    if ( msi_desc->msi_attrib.type == PCI_CAP_ID_MSI )
-        nr = msi_desc->msi.nvec;
-

I'm not fully opposed to this, but maybe it would be good to add a small comment to note that HPET never use multi-vector MSI?

Thanks, Roger.

#2 lore raw
Quoted 19 lines · Roger Pau Monné
Quoted 18 lines · Jan Beulich

Having this immediately below a PCI-dev vs HPET conditional is (mildly) confusing. Move that if() into the body of the earlier one.

xen/drivers/passthrough/vtd/intremap.c +3 -0
@@ -513,13 +513,13 @@ static int msi_msg_to_remap_entry(
 
         if ( rc )
             return rc;
+
+        if ( msi_desc->msi_attrib.type == PCI_CAP_ID_MSI )
+            nr = msi_desc->msi.nvec;
     }
     else
         set_hpet_source_id(msi_desc->hpet_id, &new_ire);
 
Quoted 6 lines

xen/drivers/passthrough/vtd/intremap.c static int msi_msg_to_remap_entry( · line 522

Quoted 3 lines
xen/drivers/passthrough/vtd/intremap.c +0 -3
-    if ( msi_desc->msi_attrib.type == PCI_CAP_ID_MSI )
-        nr = msi_desc->msi.nvec;
-

I'm not fully opposed to this, but maybe it would be good to add a small comment to note that HPET never use multi-vector MSI?

That aspect doesn't change - HPET code simply doesn't (and never should) set .type to PCI_CAP_ID_MSI. That field should reflect reality (and HPET, iirc, simply leaves it at 0).

Jan

#3 lore raw
Quoted 27 lines · Jan Beulich
Quoted 19 lines · Roger Pau Monné
Quoted 18 lines · Jan Beulich

Having this immediately below a PCI-dev vs HPET conditional is (mildly) confusing. Move that if() into the body of the earlier one.

xen/drivers/passthrough/vtd/intremap.c +3 -0
@@ -513,13 +513,13 @@ static int msi_msg_to_remap_entry(
 
         if ( rc )
             return rc;
+
+        if ( msi_desc->msi_attrib.type == PCI_CAP_ID_MSI )
+            nr = msi_desc->msi.nvec;
     }
     else
         set_hpet_source_id(msi_desc->hpet_id, &new_ire);
 
Quoted 6 lines

xen/drivers/passthrough/vtd/intremap.c static int msi_msg_to_remap_entry( · line 522

Quoted 3 lines
xen/drivers/passthrough/vtd/intremap.c +0 -3
-    if ( msi_desc->msi_attrib.type == PCI_CAP_ID_MSI )
-        nr = msi_desc->msi.nvec;
-

I'm not fully opposed to this, but maybe it would be good to add a small comment to note that HPET never use multi-vector MSI?

Quoted 3 lines

That aspect doesn't change - HPET code simply doesn't (and never should) set .type to PCI_CAP_ID_MSI. That field should reflect reality (and HPET, iirc, simply leaves it at 0).

Hm, I see, HPET is a very special case which have been "adjusted" to fit the MSI generation logic.

Thanks, Roger.