public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: tglx@linutronix.de (Thomas Gleixner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] genirq: Add support for priority-drop/deactivate interrupt controllers
Date: Wed, 29 Oct 2014 11:26:24 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.11.1410291115310.5308@nanos> (raw)
In-Reply-To: <5450BD61.10102@arm.com>

On Wed, 29 Oct 2014, Marc Zyngier wrote:
> On 28/10/14 20:14, Thomas Gleixner wrote:
> > irq_enable() calls chip->irq_unmask(), i.e. DIR. So that clears the
> > ACTIVE bit and then the IRQ either gets resent by hardware (in case of
> > level as the device interrupt is still active) or retriggered by the
> > irq_retrigger() callback.
> 
> The problem I see here is for an interrupt that has been flagged as
> disabled with irq_disabled(), but that hasn't fired. We'd end up doing a
> DIR on something that hasn't had an EOI first. I think that's the only
> wrinkle in this scheme.

Right. So the untested patch below should do the trick and prevent
irq_enable() to invoke irq_unmask() if the interrupt is not flagged
masked. And it only can be flagged masked if it was masked in the
handler. The startup callback will make sure that irq_enable() is not
invoked at startup time.

Thanks,

	tglx

------------------

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index e5202f00cabc..9c0f73e1994a 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -182,7 +182,7 @@ int irq_startup(struct irq_desc *desc, bool resend)
 		ret = desc->irq_data.chip->irq_startup(&desc->irq_data);
 		irq_state_clr_masked(desc);
 	} else {
-		irq_enable(desc);
+		irq_enable(desc, false);
 	}
 	if (resend)
 		check_irq_resend(desc, desc->irq_data.irq);
@@ -202,13 +202,14 @@ void irq_shutdown(struct irq_desc *desc)
 	irq_state_set_masked(desc);
 }
 
-void irq_enable(struct irq_desc *desc)
+void irq_enable(struct irq_desc *desc, bool ifmasked)
 {
 	irq_state_clr_disabled(desc);
-	if (desc->irq_data.chip->irq_enable)
+	if (desc->irq_data.chip->irq_enable) {
 		desc->irq_data.chip->irq_enable(&desc->irq_data);
-	else
+	} else if (!ifmasked || irqd_irq_masked(&desc->irq_data)) {
 		desc->irq_data.chip->irq_unmask(&desc->irq_data);
+	}
 	irq_state_clr_masked(desc);
 }
 
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index 4332d766619d..6eff2678cf6d 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -68,7 +68,7 @@ extern void __enable_irq(struct irq_desc *desc, unsigned int irq);
 
 extern int irq_startup(struct irq_desc *desc, bool resend);
 extern void irq_shutdown(struct irq_desc *desc);
-extern void irq_enable(struct irq_desc *desc);
+extern void irq_enable(struct irq_desc *desc, bool ifmasked);
 extern void irq_disable(struct irq_desc *desc);
 extern void irq_percpu_enable(struct irq_desc *desc, unsigned int cpu);
 extern void irq_percpu_disable(struct irq_desc *desc, unsigned int cpu);
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 0a9104b4608b..d8c474608c2d 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -448,7 +448,7 @@ void __enable_irq(struct irq_desc *desc, unsigned int irq)
 			goto err_out;
 		/* Prevent probing on this irq: */
 		irq_settings_set_noprobe(desc);
-		irq_enable(desc);
+		irq_enable(desc, true);
 		check_irq_resend(desc, irq);
 		/* fall-through */
 	}

  reply	other threads:[~2014-10-29 10:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-25 11:06 [PATCH 0/3] genirq: Add support for "split-EOI" irqchips Marc Zyngier
2014-10-25 11:06 ` [PATCH 1/3] genirq: Add support for priority-drop/deactivate interrupt controllers Marc Zyngier
2014-10-25 20:27   ` Thomas Gleixner
2014-10-25 20:40     ` Thomas Gleixner
2014-10-27 15:42     ` Marc Zyngier
2014-10-28 15:32       ` Thomas Gleixner
2014-10-28 19:41         ` Marc Zyngier
2014-10-28 20:14           ` Thomas Gleixner
2014-10-29 10:11             ` Marc Zyngier
2014-10-29 10:26               ` Thomas Gleixner [this message]
2014-10-30 14:15                 ` Marc Zyngier
2014-10-30 15:59                   ` Thomas Gleixner
2014-10-25 11:06 ` [PATCH 2/3] irqchip: GIC: Convert to EOImode == 1 Marc Zyngier
2014-10-25 11:06 ` [PATCH 3/3] irqchip: GICv3: " Marc Zyngier

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=alpine.DEB.2.11.1410291115310.5308@nanos \
    --to=tglx@linutronix.de \
    --cc=linux-arm-kernel@lists.infradead.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