Skip to contentSkip to conversation

ARM: footbridge: convert to sparse IRQs

PATCH In review Ethan Nelson-Moore 4 participants 7 messages May 10 – Jun 10

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: footbridge: convert to sparse IRQs

To improve future maintainability, change the interrupt handling for mach-footbridge to use sparse IRQs.

Since the number of possible interrupts is already fixed and relatively small, just make it use all legacy interrupts preallocated using the .nr_irqs field in the machine descriptor, rather than actually allocating domains on the fly.

Many files had to be adjusted to include <mach/irqs.h> explicitly because it is no longer implicitly included with sparse IRQs.

Description adapted from commit c78a41fc04f0 ("ARM: s3c24xx: convert to sparse-irq").

---
This commit depends on my previous submission "ARM: <asm/floppy.h>: fix build with sparse IRQs".

 arch/arm/Kconfig                             | 2 +-
 arch/arm/include/asm/irq.h                   | 4 +++-
 arch/arm/mach-footbridge/dc21285-timer.c     | 2 +-
 arch/arm/mach-footbridge/dc21285.c           | 2 +-
 arch/arm/mach-footbridge/ebsa285-pci.c       | 2 +-
 arch/arm/mach-footbridge/ebsa285.c           | 2 ++
 arch/arm/mach-footbridge/include/mach/irqs.h | 4 +---
 arch/arm/mach-footbridge/isa-irq.c           | 2 +-
 arch/arm/mach-footbridge/isa-timer.c         | 2 +-
 arch/arm/mach-footbridge/isa.c               | 2 +-
 arch/arm/mach-footbridge/netwinder-hw.c      | 2 ++
 arch/arm/mach-footbridge/netwinder-pci.c     | 2 +-
 drivers/char/nwbutton.c                      | 2 +-
 drivers/input/serio/i8042-io.h               | 6 +++---
 drivers/tty/serial/21285.c                   | 2 +-
 15 files changed, 21 insertions(+), 17 deletions(-)
arch/arm/Kconfig +1 -1
index 09b2767fee0f..1155c78bb6aa 100644
@@ -153,7 +153,7 @@ config ARM
 	select PCI_SYSCALL if PCI
 	select PERF_USE_VMALLOC
 	select RTC_LIB
-	select SPARSE_IRQ if !ARCH_FOOTBRIDGE
+	select SPARSE_IRQ
 	select SYS_SUPPORTS_APM_EMULATION
 	select THREAD_INFO_IN_TASK
 	select TIMER_OF if OF
arch/arm/include/asm/irq.h +3 -1
index 26c1d2ced4ce..08589b88c3b9 100644
@@ -10,7 +10,9 @@
 #define NR_IRQS NR_IRQS_LEGACY
 #endif
 
-#ifndef irq_canonicalize
+#ifdef CONFIG_ARCH_FOOTBRIDGE
+#define irq_canonicalize(i)	(((i) == 2) ? 9 : i)
+#else
 #define irq_canonicalize(i)	(i)
 #endif
 
arch/arm/mach-footbridge/dc21285-timer.c +1 -1
index 2908c9ef3c9b..7d7ad1c1ef3f 100644
@@ -12,7 +12,7 @@
 #include <linux/irq.h>
 #include <linux/sched_clock.h>
 
-#include <asm/irq.h>
+#include <mach/irqs.h>
 
 #include <asm/hardware/dec21285.h>
 #include <asm/mach/time.h>
arch/arm/mach-footbridge/dc21285.c +1 -1
index e1b336624883..ffdecfadc9e2 100644
@@ -17,7 +17,7 @@
 #include <linux/io.h>
 #include <linux/spinlock.h>
 
-#include <asm/irq.h>
+#include <mach/irqs.h>
 #include <asm/mach/pci.h>
 #include <asm/hardware/dec21285.h>
 
arch/arm/mach-footbridge/ebsa285-pci.c +1 -1
index c3f280d08fa7..d2168660dd01 100644
@@ -10,7 +10,7 @@
 #include <linux/pci.h>
 #include <linux/init.h>
 
-#include <asm/irq.h>
+#include <mach/irqs.h>
 #include <asm/mach/pci.h>
 #include <asm/mach-types.h>
 
arch/arm/mach-footbridge/ebsa285.c +2 -0
index 1cb7d674bc81..a820f7467468 100644
@@ -10,6 +10,7 @@
 #include <linux/slab.h>
 #include <linux/leds.h>
 
+#include <mach/irqs.h>
 #include <asm/hardware/dec21285.h>
 #include <asm/mach-types.h>
 
@@ -117,6 +118,7 @@ MACHINE_START(EBSA285, "EBSA285")
 	.video_end	= 0x000bffff,
 	.map_io		= footbridge_map_io,
 	.init_early	= footbridge_sched_clock,
+	.nr_irqs	= FOOTBRIDGE_NR_IRQS,
 	.init_irq	= footbridge_init_irq,
 	.init_time	= footbridge_timer_init,
 	.restart	= footbridge_restart,
arch/arm/mach-footbridge/include/mach/irqs.h +1 -3
index a5f41846ab9c..10f1fbc24012 100644
@@ -11,7 +11,7 @@
  */
 #include <asm/mach-types.h>
 
-#define NR_IRQS			36
+#define FOOTBRIDGE_NR_IRQS	36
 #define NR_DC21285_IRQS		16
 
 #define _ISA_IRQ(x)		(0 + (x))
@@ -93,5 +93,3 @@
 #define I8042_KBD_IRQ	IRQ_ISA_KEYBOARD
 #define I8042_AUX_IRQ	(machine_is_netwinder() ? IRQ_NETWINDER_PS2MOUSE : IRQ_ISA_PS2MOUSE)
 #define IRQ_FLOPPYDISK	IRQ_ISA_FLOPPY
-
-#define irq_canonicalize(_i)	(((_i) == IRQ_ISA_CASCADE) ? IRQ_ISA_2 : _i)
arch/arm/mach-footbridge/isa-irq.c +1 -1
index 842ddb4121ef..e4e71bdf1dc7 100644
@@ -21,8 +21,8 @@
 #include <asm/mach/irq.h>
 
 #include <mach/hardware.h>
+#include <mach/irqs.h>
 #include <asm/hardware/dec21285.h>
-#include <asm/irq.h>
 #include <asm/mach-types.h>
 
 #include "common.h"
arch/arm/mach-footbridge/isa-timer.c +1 -1
index 723e3eae995d..07dee61b0b03 100644
@@ -13,7 +13,7 @@
 #include <linux/spinlock.h>
 #include <linux/timex.h>
 
-#include <asm/irq.h>
+#include <mach/irqs.h>
 #include <asm/mach/time.h>
 
 #include "common.h"
arch/arm/mach-footbridge/isa.c +1 -1
index 84caccddce44..1e7b0f5fb111 100644
@@ -7,7 +7,7 @@
 #include <linux/init.h>
 #include <linux/serial_8250.h>
 
-#include <asm/irq.h>
+#include <mach/irqs.h>
 #include <asm/hardware/dec21285.h>
 
 #include "common.h"
arch/arm/mach-footbridge/netwinder-hw.c +2 -0
index c024eefd4978..ab17ba916d47 100644
@@ -16,6 +16,7 @@
 #include <linux/slab.h>
 #include <linux/leds.h>
 
+#include <mach/irqs.h>
 #include <asm/hardware/dec21285.h>
 #include <asm/mach-types.h>
 #include <asm/setup.h>
@@ -766,6 +767,7 @@ MACHINE_START(NETWINDER, "Rebel-NetWinder")
 	.reserve_lp2	= 1,
 	.fixup		= fixup_netwinder,
 	.map_io		= footbridge_map_io,
+	.nr_irqs	= FOOTBRIDGE_NR_IRQS,
 	.init_irq	= footbridge_init_irq,
 	.init_time	= isa_timer_init,
 	.restart	= netwinder_restart,
arch/arm/mach-footbridge/netwinder-pci.c +1 -1
index e8304392074b..bfd5c0606c71 100644
@@ -10,7 +10,7 @@
 #include <linux/pci.h>
 #include <linux/init.h>
 
-#include <asm/irq.h>
+#include <mach/irqs.h>
 #include <asm/mach/pci.h>
 #include <asm/mach-types.h>
 
drivers/char/nwbutton.c +1 -1
index 92cee5717237..99819b184aac 100644
@@ -18,7 +18,7 @@
 #include <linux/init.h>
 
 #include <linux/uaccess.h>
-#include <asm/irq.h>
+#include <mach/irqs.h>
 #include <asm/mach-types.h>
 
 #define __NWBUTTON_C		/* Tell the header file who we are */
drivers/input/serio/i8042-io.h +3 -3
index a8f4b2d70e59..cea72bd888af 100644
@@ -15,9 +15,9 @@
  * IRQs.
  */
 
-#if defined(__arm__)
-/* defined in include/asm-arm/arch-xxx/irqs.h */
-#include <asm/irq.h>
+#ifdef CONFIG_ARCH_FOOTBRIDGE
+/* defined in arch/arm/mach-footbridge/include/mach/irqs.h */
+#include <mach/irqs.h>
 #elif defined(CONFIG_PPC)
 extern int of_i8042_kbd_irq;
 extern int of_i8042_aux_irq;
drivers/tty/serial/21285.c +1 -1
index 4de0c975ebdc..f0c63875912e 100644
@@ -15,11 +15,11 @@
 #include <linux/serial.h>
 #include <linux/io.h>
 
-#include <asm/irq.h>
 #include <asm/mach-types.h>
 #include <asm/system_info.h>
 #include <asm/hardware/dec21285.h>
 #include <mach/hardware.h>
+#include <mach/irqs.h>
 
 #define BAUD_BASE		(mem_fclk_21285/64)
 
Signature · 1 line
2.43.0
#1 lore raw
Quoted 8 lines · Ethan Nelson-Moore

To improve future maintainability, change the interrupt handling for mach-footbridge to use sparse IRQs.

Since the number of possible interrupts is already fixed and relatively small, just make it use all legacy interrupts preallocated using the .nr_irqs field in the machine descriptor, rather than actually allocating domains on the fly.

Quoted 8 lines

Many files had to be adjusted to include <mach/irqs.h> explicitly because it is no longer implicitly included with sparse IRQs.

Description adapted from commit c78a41fc04f0 ("ARM: s3c24xx: convert to sparse-irq").

Have you tested this on real hardware?
The commit doesn't really say.

I might have to dig out my NetWinder to test this.

Yours,
Linus Walleij

#2 lore raw

Hi, Linus,

Quoted 2 lines · Linus Walleij

Have you tested this on real hardware?
The commit doesn't really say.

No, I haven't. I can try to test it in GXemul, but I'm not sure if it can boot Linux. The developer only lists it as capable of booting NetBSD.

Ethan

maintainer
#3 lore raw
In reply to Ethan Nelson-Moore

Hi Ethan,

Quoted 7 lines · Ethan Nelson-Moore
drivers/input/serio/i8042-io.h +0 -0
index a8f4b2d70e59..cea72bd888af 100644
@@ -15,9 +15,9 @@
  * IRQs.
  */

drivers/input/serio/i8042-io.h line 23

Quoted 10 lines
drivers/input/serio/i8042-io.h +3 -3
 
-#if defined(__arm__)
-/* defined in include/asm-arm/arch-xxx/irqs.h */
-#include <asm/irq.h>
+#ifdef CONFIG_ARCH_FOOTBRIDGE
+/* defined in arch/arm/mach-footbridge/include/mach/irqs.h */
+#include <mach/irqs.h>
 #elif defined(CONFIG_PPC)
 extern int of_i8042_kbd_irq;
 extern int of_i8042_aux_irq;

This does not look right. Did you mean to drop inclusion of asm/irq.h for all other arms?

Thanks.

Signature · 1 line
Dmitry
maintainer
#4 lore raw
Quoted 4 lines · Dmitry Torokhov
Quoted 3 lines · Ethan Nelson-Moore
drivers/input/serio/i8042-io.h +0 -0
index a8f4b2d70e59..cea72bd888af 100644
Quoted 12 lines

drivers/input/serio/i8042-io.h line 23

Quoted 9 lines
drivers/input/serio/i8042-io.h +3 -3
-#if defined(__arm__)
-/* defined in include/asm-arm/arch-xxx/irqs.h */
-#include <asm/irq.h>
+#ifdef CONFIG_ARCH_FOOTBRIDGE
+/* defined in arch/arm/mach-footbridge/include/mach/irqs.h */
+#include <mach/irqs.h>
 #elif defined(CONFIG_PPC)
 extern int of_i8042_kbd_irq;
 extern int of_i8042_aux_irq;

This does not look right. Did you mean to drop inclusion of asm/irq.h for all other arms?

I think this is correct, as footbridge is the only one that selects CONFIG_ARCH_MIGHT_HAVE_PC_SERIO and defines I8042_KBD_IRQ on arm.

Arnd

#5 lore raw

Hi, Arnd,

Quoted 2 lines · Arnd Bergmann

I think this is correct, as footbridge is the only one that selects CONFIG_ARCH_MIGHT_HAVE_PC_SERIO and defines I8042_KBD_IRQ on arm.

I came to the same conclusion.

Ethan

maintainer Acked-by
#6 lore raw
Quoted 7 lines · Ethan Nelson-Moore

Hi, Arnd,

Quoted 2 lines · Arnd Bergmann

I think this is correct, as footbridge is the only one that selects CONFIG_ARCH_MIGHT_HAVE_PC_SERIO and defines I8042_KBD_IRQ on arm.

I came to the same conclusion.

I see. In this case:

Thanks.

Signature · 1 line
Dmitry