Skip to contentSkip to conversation

ARM: integrator: convert to sparse irqs

PATCH New Linus Walleij 3 participants 7 messages Feb 24, 2012 – Feb 27, 2012

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

PATCH 1/1 ARM: integrator: convert to sparse irqs

This converts the Integrator AP/CP to use sparse IRQs. Tested on both machines.

---
 arch/arm/Kconfig                             |    1 +
 arch/arm/mach-integrator/core.c              |    3 ++-
 arch/arm/mach-integrator/include/mach/irqs.h |    3 ++-
 arch/arm/mach-integrator/integrator_ap.c     |    3 ++-
 arch/arm/mach-integrator/integrator_cp.c     |    3 ++-
 arch/arm/mach-integrator/pci.c               |    3 ++-
 arch/arm/mach-integrator/pci_v3.c            |    3 ++-
 7 files changed, 13 insertions(+), 6 deletions(-)
arch/arm/Kconfig +1 -0
index 4852a6b..fc10ed8 100644
@@ -266,6 +266,7 @@ config ARCH_INTEGRATOR
 	select PLAT_VERSATILE
 	select PLAT_VERSATILE_FPGA_IRQ
 	select NEED_MACH_MEMORY_H
+	select SPARSE_IRQ
 	help
 	  Support for ARM's Integrator platform.
 
arch/arm/mach-integrator/core.c +2 -1
index 15b87f2..304dfb2 100644
@@ -25,8 +25,9 @@
 
 #include <mach/hardware.h>
 #include <mach/platform.h>
-#include <asm/irq.h>
 #include <mach/cm.h>
+#include <mach/irqs.h>
+
 #include <asm/system.h>
 #include <asm/leds.h>
 #include <asm/mach-types.h>
arch/arm/mach-integrator/include/mach/irqs.h +2 -1
index 1fbe6d1..a19a1a2 100644
@@ -78,5 +78,6 @@
 #define IRQ_SIC_CP_LMINT7		46
 #define IRQ_SIC_END			46
 
-#define NR_IRQS                         47
+#define NR_IRQS_INTEGRATOR_AP		34
+#define NR_IRQS_INTEGRATOR_CP		47
 
arch/arm/mach-integrator/integrator_ap.c +2 -1
index 4dde28b..871f148 100644
@@ -38,13 +38,13 @@
 #include <mach/hardware.h>
 #include <mach/platform.h>
 #include <asm/hardware/arm_timer.h>
-#include <asm/irq.h>
 #include <asm/setup.h>
 #include <asm/param.h>		/* HZ */
 #include <asm/mach-types.h>
 #include <asm/sched_clock.h>
 
 #include <mach/lm.h>
+#include <mach/irqs.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/irq.h>
@@ -475,6 +475,7 @@ MACHINE_START(INTEGRATOR, "ARM-Integrator")
 	.atag_offset	= 0x100,
 	.reserve	= integrator_reserve,
 	.map_io		= ap_map_io,
+	.nr_irqs	= NR_IRQS_INTEGRATOR_AP,
 	.init_early	= integrator_init_early,
 	.init_irq	= ap_init_irq,
 	.timer		= &ap_timer,
arch/arm/mach-integrator/integrator_cp.c +2 -1
index be9ead4..48a115a 100644
@@ -26,7 +26,6 @@
 
 #include <mach/hardware.h>
 #include <mach/platform.h>
-#include <asm/irq.h>
 #include <asm/setup.h>
 #include <asm/mach-types.h>
 #include <asm/hardware/arm_timer.h>
@@ -34,6 +33,7 @@
 
 #include <mach/cm.h>
 #include <mach/lm.h>
+#include <mach/irqs.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/irq.h>
@@ -464,6 +464,7 @@ MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
 	.atag_offset	= 0x100,
 	.reserve	= integrator_reserve,
 	.map_io		= intcp_map_io,
+	.nr_irqs	= NR_IRQS_INTEGRATOR_CP,
 	.init_early	= intcp_init_early,
 	.init_irq	= intcp_init_irq,
 	.timer		= &cp_timer,
arch/arm/mach-integrator/pci.c +2 -1
index 520b6bf..e15aa43 100644
@@ -26,11 +26,12 @@
 #include <linux/interrupt.h>
 #include <linux/init.h>
 
-#include <asm/irq.h>
 #include <asm/system.h>
 #include <asm/mach/pci.h>
 #include <asm/mach-types.h>
 
+#include <mach/irqs.h>
+
 /* 
  * A small note about bridges and interrupts.  The DECchip 21050 (and
  * later) adheres to the PCI-PCI bridge specification.  This says that
arch/arm/mach-integrator/pci_v3.c +2 -1
index 3c82566..65e5896 100644
@@ -30,7 +30,8 @@
 
 #include <mach/hardware.h>
 #include <mach/platform.h>
-#include <asm/irq.h>
+#include <mach/irqs.h>
+
 #include <asm/signal.h>
 #include <asm/system.h>
 #include <asm/mach/pci.h>
Signature · 1 line
1.7.7.6
#1 lore raw

PATCH 1/1 ARM: integrator: convert to sparse irqs

Quoted 5 lines · Linus Walleij

This converts the Integrator AP/CP to use sparse IRQs. Tested on both machines.

Quoted 136 lines
---
 arch/arm/Kconfig                             |    1 +
 arch/arm/mach-integrator/core.c              |    3 ++-
 arch/arm/mach-integrator/include/mach/irqs.h |    3 ++-
 arch/arm/mach-integrator/integrator_ap.c     |    3 ++-
 arch/arm/mach-integrator/integrator_cp.c     |    3 ++-
 arch/arm/mach-integrator/pci.c               |    3 ++-
 arch/arm/mach-integrator/pci_v3.c            |    3 ++-
 7 files changed, 13 insertions(+), 6 deletions(-)
arch/arm/Kconfig +1 -0
index 4852a6b..fc10ed8 100644
@@ -266,6 +266,7 @@ config ARCH_INTEGRATOR
 	select PLAT_VERSATILE
 	select PLAT_VERSATILE_FPGA_IRQ
 	select NEED_MACH_MEMORY_H
+	select SPARSE_IRQ
 	help
 	  Support for ARM's Integrator platform.
 
arch/arm/mach-integrator/core.c +2 -1
index 15b87f2..304dfb2 100644
@@ -25,8 +25,9 @@
 
 #include <mach/hardware.h>
 #include <mach/platform.h>
-#include <asm/irq.h>
 #include <mach/cm.h>
+#include <mach/irqs.h>
+
 #include <asm/system.h>
 #include <asm/leds.h>
 #include <asm/mach-types.h>
arch/arm/mach-integrator/include/mach/irqs.h +2 -1
index 1fbe6d1..a19a1a2 100644
@@ -78,5 +78,6 @@
 #define IRQ_SIC_CP_LMINT7		46
 #define IRQ_SIC_END			46
 
-#define NR_IRQS                         47
+#define NR_IRQS_INTEGRATOR_AP		34
+#define NR_IRQS_INTEGRATOR_CP		47
 
arch/arm/mach-integrator/integrator_ap.c +2 -1
index 4dde28b..871f148 100644
@@ -38,13 +38,13 @@
 #include <mach/hardware.h>
 #include <mach/platform.h>
 #include <asm/hardware/arm_timer.h>
-#include <asm/irq.h>
 #include <asm/setup.h>
 #include <asm/param.h>		/* HZ */
 #include <asm/mach-types.h>
 #include <asm/sched_clock.h>
 
 #include <mach/lm.h>
+#include <mach/irqs.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/irq.h>
@@ -475,6 +475,7 @@ MACHINE_START(INTEGRATOR, "ARM-Integrator")
 	.atag_offset	= 0x100,
 	.reserve	= integrator_reserve,
 	.map_io		= ap_map_io,
+	.nr_irqs	= NR_IRQS_INTEGRATOR_AP,
 	.init_early	= integrator_init_early,
 	.init_irq	= ap_init_irq,
 	.timer		= &ap_timer,
arch/arm/mach-integrator/integrator_cp.c +2 -1
index be9ead4..48a115a 100644
@@ -26,7 +26,6 @@
 
 #include <mach/hardware.h>
 #include <mach/platform.h>
-#include <asm/irq.h>
 #include <asm/setup.h>
 #include <asm/mach-types.h>
 #include <asm/hardware/arm_timer.h>
@@ -34,6 +33,7 @@
 
 #include <mach/cm.h>
 #include <mach/lm.h>
+#include <mach/irqs.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/irq.h>
@@ -464,6 +464,7 @@ MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
 	.atag_offset	= 0x100,
 	.reserve	= integrator_reserve,
 	.map_io		= intcp_map_io,
+	.nr_irqs	= NR_IRQS_INTEGRATOR_CP,
 	.init_early	= intcp_init_early,
 	.init_irq	= intcp_init_irq,
 	.timer		= &cp_timer,
arch/arm/mach-integrator/pci.c +2 -1
index 520b6bf..e15aa43 100644
@@ -26,11 +26,12 @@
 #include <linux/interrupt.h>
 #include <linux/init.h>
 
-#include <asm/irq.h>
 #include <asm/system.h>
 #include <asm/mach/pci.h>
 #include <asm/mach-types.h>
 
+#include <mach/irqs.h>
+
 /* 
  * A small note about bridges and interrupts.  The DECchip 21050 (and
  * later) adheres to the PCI-PCI bridge specification.  This says that
arch/arm/mach-integrator/pci_v3.c +2 -1
index 3c82566..65e5896 100644
@@ -30,7 +30,8 @@
 
 #include <mach/hardware.h>
 #include <mach/platform.h>
-#include <asm/irq.h>
+#include <mach/irqs.h>
+
 #include <asm/signal.h>
 #include <asm/system.h>
 #include <asm/mach/pci.h>
#2 lore raw

PATCH 1/1 ARM: integrator: convert to sparse irqs

In reply to Linus Walleij
Quoted 47 lines · Linus Walleij

This converts the Integrator AP/CP to use sparse IRQs. Tested on both machines.

---
 arch/arm/Kconfig                             |    1 +
 arch/arm/mach-integrator/core.c              |    3 ++-
 arch/arm/mach-integrator/include/mach/irqs.h |    3 ++-
 arch/arm/mach-integrator/integrator_ap.c     |    3 ++-
 arch/arm/mach-integrator/integrator_cp.c     |    3 ++-
 arch/arm/mach-integrator/pci.c               |    3 ++-
 arch/arm/mach-integrator/pci_v3.c            |    3 ++-
 7 files changed, 13 insertions(+), 6 deletions(-)
arch/arm/Kconfig +1 -0
index 4852a6b..fc10ed8 100644
@@ -266,6 +266,7 @@ config ARCH_INTEGRATOR
 	select PLAT_VERSATILE
 	select PLAT_VERSATILE_FPGA_IRQ
 	select NEED_MACH_MEMORY_H
+	select SPARSE_IRQ
 	help
 	  Support for ARM's Integrator platform.
 
arch/arm/mach-integrator/core.c +2 -1
index 15b87f2..304dfb2 100644
@@ -25,8 +25,9 @@
 
 #include <mach/hardware.h>
 #include <mach/platform.h>
-#include <asm/irq.h>
 #include <mach/cm.h>
+#include <mach/irqs.h>
+
 #include <asm/system.h>
 #include <asm/leds.h>
 #include <asm/mach-types.h>
arch/arm/mach-integrator/include/mach/irqs.h +0 -0
index 1fbe6d1..a19a1a2 100644

arch/arm/mach-integrator/include/mach/irqs.h line 82

Quoted 6 lines
arch/arm/mach-integrator/include/mach/irqs.h +2 -1
@@ -78,5 +78,6 @@
 #define IRQ_SIC_CP_LMINT7		46
 #define IRQ_SIC_END			46
 
-#define NR_IRQS                         47
+#define NR_IRQS_INTEGRATOR_AP		34
+#define NR_IRQS_INTEGRATOR_CP		47

why do you need to specified both?

Best Regards,
J.

#3 lore raw

PATCH 1/1 ARM: integrator: convert to sparse irqs

Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD

Review

Quoted 3 lines · Linus Walleij
(quoted diff) +2 -1
-#define NR_IRQS ? ? ? ? ? ? ? ? ? ? ? ? 47
+#define NR_IRQS_INTEGRATOR_AP ? ? ? ? ? ? ? ?34
+#define NR_IRQS_INTEGRATOR_CP ? ? ? ? ? ? ? ?47

why do you need to specified both?

They are two totally different machines and should never have had that common roof of NR_IRQS = max(AP,CP), it's just not elegant.

Maybe I'm a bit pedantic but I want to set the .nr_irqs for each machine so that it corresponds exactly to what it actually has, instead of using a roof value. I think it improves readability and understanding.

Yours
Linus Walleij

#4 lore raw

PATCH 1/1 ARM: integrator: convert to sparse irqs

Quoted 10 lines · Linus Walleij
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD

arch/arm/mach-integrator/include/mach/irqs.h line 82

Quoted 3 lines · Linus Walleij
arch/arm/mach-integrator/include/mach/irqs.h +2 -1
-#define NR_IRQS                         47
+#define NR_IRQS_INTEGRATOR_AP                34
+#define NR_IRQS_INTEGRATOR_CP                47

why do you need to specified both?

Quoted 7 lines

They are two totally different machines and should never have had that common roof of NR_IRQS = max(AP,CP), it's just not elegant.

Maybe I'm a bit pedantic but I want to set the .nr_irqs for each machine so that it corresponds exactly to what it actually has, instead of using a roof value. I think it improves readability and understanding.

Really, you want to get rid of the value altogether. Each irq_chip should allocate its irq_descs and then you don't need to set .nr_irqs.

Rob

Quoted 2 lines

Yours
Linus Walleij

#5 lore raw

PATCH 1/1 ARM: integrator: convert to sparse irqs

Quoted 14 lines · Rob Herring
Quoted 13 lines · Linus Walleij
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD

Review

Quoted 3 lines · Linus Walleij
(quoted diff) +2 -1
-#define NR_IRQS ? ? ? ? ? ? ? ? ? ? ? ? 47
+#define NR_IRQS_INTEGRATOR_AP ? ? ? ? ? ? ? ?34
+#define NR_IRQS_INTEGRATOR_CP ? ? ? ? ? ? ? ?47

why do you need to specified both?

They are two totally different machines and should never have had that common roof of NR_IRQS = max(AP,CP), it's just not elegant.

Quoted 6 lines
Quoted 3 lines

Maybe I'm a bit pedantic but I want to set the .nr_irqs for each machine so that it corresponds exactly to what it actually has, instead of using a roof value. I think it improves readability and understanding.

Really, you want to get rid of the value altogether. Each irq_chip should allocate its irq_descs and then you don't need to set .nr_irqs.

OK can you point to a machine that does it the right way and I'll fix.

Or do I need the irq domains lib to go in first to do that in a good/non-awkward way?

Yours,
Linus Walleij

#6 lore raw

PATCH 1/1 ARM: integrator: convert to sparse irqs

Quoted 19 lines · Linus Walleij
Quoted 18 lines · Rob Herring
Quoted 16 lines · Linus Walleij
Quoted 7 lines · Jean-Christophe PLAGNIOL-VILLARD

Review

Quoted 3 lines · Linus Walleij
(quoted diff) +2 -1
-#define NR_IRQS                         47
+#define NR_IRQS_INTEGRATOR_AP                34
+#define NR_IRQS_INTEGRATOR_CP                47

why do you need to specified both?

They are two totally different machines and should never have had that common roof of NR_IRQS = max(AP,CP), it's just not elegant.

Maybe I'm a bit pedantic but I want to set the .nr_irqs for each machine so that it corresponds exactly to what it actually has, instead of using a roof value. I think it improves readability and understanding.

Quoted 9 lines
Quoted 2 lines

Really, you want to get rid of the value altogether. Each irq_chip should allocate its irq_descs and then you don't need to set .nr_irqs.

OK can you point to a machine that does it the right way and I'll fix.

Or do I need the irq domains lib to go in first to do that in a good/non-awkward way?

You just need something like this. It doesn't really need a domain until DT support is done and this will still be needed in the non-DT case.

Rob

(quoted diff) +0 -0

b/arch/arm/plat-versatile/fpga-irq.c
index f0cc8e1..3e66b20 100644

arch/arm/plat-versatile/fpga-irq.c +0 -0
@@ -49,6 +49,7 @@ static void fpga_irq_handle(unsigned int irq, struct

irq_desc *desc)
void __init fpga_irq_init(int parent_irq, u32 valid, struct
fpga_irq_data *f)
{
unsigned int i;
+ int irq_cnt = fls(valid);

f->chip.irq_ack = fpga_irq_mask;
f->chip.irq_mask = fpga_irq_mask;
@@ -59,7 +60,9 @@ void __init fpga_irq_init(int parent_irq, u32 valid, struct fpga_irq_data *f)
irq_set_chained_handler(parent_irq, fpga_irq_handle);
}

- for (i = 0; i < 32; i++) {
+ irq_alloc_descs(f->irq_start, 0, irq_cnt, numa_node_id());
+
+ for (i = 0; i < irq_cnt; i++) {
if (valid & (1 << i)) {
unsigned int irq = f->irq_start + i;