OK, I'm happy to go along with that (it definitely simplifies my
driver code).  Here's the patch.


Remove the call to request_mem_region() in msix_capability_init() to
grab the MSI-X vector table.  Drivers should be using
pci_request_regions() so that they own all of the PCI BARs, and the
MSI-X core should trust it's being called by a correct driver.

Signed-off-by: Roland Dreier <[EMAIL PROTECTED]>

--- linux-orig/drivers/pci/msi.c        (revision 26881)
+++ linux/drivers/pci/msi.c     (working copy)
@@ -616,15 +616,10 @@ static int msix_capability_init(struct p
        bir = (u8)(table_offset & PCI_MSIX_FLAGS_BIRMASK);
        phys_addr = pci_resource_start (dev, bir);
        phys_addr += (u32)(table_offset & ~PCI_MSIX_FLAGS_BIRMASK);
-       if (!request_mem_region(phys_addr,
-               nr_entries * PCI_MSIX_ENTRY_SIZE,
-               "MSI-X vector table"))
-               return -ENOMEM;
        base = ioremap_nocache(phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE);
-       if (base == NULL) {
-               release_mem_region(phys_addr, nr_entries * PCI_MSIX_ENTRY_SIZE);
+       if (base == NULL)
                return -ENOMEM;
-       }
+
        /* MSI-X Table Initialization */
        for (i = 0; i < nvec; i++) {
                entry = alloc_msi_entry();
@@ -859,8 +854,6 @@ static int msi_free_vector(struct pci_de
                        phys_addr += (u32)(table_offset &
                                ~PCI_MSIX_FLAGS_BIRMASK);
                        iounmap(base);
-                       release_mem_region(phys_addr,
-                               nr_entries * PCI_MSIX_ENTRY_SIZE);
                }
        }
 
@@ -1133,8 +1126,6 @@ void msi_remove_pci_irq_vectors(struct p
                        phys_addr += (u32)(table_offset &
                                ~PCI_MSIX_FLAGS_BIRMASK);
                        iounmap(base);
-                       release_mem_region(phys_addr, PCI_MSIX_ENTRY_SIZE *
-                               multi_msix_capable(control));
                        printk(KERN_WARNING "PCI: %s: 
msi_remove_pci_irq_vectors() "
                               "called without free_irq() on all MSI-X 
vectors\n",
                               pci_name(dev));
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to