Skip to content

Commit e5c8667

Browse files
committed
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: [email protected] Signed-off-by: Max Filippov <[email protected]>
1 parent 6bf2896 commit e5c8667

File tree

6 files changed

+13
-15
lines changed

6 files changed

+13
-15
lines changed

arch/xtensa/include/asm/irq.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ static inline void variant_irq_disable(unsigned int irq) { }
2929
# define PLATFORM_NR_IRQS 0
3030
#endif
3131
#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)
3334

3435
#if VARIANT_NR_IRQS == 0
3536
static inline void variant_init_irq(void) { }

arch/xtensa/kernel/irq.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ asmlinkage void do_IRQ(int hwirq, struct pt_regs *regs)
3434
{
3535
int irq = irq_find_mapping(NULL, hwirq);
3636

37-
if (hwirq >= NR_IRQS) {
38-
printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
39-
__func__, hwirq);
40-
}
41-
4237
#ifdef CONFIG_DEBUG_STACKOVERFLOW
4338
/* Debugging check for stack overflow: is there less than 1KB free? */
4439
{

arch/xtensa/platforms/xtfpga/include/platform/hardware.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,18 @@
2424

2525
/* Interrupt configuration. */
2626

27-
#define PLATFORM_NR_IRQS 10
27+
#define PLATFORM_NR_IRQS 0
2828

2929
/* Default assignment of LX60 devices to external interrupts. */
3030

3131
#ifdef CONFIG_XTENSA_MX
3232
#define DUART16552_INTNUM XCHAL_EXTINT3_NUM
3333
#define OETH_IRQ XCHAL_EXTINT4_NUM
34+
#define C67X00_IRQ XCHAL_EXTINT8_NUM
3435
#else
3536
#define DUART16552_INTNUM XCHAL_EXTINT0_NUM
3637
#define OETH_IRQ XCHAL_EXTINT1_NUM
38+
#define C67X00_IRQ XCHAL_EXTINT5_NUM
3739
#endif
3840

3941
/*
@@ -63,5 +65,5 @@
6365

6466
#define C67X00_PADDR (XCHAL_KIO_PADDR + 0x0D0D0000)
6567
#define C67X00_SIZE 0x10
66-
#define C67X00_IRQ 5
68+
6769
#endif /* __XTENSA_XTAVNET_HARDWARE_H */

arch/xtensa/platforms/xtfpga/setup.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ static struct resource ethoc_res[] = {
175175
.flags = IORESOURCE_MEM,
176176
},
177177
[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),
180180
.flags = IORESOURCE_IRQ,
181181
},
182182
};
@@ -213,8 +213,8 @@ static struct resource c67x00_res[] = {
213213
.flags = IORESOURCE_MEM,
214214
},
215215
[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),
218218
.flags = IORESOURCE_IRQ,
219219
},
220220
};
@@ -247,7 +247,7 @@ static struct resource serial_resource = {
247247
static struct plat_serial8250_port serial_platform_data[] = {
248248
[0] = {
249249
.mapbase = DUART16552_PADDR,
250-
.irq = DUART16552_INTNUM,
250+
.irq = XTENSA_PIC_LINUX_IRQ(DUART16552_INTNUM),
251251
.flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST |
252252
UPF_IOREMAP,
253253
.iotype = XCHAL_HAVE_BE ? UPIO_MEM32BE : UPIO_MEM32,

drivers/irqchip/irq-xtensa-mx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static struct irq_chip xtensa_mx_irq_chip = {
142142
int __init xtensa_mx_init_legacy(struct device_node *interrupt_parent)
143143
{
144144
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,
146146
&xtensa_mx_irq_domain_ops,
147147
&xtensa_mx_irq_chip);
148148
irq_set_default_host(root_domain);

drivers/irqchip/irq-xtensa-pic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ static struct irq_chip xtensa_irq_chip = {
8989
int __init xtensa_pic_init_legacy(struct device_node *interrupt_parent)
9090
{
9191
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,
9393
&xtensa_irq_domain_ops, &xtensa_irq_chip);
9494
irq_set_default_host(root_domain);
9595
return 0;

0 commit comments

Comments
 (0)