]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
genirq: Provide means to retrigger parent
authorThomas Gleixner <tglx@linutronix.de>
Tue, 16 Oct 2012 22:07:49 +0000 (15:07 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 1 Nov 2012 11:11:31 +0000 (12:11 +0100)
Attempts to retrigger nested threaded IRQs currently fail because they
have no primary handler. In order to support retrigger of nested
IRQs, the parent IRQ needs to be retriggered.

To fix, when an IRQ needs to be resent, if the interrupt has a parent
IRQ and runs in the context of the parent IRQ, then resend the parent.

Also, handle_nested_irq() needs to clear the replay flag like the
other handlers, otherwise check_irq_resend() will set it and it will
never be cleared.  Without clearing, it results in the first resend
working fine, but check_irq_resend() returning early on subsequent
resends because the replay flag is still set.

Problem discovered on ARM/OMAP platforms where a nested IRQ that's
also a wakeup IRQ happens late in suspend and needed to be retriggered
during the resume process.

[khilman@ti.com: changelog edits, clear IRQS_REPLAY in handle_nested_irq()]

Reported-by: Kevin Hilman <khilman@ti.com>
Tested-by: Kevin Hilman <khilman@ti.com>
Cc: linux-arm-kernel@lists.infradead.org
Link: http://lkml.kernel.org/r/1350425269-11489-1-git-send-email-khilman@deeprootsystems.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
include/linux/irq.h
include/linux/irqdesc.h
kernel/irq/chip.c
kernel/irq/manage.c
kernel/irq/resend.c

index 216b0ba109d72f453836568e1aa6c7b7c85e21a6..526f10a637c1fa46989e70f077e8208d67812580 100644 (file)
@@ -392,6 +392,15 @@ static inline void irq_move_masked_irq(struct irq_data *data) { }
 
 extern int no_irq_affinity;
 
+#ifdef CONFIG_HARDIRQS_SW_RESEND
+int irq_set_parent(int irq, int parent_irq);
+#else
+static inline int irq_set_parent(int irq, int parent_irq)
+{
+       return 0;
+}
+#endif
+
 /*
  * Built-in IRQ handlers for various IRQ types,
  * callable via desc->handle_irq()
index 0ba014c550565622702a154cf6a6dc78ffabe1fe..623325e2ff97d4f0e3ead2d1eeeeddd35c1916fa 100644 (file)
@@ -11,6 +11,8 @@
 struct irq_affinity_notify;
 struct proc_dir_entry;
 struct module;
+struct irq_desc;
+
 /**
  * struct irq_desc - interrupt descriptor
  * @irq_data:          per irq and chip data passed down to chip functions
@@ -65,6 +67,7 @@ struct irq_desc {
 #ifdef CONFIG_PROC_FS
        struct proc_dir_entry   *dir;
 #endif
+       int                     parent_irq;
        struct module           *owner;
        const char              *name;
 } ____cacheline_internodealigned_in_smp;
index 57d86d07221e33c7863bfe7f789d6a2f129aaa2f..3aca9f29d30ef4c5089ad97740588a31462fd22d 100644 (file)
@@ -272,6 +272,7 @@ void handle_nested_irq(unsigned int irq)
 
        raw_spin_lock_irq(&desc->lock);
 
+       desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
        kstat_incr_irqs_this_cpu(irq, desc);
 
        action = desc->action;
index 4c69326aa773f6469b7170d66814d7480ea12ea7..d06a396c7ce3ad0848771838a7cad9963c3a9438 100644 (file)
@@ -616,6 +616,22 @@ int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
        return ret;
 }
 
+#ifdef CONFIG_HARDIRQS_SW_RESEND
+int irq_set_parent(int irq, int parent_irq)
+{
+       unsigned long flags;
+       struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0);
+
+       if (!desc)
+               return -EINVAL;
+
+       desc->parent_irq = parent_irq;
+
+       irq_put_desc_unlock(desc, flags);
+       return 0;
+}
+#endif
+
 /*
  * Default primary interrupt handler for threaded interrupts. Is
  * assigned as primary handler when request_threaded_irq is called
index 6454db7b6a4d18ae2e4feb67dc7a572a5d8deac4..9065107f083e90e3fbd3c38f2fbc164d11ff2b3c 100644 (file)
@@ -74,6 +74,14 @@ void check_irq_resend(struct irq_desc *desc, unsigned int irq)
                if (!desc->irq_data.chip->irq_retrigger ||
                    !desc->irq_data.chip->irq_retrigger(&desc->irq_data)) {
 #ifdef CONFIG_HARDIRQS_SW_RESEND
+                       /*
+                        * If the interrupt has a parent irq and runs
+                        * in the thread context of the parent irq,
+                        * retrigger the parent.
+                        */
+                       if (desc->parent_irq &&
+                           irq_settings_is_nested_thread(desc))
+                               irq = desc->parent_irq;
                        /* Set it pending and activate the softirq: */
                        set_bit(irq, irqs_resend);
                        tasklet_schedule(&resend_tasklet);