public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
Subject: [patch 3/4] genirq: Add IRQF_FORCE_RESUME
Date: Sat, 05 Feb 2011 20:08:57 -0000	[thread overview]
Message-ID: <20110205200704.022396717@linutronix.de> (raw)
In-Reply-To: 20110205200108.921707839@linutronix.de

[-- Attachment #1: genirq-add-force-enable-on-resume.patch --]
[-- Type: text/plain, Size: 3150 bytes --]

Xen needs to reenable interrupts which are marked IRQF_NO_SUSPEND in the
resume path. Add a flag to force the reenabling in the resume code.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/interrupt.h |    3 ++-
 include/linux/irq.h       |    4 +++-
 kernel/irq/manage.c       |   11 ++++++++++-
 kernel/irq/pm.c           |    3 ---
 4 files changed, 15 insertions(+), 6 deletions(-)

Index: linux-next/include/linux/interrupt.h
===================================================================
--- linux-next.orig/include/linux/interrupt.h
+++ linux-next/include/linux/interrupt.h
@@ -57,7 +57,7 @@
  *                Used by threaded interrupts which need to keep the
  *                irq line disabled until the threaded handler has been run.
  * IRQF_NO_SUSPEND - Do not disable this IRQ during suspend
- *
+ * IRQF_FORCE_RESUME - Force enable it on resume even if IRQF_NO_SUSPEND is set
  */
 #define IRQF_DISABLED		0x00000020
 #define IRQF_SAMPLE_RANDOM	0x00000040
@@ -69,6 +69,7 @@
 #define IRQF_IRQPOLL		0x00001000
 #define IRQF_ONESHOT		0x00002000
 #define IRQF_NO_SUSPEND		0x00004000
+#define IRQF_FORCE_RESUME	0x00008000
 
 #define IRQF_TIMER		(__IRQF_TIMER | IRQF_NO_SUSPEND)
 
Index: linux-next/include/linux/irq.h
===================================================================
--- linux-next.orig/include/linux/irq.h
+++ linux-next/include/linux/irq.h
@@ -71,10 +71,12 @@ typedef	void (*irq_flow_handler_t)(unsig
 #define IRQ_SUSPENDED		0x04000000	/* IRQ has gone through suspend sequence */
 #define IRQ_ONESHOT		0x08000000	/* IRQ is not unmasked after hardirq */
 #define IRQ_NESTED_THREAD	0x10000000	/* IRQ is nested into another, no own handler thread */
+#define IRQ_FORCE_SUSPEND	0x20000000	/* Ignore IRQF_NO_SUSPEND */
 
 #define IRQF_MODIFY_MASK	\
 	(IRQ_TYPE_SENSE_MASK | IRQ_NOPROBE | IRQ_NOREQUEST | \
-	 IRQ_NOAUTOEN | IRQ_MOVE_PCNTXT | IRQ_LEVEL)
+	 IRQ_NOAUTOEN | IRQ_MOVE_PCNTXT | IRQ_LEVEL \
+	 IRQ_FORCE_SUSPEND)
 
 #ifdef CONFIG_IRQ_PER_CPU
 # define CHECK_IRQ_PER_CPU(var) ((var) & IRQ_PER_CPU)
Index: linux-next/kernel/irq/manage.c
===================================================================
--- linux-next.orig/kernel/irq/manage.c
+++ linux-next/kernel/irq/manage.c
@@ -359,8 +359,17 @@ EXPORT_SYMBOL(disable_irq);
 
 void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume)
 {
-	if (resume)
+	if (resume) {
+		if (!(desc->status & IRQ_SUSPENDED)) {
+			if (!desc->action)
+				return;
+			if (!(desc->action->flags & IRQF_FORCE_RESUME))
+				return;
+			/* Pretend that it got disabled ! */
+			desc->depth++;
+		}
 		desc->status &= ~IRQ_SUSPENDED;
+	}
 
 	switch (desc->depth) {
 	case 0:
Index: linux-next/kernel/irq/pm.c
===================================================================
--- linux-next.orig/kernel/irq/pm.c
+++ linux-next/kernel/irq/pm.c
@@ -53,9 +53,6 @@ void resume_device_irqs(void)
 	for_each_irq_desc(irq, desc) {
 		unsigned long flags;
 
-		if (!(desc->status & IRQ_SUSPENDED))
-			continue;
-
 		raw_spin_lock_irqsave(&desc->lock, flags);
 		__enable_irq(desc, irq, true);
 		raw_spin_unlock_irqrestore(&desc->lock, flags);



  parent reply	other threads:[~2011-02-05 20:09 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-05 20:08 [patch 0/4] XEN: Interrupt cleanups Thomas Gleixner
2011-02-05 20:08 ` [patch 1/4] xen: Remove stale irq_chip.end Thomas Gleixner
2011-02-05 20:08 ` [patch 2/4] xen: Switch to new irq_chip functions Thomas Gleixner
2011-02-07 11:08   ` Ian Campbell
2011-02-07 11:30     ` Thomas Gleixner
2011-02-05 20:08 ` Thomas Gleixner [this message]
2011-02-05 20:08 ` [patch 4/4] xen: Use IRQF_FORCE_RESUME Thomas Gleixner
2011-02-07 21:28 ` [patch 0/4] XEN: Interrupt cleanups Jeremy Fitzhardinge
2011-02-07 21:33   ` Thomas Gleixner
2011-02-07 21:57     ` Jeremy Fitzhardinge
2011-02-08 14:03       ` Ian Campbell
2011-02-08 14:55         ` Thomas Gleixner
2011-02-08 15:05           ` Ian Campbell
2011-02-08 15:39             ` Thomas Gleixner
2011-02-08 16:20               ` Konrad Rzeszutek Wilk
2011-02-08 16:31                 ` Ian Campbell
2011-02-08 17:33                 ` Thomas Gleixner
2011-02-08 18:39                   ` Konrad Rzeszutek Wilk
2011-02-08 19:05                     ` Thomas Gleixner
2011-02-09  9:27                 ` Ian Campbell
2011-02-09  9:46                   ` Thomas Gleixner
2011-02-09  9:48                     ` Thomas Gleixner
2011-02-09 10:16                       ` Ian Campbell
2011-02-09  9:56                     ` Ian Campbell
2011-02-08 16:24               ` Konrad Rzeszutek Wilk
2011-02-08 17:38                 ` Thomas Gleixner
2011-02-08 16:26               ` Ian Campbell
2011-02-07 21:56 ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110205200704.022396717@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=jeremy@goop.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox