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

[PATCH 1/3] x86/msi: consistently handle BAR mapping failures in MSI-X setup



When setting up an MSI-X vector in msix_capability_init() the error
handling after a BAR mapping failure is different depending on whether
the first page fails or a subsequent page. There's no reason to break
working vectors so consistently use the later error handling
behaviour.

The zap_on_error flag was added as part of XSA-337, beb54596cfda
(x86/MSI-X: restrict reading of table/PBA bases from BARs), but
appears to be unrelated to XSA-337 and is not useful because:

1. table.first and pba.first are not used unless msix->used_vectors > 0.

2. Force disabling MSI-X in this error path is not necessary as the
   per-vector mask is still still set.

Signed-off-by: David Vrabel <dvrabel@xxxxxxxxxxxx>

CR: https://code.amazon.com/reviews/CR-79020908
---
 xen/arch/x86/msi.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index d0bf63df1d..8bde6b9be1 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -776,7 +776,7 @@ static int msix_capability_init(struct pci_dev *dev,
     u8 bus = dev->bus;
     u8 slot = PCI_SLOT(dev->devfn);
     u8 func = PCI_FUNC(dev->devfn);
-    bool maskall = msix->host_maskall, zap_on_error = false;
+    bool maskall = msix->host_maskall;
     unsigned int pos = pci_find_cap_offset(seg, bus, slot, func,
                                            PCI_CAP_ID_MSIX);
 
@@ -875,8 +875,6 @@ static int msix_capability_init(struct pci_dev *dev,
                                   BITS_TO_LONGS(msix->nr_entries) - 1);
         WARN_ON(rangeset_overlaps_range(mmio_ro_ranges, msix->pba.first,
                                         msix->pba.last));
-
-        zap_on_error = true;
     }
     else if ( !msix->table.first )
     {
@@ -897,14 +895,6 @@ static int msix_capability_init(struct pci_dev *dev,
 
         if ( idx < 0 )
         {
-            if ( zap_on_error )
-            {
-                msix->table.first = 0;
-                msix->pba.first = 0;
-
-                control &= ~PCI_MSIX_FLAGS_ENABLE;
-            }
-
             pci_conf_write16(dev->sbdf, msix_control_reg(pos), control);
             xfree(entry);
             return idx;
-- 
2.30.2




 


Rackspace

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