Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xtensa: don't use linux IRQ #0

Linux IRQ #0 is reserved for error reporting and may not be used.
Increase NR_IRQS for one additional slot and increase
irq_domain_add_legacy parameter first_irq value to 1, so that linux
IRQ #0 is not associated with hardware IRQ #0 in legacy IRQ domains.
Introduce macro XTENSA_PIC_LINUX_IRQ for static translation of xtensa
PIC hardware IRQ # to linux IRQ #. Use this macro in XTFPGA platform
data definitions.

This fixes inability to use hardware IRQ #0 in configurations that don't
use device tree and allows for non-identity mapping between linux IRQ #
and hardware IRQ #.

Cc: stable@vger.kernel.org
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>

+13 -15
+2 -1
arch/xtensa/include/asm/irq.h
··· 29 29 # define PLATFORM_NR_IRQS 0 30 30 #endif 31 31 #define XTENSA_NR_IRQS XCHAL_NUM_INTERRUPTS 32 - #define NR_IRQS (XTENSA_NR_IRQS + VARIANT_NR_IRQS + PLATFORM_NR_IRQS) 32 + #define NR_IRQS (XTENSA_NR_IRQS + VARIANT_NR_IRQS + PLATFORM_NR_IRQS + 1) 33 + #define XTENSA_PIC_LINUX_IRQ(hwirq) ((hwirq) + 1) 33 34 34 35 #if VARIANT_NR_IRQS == 0 35 36 static inline void variant_init_irq(void) { }
-5
arch/xtensa/kernel/irq.c
··· 34 34 { 35 35 int irq = irq_find_mapping(NULL, hwirq); 36 36 37 - if (hwirq >= NR_IRQS) { 38 - printk(KERN_EMERG "%s: cannot handle IRQ %d\n", 39 - __func__, hwirq); 40 - } 41 - 42 37 #ifdef CONFIG_DEBUG_STACKOVERFLOW 43 38 /* Debugging check for stack overflow: is there less than 1KB free? */ 44 39 {
+4 -2
arch/xtensa/platforms/xtfpga/include/platform/hardware.h
··· 24 24 25 25 /* Interrupt configuration. */ 26 26 27 - #define PLATFORM_NR_IRQS 10 27 + #define PLATFORM_NR_IRQS 0 28 28 29 29 /* Default assignment of LX60 devices to external interrupts. */ 30 30 31 31 #ifdef CONFIG_XTENSA_MX 32 32 #define DUART16552_INTNUM XCHAL_EXTINT3_NUM 33 33 #define OETH_IRQ XCHAL_EXTINT4_NUM 34 + #define C67X00_IRQ XCHAL_EXTINT8_NUM 34 35 #else 35 36 #define DUART16552_INTNUM XCHAL_EXTINT0_NUM 36 37 #define OETH_IRQ XCHAL_EXTINT1_NUM 38 + #define C67X00_IRQ XCHAL_EXTINT5_NUM 37 39 #endif 38 40 39 41 /* ··· 65 63 66 64 #define C67X00_PADDR (XCHAL_KIO_PADDR + 0x0D0D0000) 67 65 #define C67X00_SIZE 0x10 68 - #define C67X00_IRQ 5 66 + 69 67 #endif /* __XTENSA_XTAVNET_HARDWARE_H */
+5 -5
arch/xtensa/platforms/xtfpga/setup.c
··· 175 175 .flags = IORESOURCE_MEM, 176 176 }, 177 177 [2] = { /* IRQ number */ 178 - .start = OETH_IRQ, 179 - .end = OETH_IRQ, 178 + .start = XTENSA_PIC_LINUX_IRQ(OETH_IRQ), 179 + .end = XTENSA_PIC_LINUX_IRQ(OETH_IRQ), 180 180 .flags = IORESOURCE_IRQ, 181 181 }, 182 182 }; ··· 213 213 .flags = IORESOURCE_MEM, 214 214 }, 215 215 [1] = { /* IRQ number */ 216 - .start = C67X00_IRQ, 217 - .end = C67X00_IRQ, 216 + .start = XTENSA_PIC_LINUX_IRQ(C67X00_IRQ), 217 + .end = XTENSA_PIC_LINUX_IRQ(C67X00_IRQ), 218 218 .flags = IORESOURCE_IRQ, 219 219 }, 220 220 }; ··· 247 247 static struct plat_serial8250_port serial_platform_data[] = { 248 248 [0] = { 249 249 .mapbase = DUART16552_PADDR, 250 - .irq = DUART16552_INTNUM, 250 + .irq = XTENSA_PIC_LINUX_IRQ(DUART16552_INTNUM), 251 251 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | 252 252 UPF_IOREMAP, 253 253 .iotype = XCHAL_HAVE_BE ? UPIO_MEM32BE : UPIO_MEM32,
+1 -1
drivers/irqchip/irq-xtensa-mx.c
··· 142 142 int __init xtensa_mx_init_legacy(struct device_node *interrupt_parent) 143 143 { 144 144 struct irq_domain *root_domain = 145 - irq_domain_add_legacy(NULL, NR_IRQS, 0, 0, 145 + irq_domain_add_legacy(NULL, NR_IRQS - 1, 1, 0, 146 146 &xtensa_mx_irq_domain_ops, 147 147 &xtensa_mx_irq_chip); 148 148 irq_set_default_host(root_domain);
+1 -1
drivers/irqchip/irq-xtensa-pic.c
··· 89 89 int __init xtensa_pic_init_legacy(struct device_node *interrupt_parent) 90 90 { 91 91 struct irq_domain *root_domain = 92 - irq_domain_add_legacy(NULL, NR_IRQS, 0, 0, 92 + irq_domain_add_legacy(NULL, NR_IRQS - 1, 1, 0, 93 93 &xtensa_irq_domain_ops, &xtensa_irq_chip); 94 94 irq_set_default_host(root_domain); 95 95 return 0;