All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: "Thomas Gleixner" <tglx@linutronix.de>,
	"Michael Ellerman" <mpe@ellerman.id.au>,
	"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
	"Paul Mackerras" <paulus@samba.org>,
	"Ley Foon Tan" <ley.foon.tan@intel.com>,
	"Chris Zankel" <chris@zankel.net>,
	"Max Filippov" <jcmvbkbc@gmail.com>,
	"Vineet Gupta" <vgupta@synopsys.com>,
	"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
	"Robert Jarzmik" <robert.jarzmik@free.fr>,
	"Russell King" <linux@armlinux.org.uk>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski@canonical.com>,
	"Yoshinori Sato" <ysato@users.sourceforge.jp>,
	"Rich Felker" <dalias@libc.org>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"David Airlie" <airlied@linux.ie>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Rob Clark" <robdclark@gmail.com>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Lee Jones" <lee.jones@linaro.org>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Bartosz Golaszewski" <bgolaszewski@baylibre.com>,
	kernel-team@android.com
Subject: [PATCH 11/39] powerpc: Convert irq_domain_add_legacy_isa use to irq_domain_add_legacy
Date: Thu, 20 May 2021 17:37:23 +0100	[thread overview]
Message-ID: <20210520163751.27325-12-maz@kernel.org> (raw)
In-Reply-To: <20210520163751.27325-1-maz@kernel.org>

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         | 4 ++--
 arch/powerpc/platforms/ps3/interrupt.c | 4 ++--
 arch/powerpc/sysdev/i8259.c            | 3 ++-
 arch/powerpc/sysdev/mpic.c             | 2 +-
 arch/powerpc/sysdev/tsi108_pci.c       | 3 ++-
 arch/powerpc/sysdev/xics/xics-common.c | 2 +-
 6 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h
index b2bd58830430..c1eda9199214 100644
--- a/arch/powerpc/include/asm/irq.h
+++ b/arch/powerpc/include/asm/irq.h
@@ -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);
 
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c
index e68f4fb1c1f4..49871427f599 100644
--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -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();
diff --git a/arch/powerpc/sysdev/i8259.c b/arch/powerpc/sysdev/i8259.c
index c1d76c344351..dc1a151c63d7 100644
--- a/arch/powerpc/sysdev/i8259.c
+++ b/arch/powerpc/sysdev/i8259.c
@@ -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;
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index b0426f28946a..995fb2ada507 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -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);
diff --git a/arch/powerpc/sysdev/tsi108_pci.c b/arch/powerpc/sysdev/tsi108_pci.c
index 49f9541954f8..042bb38fa5c2 100644
--- a/arch/powerpc/sysdev/tsi108_pci.c
+++ b/arch/powerpc/sysdev/tsi108_pci.c
@@ -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;
diff --git a/arch/powerpc/sysdev/xics/xics-common.c b/arch/powerpc/sysdev/xics/xics-common.c
index 7e4305c01bac..fdf8db4444b6 100644
--- a/arch/powerpc/sysdev/xics/xics-common.c
+++ b/arch/powerpc/sysdev/xics/xics-common.c
@@ -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)
-- 
2.30.2


  parent reply	other threads:[~2021-05-20 16:58 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20 16:37 [PATCH 00/39] irqdomain: Simplify interrupt handling Marc Zyngier
2021-05-20 16:37 ` [PATCH 01/39] nios2: Do not include linux/irqdomain.h from asm/irq.h Marc Zyngier
2021-05-20 16:37 ` [PATCH 02/39] staging: octeon-hcd: Directly include linux/of.h Marc Zyngier
2021-05-20 16:37 ` [PATCH 03/39] mfd: ioc3: Directly include linux/irqdomain.h Marc Zyngier
2021-05-21  7:07   ` Lee Jones
2021-05-20 16:37 ` [PATCH 04/39] watchdog/octeon-wdt: " Marc Zyngier
2021-05-20 16:37 ` [PATCH 05/39] irqchip/mips-gic: " Marc Zyngier
2021-05-20 16:37 ` [PATCH 06/39] MIPS: lantiq: Directly include linux/of.h in xway/dma.c Marc Zyngier
2021-05-20 16:37 ` [PATCH 07/39] MIPS: Add missing linux/irqdomain.h includes Marc Zyngier
2021-05-20 16:37 ` [PATCH 08/39] MIPS: Do not include linux/irqdomain.h from asm/irq.h Marc Zyngier
2021-05-20 16:37 ` [PATCH 09/39] powerpc: Add missing linux/{of.h,irqdomain.h} include directives Marc Zyngier
2021-05-20 16:37 ` [PATCH 10/39] scsi/ibmvscsi: Directly include linux/{of.h,irqdomain.h} Marc Zyngier
2021-05-20 16:37 ` Marc Zyngier [this message]
2021-05-20 16:37 ` [PATCH 12/39] powerpc: Drop dependency between asm/irq.h and linux/irqdomain.h Marc Zyngier
2021-05-20 16:37 ` [PATCH 13/39] irqdomain: Kill irq_domain_add_legacy_isa Marc Zyngier
2021-05-20 16:37 ` [PATCH 14/39] irqdomain: Reimplement irq_linear_revmap() with irq_find_mapping() Marc Zyngier
2021-05-20 16:37 ` [PATCH 15/39] powerpc: Move the use of irq_domain_add_nomap() behind a config option Marc Zyngier
2021-05-20 16:37 ` [PATCH 16/39] irqdomain: Make normal and nomap irqdomains exclusive Marc Zyngier
2021-11-15 19:05   ` Cédric Le Goater
2021-11-15 19:05     ` Cédric Le Goater
2021-11-16  8:33     ` Marc Zyngier
2021-11-16  8:33       ` Marc Zyngier
2021-11-16 10:27       ` Cédric Le Goater
2021-11-16 10:27         ` Cédric Le Goater
2021-05-20 16:37 ` [PATCH 17/39] irqdomain: Use struct_size() helper when allocating irqdomain Marc Zyngier
2021-05-20 16:37 ` [PATCH 18/39] irqdomain: Cache irq_data instead of a virq number in the revmap Marc Zyngier
2021-05-20 16:37 ` [PATCH 19/39] irqdomain: Implement irq_domain_clear_mapping() with irq_domain_set_mapping() Marc Zyngier
2021-05-20 16:37 ` [PATCH 20/39] irqdomain: Protect the linear revmap with RCU Marc Zyngier
2021-06-19 11:37   ` Thomas Gleixner
2021-05-20 16:37 ` [PATCH 21/39] irqdomain: Introduce irq_resolve_mapping() Marc Zyngier
2021-06-10  2:22   ` Qian Cai
2021-06-10  7:24     ` Marc Zyngier
2021-05-20 16:37 ` [PATCH 22/39] genirq: Use irq_resolve_mapping() to implement __handle_domain_irq() and co Marc Zyngier
2021-05-20 16:37 ` [PATCH 23/39] irqdesc: Fix __handle_domain_irq() comment Marc Zyngier
2021-05-20 16:37 ` [PATCH 24/39] irqchip/nvic: Convert from handle_IRQ() to handle_domain_irq() Marc Zyngier
2021-05-20 16:37 ` [PATCH 25/39] genirq: Add generic_handle_domain_irq() helper Marc Zyngier
2021-05-20 16:37 ` [PATCH 26/39] genirq: Move non-irqdomain handle_domain_irq() handling into ARM's handle_IRQ() Marc Zyngier
2021-05-20 16:37 ` [PATCH 27/39] irqchip: Bulk conversion to generic_handle_domain_irq() Marc Zyngier
2021-05-21  8:54   ` Geert Uytterhoeven
2021-05-21 21:10   ` Krzysztof Kozlowski
2021-05-20 16:37 ` [PATCH 28/39] gpio: " Marc Zyngier
2021-05-21  8:59   ` Geert Uytterhoeven
2021-05-20 16:37 ` [PATCH 29/39] pinctrl: " Marc Zyngier
2021-05-21 21:16   ` Krzysztof Kozlowski
2021-05-20 16:37 ` [PATCH 30/39] PCI: " Marc Zyngier
2021-05-20 17:47   ` Rob Herring
2021-05-24  8:38     ` Marc Zyngier
2021-05-24 13:28       ` Rob Herring
2021-05-24 15:06         ` Marc Zyngier
2021-05-21  8:57   ` Geert Uytterhoeven
2021-05-20 16:37 ` [PATCH 31/39] mfd: " Marc Zyngier
2021-05-21  7:06   ` Lee Jones
2021-05-20 16:37 ` [PATCH 32/39] gpu: " Marc Zyngier
2021-05-20 16:37 ` [PATCH 33/39] SH: " Marc Zyngier
2021-05-20 16:37 ` [PATCH 34/39] ARM: " Marc Zyngier
2021-05-20 18:04   ` Rob Herring
2021-05-24  8:32     ` Marc Zyngier
2021-05-21 21:17   ` Krzysztof Kozlowski
2021-05-20 16:37 ` [PATCH 35/39] mips: " Marc Zyngier
2021-05-20 16:37 ` [PATCH 36/39] arc: " Marc Zyngier
2021-06-01 18:00   ` Vineet Gupta
2021-05-20 16:37 ` [PATCH 37/39] xtensa: " Marc Zyngier
2021-05-20 16:37 ` [PATCH 38/39] nios2: " Marc Zyngier
2021-05-20 16:37 ` [PATCH 39/39] powerpc: " Marc Zyngier
2021-05-20 23:33 ` [PATCH 00/39] irqdomain: Simplify interrupt handling Linus Walleij
2021-05-24  8:53   ` Marc Zyngier
2021-05-24  9:39     ` Linus Walleij
2021-06-01 14:29 ` Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210520163751.27325-12-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=airlied@linux.ie \
    --cc=alexander.deucher@amd.com \
    --cc=benh@kernel.crashing.org \
    --cc=bgolaszewski@baylibre.com \
    --cc=bhelgaas@google.com \
    --cc=chris@zankel.net \
    --cc=christian.koenig@amd.com \
    --cc=dalias@libc.org \
    --cc=daniel@ffwll.ch \
    --cc=geert@linux-m68k.org \
    --cc=jcmvbkbc@gmail.com \
    --cc=kernel-team@android.com \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=lee.jones@linaro.org \
    --cc=ley.foon.tan@intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=robdclark@gmail.com \
    --cc=robert.jarzmik@free.fr \
    --cc=robh@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=tsbogend@alpha.franken.de \
    --cc=vgupta@synopsys.com \
    --cc=ysato@users.sourceforge.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.