powerpc: Convert irq_domain_add_legacy_isa use to irq_domain_add_legacy
authorMarc Zyngier <maz@kernel.org>
Thu, 13 Sep 2018 09:42:25 +0000 (10:42 +0100)
committerMarc Zyngier <maz@kernel.org>
Thu, 10 Jun 2021 12:09:16 +0000 (13:09 +0100)
irq_domain_add_legacy_isa is a pain. It only exists for the benefit of
two PPC-specific drivers, and creates an ugly dependency between asm/irq.h
and linux/irqdomain.h

Instead, let's convert these two drivers to irq_domain_add_legacy(),
stop using NUM_ISA_INTERRUPTS by directly setting NR_IRQS_LEGACY.

The dependency cannot be broken yet as there is a lot of PPC-related
code that depends on it, but that's the first step towards it.

A followup patch will remove irq_domain_add_legacy_isa.

Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/powerpc/include/asm/irq.h
arch/powerpc/platforms/ps3/interrupt.c
arch/powerpc/sysdev/i8259.c
arch/powerpc/sysdev/mpic.c
arch/powerpc/sysdev/tsi108_pci.c
arch/powerpc/sysdev/xics/xics-common.c

index b2bd588304300fb706b85c896a6f473095ff4593..c1eda9199214e6f0d80d5f665d5b8da926bc6fff 100644 (file)
@@ -23,8 +23,8 @@ extern atomic_t ppc_n_lost_interrupts;
 /* Total number of virq in the platform */
 #define NR_IRQS                CONFIG_NR_IRQS
 
-/* Same thing, used by the generic IRQ code */
-#define NR_IRQS_LEGACY         NUM_ISA_INTERRUPTS
+/* Number of irqs reserved for a legacy isa controller */
+#define NR_IRQS_LEGACY         16
 
 extern irq_hw_number_t virq_to_hw(unsigned int virq);
 
index e68f4fb1c1f4051de740dcf46d22fcf367dfa469..49871427f599d151b2aacd7cd17da171a765dbdd 100644 (file)
@@ -46,7 +46,7 @@
  * implementation equates HV plug value to Linux virq value, constrains each
  * interrupt to have a system wide unique plug number, and limits the range
  * of the plug values to map into the first dword of the bitmaps.  This
- * gives a usable range of plug values of  {NUM_ISA_INTERRUPTS..63}.  Note
+ * gives a usable range of plug values of  {NR_IRQS_LEGACY..63}.  Note
  * that there is no constraint on how many in this set an individual thread
  * can acquire.
  *
@@ -722,7 +722,7 @@ static unsigned int ps3_get_irq(void)
        }
 
 #if defined(DEBUG)
-       if (unlikely(plug < NUM_ISA_INTERRUPTS || plug > PS3_PLUG_MAX)) {
+       if (unlikely(plug < NR_IRQS_LEGACY || plug > PS3_PLUG_MAX)) {
                dump_bmp(&per_cpu(ps3_private, 0));
                dump_bmp(&per_cpu(ps3_private, 1));
                BUG();
index c1d76c344351c5205b5ee0128ec94c51e5f0055e..dc1a151c63d7e607c90862380944bfa464175c68 100644 (file)
@@ -260,7 +260,8 @@ void i8259_init(struct device_node *node, unsigned long intack_addr)
        raw_spin_unlock_irqrestore(&i8259_lock, flags);
 
        /* create a legacy host */
-       i8259_host = irq_domain_add_legacy_isa(node, &i8259_host_ops, NULL);
+       i8259_host = irq_domain_add_legacy(node, NR_IRQS_LEGACY, 0, 0,
+                                          &i8259_host_ops, NULL);
        if (i8259_host == NULL) {
                printk(KERN_ERR "i8259: failed to allocate irq host !\n");
                return;
index b0426f28946af3c15854c159b810ca68c0eaa0ca..995fb2ada507a28ce6c72248d1f77158bd66bc8b 100644 (file)
@@ -602,7 +602,7 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic)
 /* Find an mpic associated with a given linux interrupt */
 static struct mpic *mpic_find(unsigned int irq)
 {
-       if (irq < NUM_ISA_INTERRUPTS)
+       if (irq < NR_IRQS_LEGACY)
                return NULL;
 
        return irq_get_chip_data(irq);
index 49f9541954f8dbbf5335421907fd842f77b47ba6..042bb38fa5c24d17d6fc72c5c9194f9b53e3024a 100644 (file)
@@ -404,7 +404,8 @@ void __init tsi108_pci_int_init(struct device_node *node)
 {
        DBG("Tsi108_pci_int_init: initializing PCI interrupts\n");
 
-       pci_irq_host = irq_domain_add_legacy_isa(node, &pci_irq_domain_ops, NULL);
+       pci_irq_host = irq_domain_add_legacy(node, NR_IRQS_LEGACY, 0, 0,
+                                            &pci_irq_domain_ops, NULL);
        if (pci_irq_host == NULL) {
                printk(KERN_ERR "pci_irq_host: failed to allocate irq domain!\n");
                return;
index 7e4305c01bacd5e940fb2dbc4a0dff3a71bc035e..fdf8db4444b67d8a15ae75dd18815c477c0eb7b0 100644 (file)
@@ -201,7 +201,7 @@ void xics_migrate_irqs_away(void)
                struct ics *ics;
 
                /* We can't set affinity on ISA interrupts */
-               if (virq < NUM_ISA_INTERRUPTS)
+               if (virq < NR_IRQS_LEGACY)
                        continue;
                /* We only need to migrate enabled IRQS */
                if (!desc->action)