x86/MSI: Use new irqdomain interfaces to allocate/free IRQ
authorJiang Liu <[email protected]>
Mon, 13 Apr 2015 06:11:26 +0000 (14:11 +0800)
committerThomas Gleixner <[email protected]>
Fri, 24 Apr 2015 13:36:48 +0000 (15:36 +0200)
Use new irqdomain interfaces to allocate/free IRQ for PCI MSI, so we
can remove GENERIC_IRQ_LEGACY_ALLOC_HWIRQ later.

Signed-off-by: Jiang Liu <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: David Cohen <[email protected]>
Cc: Sander Eikelenboom <[email protected]>
Cc: David Vrabel <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: Joerg Roedel <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Bjorn Helgaas <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Rafael J. Wysocki <[email protected]>
Cc: Randy Dunlap <[email protected]>
Cc: Yinghai Lu <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Dimitri Sivanich <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Thomas Gleixner <[email protected]>
arch/x86/kernel/apic/msi.c

index d6ba2d660dc52f59945825ef80a66821d5a971a5..76cc2c902176c60f3c804e8c6180ff1aed8fbf78 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/dmar.h>
 #include <linux/hpet.h>
 #include <linux/msi.h>
+#include <linux/irqdomain.h>
 #include <asm/msidef.h>
 #include <asm/hpet.h>
 #include <asm/hw_irq.h>
@@ -146,23 +147,20 @@ int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc,
 int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 {
        struct msi_desc *msidesc;
-       unsigned int irq;
-       int node, ret;
+       int irq, ret;
 
        /* Multiple MSI vectors only supported with interrupt remapping */
        if (type == PCI_CAP_ID_MSI && nvec > 1)
                return 1;
 
-       node = dev_to_node(&dev->dev);
-
        list_for_each_entry(msidesc, &dev->msi_list, list) {
-               irq = irq_alloc_hwirq(node);
-               if (!irq)
+               irq = irq_domain_alloc_irqs(NULL, 1, NUMA_NO_NODE, NULL);
+               if (irq <= 0)
                        return -ENOSPC;
 
                ret = setup_msi_irq(dev, msidesc, irq, 0);
                if (ret < 0) {
-                       irq_free_hwirq(irq);
+                       irq_domain_free_irqs(irq, 1);
                        return ret;
                }
 
@@ -172,7 +170,7 @@ int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 
 void native_teardown_msi_irq(unsigned int irq)
 {
-       irq_free_hwirq(irq);
+       irq_domain_free_irqs(irq, 1);
 }
 
 #ifdef CONFIG_DMAR_TABLE