All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] genirq: Correctly configure the trigger on chained interrupts
@ 2016-08-11 15:55 Marc Zyngier
  2016-08-11 21:09 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Marc Zyngier @ 2016-08-11 15:55 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: John Stultz, Linus Walleij, Jon Hunter, linux-kernel

Commit 1e2a7d78499e ("irqdomain: Don't set type when mapping an IRQ")
moved the trigger configuration call from the irqdomain mapping to
the interrupt being actually requested.

This patch failed to handle the case where we configure a chained
interrupt, which doesn't get requested through the usual path.

In order to solve this, let's call __irq_set_trigger just before
starting the cascade interrupt. Special care must be taken to
make the flow handler stick, as the .irq_set_type method could
have reset it (it doesn't know we're dealing with a chained
interrupt).

Based on an initial patch by Jon Hunter.

Fixes: 1e2a7d78499e ("irqdomain: Don't set type when mapping an IRQ")
Reported-by: John Stultz <john.stultz@linaro.org>
Reported-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 kernel/irq/chip.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index b4c1bc7..6373890 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -820,6 +820,17 @@ __irq_do_set_handler(struct irq_desc *desc, irq_flow_handler_t handle,
 	desc->name = name;
 
 	if (handle != handle_bad_irq && is_chained) {
+		/*
+		 * We're about to start this interrupt immediately,
+		 * hence the need to set the trigger configuration.
+		 * But the .set_type callback may have overridden the
+		 * flow handler, ignoring that we're dealing with a
+		 * chained interrupt. Reset it immediately because we
+		 * do know better.
+		 */
+		__irq_set_trigger(desc, irqd_get_trigger_type(&desc->irq_data));
+		desc->handle_irq = handle;
+
 		irq_settings_set_noprobe(desc);
 		irq_settings_set_norequest(desc);
 		irq_settings_set_nothread(desc);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] genirq: Correctly configure the trigger on chained interrupts
  2016-08-11 15:55 [PATCH] genirq: Correctly configure the trigger on chained interrupts Marc Zyngier
@ 2016-08-11 21:09 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2016-08-11 21:09 UTC (permalink / raw)
  To: Marc Zyngier; +Cc: Thomas Gleixner, John Stultz, Jon Hunter, linux-kernel

On Thu, Aug 11, 2016 at 5:55 PM, Marc Zyngier <marc.zyngier@arm.com> wrote:

> Commit 1e2a7d78499e ("irqdomain: Don't set type when mapping an IRQ")
> moved the trigger configuration call from the irqdomain mapping to
> the interrupt being actually requested.
>
> This patch failed to handle the case where we configure a chained
> interrupt, which doesn't get requested through the usual path.
>
> In order to solve this, let's call __irq_set_trigger just before
> starting the cascade interrupt. Special care must be taken to
> make the flow handler stick, as the .irq_set_type method could
> have reset it (it doesn't know we're dealing with a chained
> interrupt).
>
> Based on an initial patch by Jon Hunter.
>
> Fixes: 1e2a7d78499e ("irqdomain: Don't set type when mapping an IRQ")
> Reported-by: John Stultz <john.stultz@linaro.org>
> Reported-by: Linus Walleij <linus.walleij@linaro.org>
> Tested-by: John Stultz <john.stultz@linaro.org>
> Acked-by: Jon Hunter <jonathanh@nvidia.com>
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>

Tested-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-11 21:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-11 15:55 [PATCH] genirq: Correctly configure the trigger on chained interrupts Marc Zyngier
2016-08-11 21:09 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.