Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1613866 > unrolled thread

[PATCH 1/2] MIPS: Malta: Fix i8259 irqchip setup

Started byMatt Redfearn <matt.redfearn@imgtec.com>
First post2017-03-31 13:10 +0200
Last post2017-03-31 15:00 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/2] MIPS: Malta: Fix i8259 irqchip setup Matt Redfearn <matt.redfearn@imgtec.com> - 2017-03-31 13:10 +0200
    Re: [PATCH 1/2] MIPS: Malta: Fix i8259 irqchip setup Ralf Baechle <ralf@linux-mips.org> - 2017-03-31 15:00 +0200
      Re: [PATCH 1/2] MIPS: Malta: Fix i8259 irqchip setup Matt Redfearn <matt.redfearn@imgtec.com> - 2017-03-31 15:00 +0200

#1613866 — [PATCH 1/2] MIPS: Malta: Fix i8259 irqchip setup

FromMatt Redfearn <matt.redfearn@imgtec.com>
Date2017-03-31 13:10 +0200
Subject[PATCH 1/2] MIPS: Malta: Fix i8259 irqchip setup
Message-ID<tr2Bj-3PV-3@gated-at.bofh.it>
Since commit 4cfffcfa5106 ("irqchip/mips-gic: Fix local interrupts"),
the gic driver has been allocating virq's for local interrupts during
its initialisation. Unfortunately on Malta platforms, these are the
first IRQs to be allocated and so are allocated virqs 1-3. The i8259
driver uses a legacy irq domain which expects to map virqs 0-15. Probing
of that driver therefore fails because some of those virqs are already
taken, with the warning:

WARNING: CPU: 0 PID: 0 at kernel/irq/irqdomain.c:344
irq_domain_associate+0x1e8/0x228
error: virq1 is already associated
Modules linked in:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.10.0-rc6-00011-g4cfffcfa5106 #368
Stack : 00000000 00000000 807ae03a 0000004d 00000000 806c1010 0000000b ffff0a01
        80725467 807258f4 806a64a4 00000000 00000000 807a9acc 00000100 80713e68
        806d5598 8017593c 8072bf90 8072bf94 806ac358 00000000 806abb60 80713ce4
        00000100 801b22d4 806d5598 8017593c 807ae03a 00000000 80713ce4 80720000
        00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
        ...
Call Trace:
[<8010c480>] show_stack+0x88/0xa4
[<80376758>] dump_stack+0x88/0xd0
[<8012c4a8>] __warn+0x104/0x118
[<8012c4ec>] warn_slowpath_fmt+0x30/0x3c
[<8017edfc>] irq_domain_associate+0x1e8/0x228
[<8017efd0>] irq_domain_add_legacy+0x7c/0xb0
[<80764c50>] __init_i8259_irqs+0x64/0xa0
[<80764ca4>] i8259_of_init+0x18/0x74
[<8076ddc0>] of_irq_init+0x19c/0x310
[<80752dd8>] arch_init_irq+0x28/0x19c
[<80750a08>] start_kernel+0x2a8/0x434

Fix this by reserving the required i8259 virqs in malta platform code
before probing any irq chips.

Fixes: 4cfffcfa5106 ("irqchip/mips-gic: Fix local interrupts")
Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>

---

 arch/mips/mti-malta/malta-int.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index cb675ec6f283..474b372e0dd9 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -232,6 +232,19 @@ void __init arch_init_irq(void)
 {
 	int corehi_irq;
 
+#ifdef CONFIG_I8259
+	/*
+	 * Preallocate the i8259's expected virq's here. Since irqchip_init()
+	 * will probe the irqchips in hierarchial order, i8259 is probed last.
+	 * If anything allocates a virq before the i8259 is probed, it will
+	 * be given one of the i8259's expected range and consequently setup
+	 * of the i8259 will fail.
+	 */
+	WARN(irq_alloc_descs(I8259A_IRQ_BASE, I8259A_IRQ_BASE,
+			    16, numa_node_id()) < 0,
+		"Cannot reserve i8259 virqs at IRQ%d\n", I8259A_IRQ_BASE);
+#endif /* CONFIG_I8259 */
+
 	i8259_set_poll(mips_pcibios_iack);
 	irqchip_init();
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1613986

FromRalf Baechle <ralf@linux-mips.org>
Date2017-03-31 15:00 +0200
Message-ID<tr4jM-4Kh-35@gated-at.bofh.it>
In reply to#1613866
On Fri, Mar 31, 2017 at 12:05:31PM +0100, Matt Redfearn wrote:

> diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
> index cb675ec6f283..474b372e0dd9 100644
> --- a/arch/mips/mti-malta/malta-int.c
> +++ b/arch/mips/mti-malta/malta-int.c
> @@ -232,6 +232,19 @@ void __init arch_init_irq(void)
>  {
>  	int corehi_irq;
>  
> +#ifdef CONFIG_I8259
> +	/*
> +	 * Preallocate the i8259's expected virq's here. Since irqchip_init()
> +	 * will probe the irqchips in hierarchial order, i8259 is probed last.
> +	 * If anything allocates a virq before the i8259 is probed, it will
> +	 * be given one of the i8259's expected range and consequently setup
> +	 * of the i8259 will fail.
> +	 */
> +	WARN(irq_alloc_descs(I8259A_IRQ_BASE, I8259A_IRQ_BASE,
> +			    16, numa_node_id()) < 0,
> +		"Cannot reserve i8259 virqs at IRQ%d\n", I8259A_IRQ_BASE);
> +#endif /* CONFIG_I8259 */
> +
>  	i8259_set_poll(mips_pcibios_iack);

CONFIG_I8259 is always defined on Malta so the #ifdef is pointless.

  Ralf

[toc] | [prev] | [next] | [standalone]


#1613990

FromMatt Redfearn <matt.redfearn@imgtec.com>
Date2017-03-31 15:00 +0200
Message-ID<tr4jM-4Kh-33@gated-at.bofh.it>
In reply to#1613986
Hi Ralf,


On 31/03/17 13:49, Ralf Baechle wrote:
> On Fri, Mar 31, 2017 at 12:05:31PM +0100, Matt Redfearn wrote:
>
>> diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
>> index cb675ec6f283..474b372e0dd9 100644
>> --- a/arch/mips/mti-malta/malta-int.c
>> +++ b/arch/mips/mti-malta/malta-int.c
>> @@ -232,6 +232,19 @@ void __init arch_init_irq(void)
>>   {
>>   	int corehi_irq;
>>   
>> +#ifdef CONFIG_I8259
>> +	/*
>> +	 * Preallocate the i8259's expected virq's here. Since irqchip_init()
>> +	 * will probe the irqchips in hierarchial order, i8259 is probed last.
>> +	 * If anything allocates a virq before the i8259 is probed, it will
>> +	 * be given one of the i8259's expected range and consequently setup
>> +	 * of the i8259 will fail.
>> +	 */
>> +	WARN(irq_alloc_descs(I8259A_IRQ_BASE, I8259A_IRQ_BASE,
>> +			    16, numa_node_id()) < 0,
>> +		"Cannot reserve i8259 virqs at IRQ%d\n", I8259A_IRQ_BASE);
>> +#endif /* CONFIG_I8259 */
>> +
>>   	i8259_set_poll(mips_pcibios_iack);
> CONFIG_I8259 is always defined on Malta so the #ifdef is pointless.
>
>    Ralf

Ah, true. I was looking at arch/mips/include/asm/mach-generic/irq.h 
where I8259A_IRQ_BASE is defined, it's wrapped in that CONFIG so I kept 
it here, but you're right of course that Malta always defines it. Would 
you like a v2 with that removed?

Thanks,
Matt

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web