From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 02/15] ARM: pass IRQ domain to the core IRQ handler
Date: Tue, 8 Jul 2014 14:10:25 +0100 [thread overview]
Message-ID: <1404825038-547-3-git-send-email-marc.zyngier@arm.com> (raw)
In-Reply-To: <1404825038-547-1-git-send-email-marc.zyngier@arm.com>
Calling irq_find_mapping from outside a irq_{enter,exit} section is
unsafe and produces ugly messages if CONFIG_PROVE_RCU is enabled:
If coming from the idle state, the rcu_read_lock call in irq_find_mapping
will generate an an unpleasant warning.
A solution is to add a new handle_domain_irq entry point into
the arm code that the interrupt controller code can call.
This new function takes an irq_domain, and calls into irq_find_domain
inside the irq_{enter,exit} block.
Interrupt controllers can then be updated to use the new mechanism.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm/include/asm/irq.h | 2 ++
arch/arm/kernel/irq.c | 23 +++++++++++++++++++----
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h
index 53c15de..8578811 100644
--- a/arch/arm/include/asm/irq.h
+++ b/arch/arm/include/asm/irq.h
@@ -24,10 +24,12 @@
#ifndef __ASSEMBLY__
struct irqaction;
struct pt_regs;
+struct irq_domain;
extern void migrate_irqs(void);
extern void asm_do_IRQ(unsigned int, struct pt_regs *);
void handle_IRQ(unsigned int, struct pt_regs *);
+void handle_domain_irq(struct irq_domain *, unsigned int, struct pt_regs *);
void init_IRQ(void);
#ifdef CONFIG_MULTI_IRQ_HANDLER
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 2c42576..d6af69f5 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -62,20 +62,30 @@ int arch_show_interrupts(struct seq_file *p, int prec)
* not come via this function. Instead, they should provide their
* own 'handler'. Used by platform code implementing C-based 1st
* level decoding.
+ *
+ * handle_domain_irq does the same thing, but also converts the HW
+ * interrupt number into a logical one using the provided domain. A
+ * NULL domain indicates that this conversion has already been done.
*/
-void handle_IRQ(unsigned int irq, struct pt_regs *regs)
+void handle_domain_irq(struct irq_domain *domain,
+ unsigned int hwirq, struct pt_regs *regs)
{
struct pt_regs *old_regs = set_irq_regs(regs);
+ unsigned int irq;
irq_enter();
+ if (domain)
+ irq = irq_find_mapping(domain, hwirq);
+ else
+ irq = hwirq;
+
/*
* Some hardware gives randomly wrong interrupts. Rather
* than crashing, do something sensible.
*/
- if (unlikely(irq >= nr_irqs)) {
- if (printk_ratelimit())
- printk(KERN_WARNING "Bad IRQ%u\n", irq);
+ if (unlikely(!irq || irq >= nr_irqs)) {
+ pr_warn_ratelimited("Bad IRQ%u (%u)\n", irq, hwirq);
ack_bad_irq(irq);
} else {
generic_handle_irq(irq);
@@ -85,6 +95,11 @@ void handle_IRQ(unsigned int irq, struct pt_regs *regs)
set_irq_regs(old_regs);
}
+void handle_IRQ(unsigned int irq, struct pt_regs *regs)
+{
+ handle_domain_irq(NULL, irq, regs);
+}
+
/*
* asm_do_IRQ is the interface to be used from assembly code.
*/
--
2.0.0
next prev parent reply other threads:[~2014-07-08 13:10 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-08 13:10 [PATCH 00/15] arm/arm64: fix use of irq_find_mapping outside of legal RCU context Marc Zyngier
2014-07-08 13:10 ` [PATCH 01/15] arm64: pass IRQ domain to the core IRQ handler Marc Zyngier
2014-07-08 13:10 ` Marc Zyngier [this message]
2014-08-02 7:51 ` [PATCH 02/15] ARM: " Russell King - ARM Linux
2014-08-04 10:00 ` Marc Zyngier
2014-07-08 13:10 ` [PATCH 03/15] irqchip: GIC: convert to handle_domain_irq Marc Zyngier
2014-07-08 13:10 ` [PATCH 04/15] irqchip: armada-370-xp: " Marc Zyngier
2014-07-08 13:10 ` [PATCH 05/15] irqchip: clps711x: " Marc Zyngier
2014-07-08 13:10 ` [PATCH 06/15] irqchip: mmp: " Marc Zyngier
2014-07-08 13:10 ` [PATCH 07/15] irqchip: mxs: " Marc Zyngier
2014-07-08 13:10 ` [PATCH 08/15] irqchip: orion: " Marc Zyngier
2014-07-08 13:10 ` [PATCH 09/15] irqchip: s3c24xx: " Marc Zyngier
2014-07-08 13:10 ` [PATCH 10/15] irqchip: sirfsoc: " Marc Zyngier
2014-07-08 13:10 ` [PATCH 11/15] irqchip: sun4i: " Marc Zyngier
2014-07-15 9:18 ` Antoine Ténart
2014-07-08 13:10 ` [PATCH 12/15] irqchip: versatile-fpga: " Marc Zyngier
2014-07-08 13:10 ` [PATCH 13/15] irqchip: vic: " Marc Zyngier
2014-07-08 13:10 ` [PATCH 14/15] irqchip: vt8500: " Marc Zyngier
2014-07-08 13:10 ` [PATCH 15/15] irqchip: zevio: " Marc Zyngier
2014-07-11 20:38 ` [PATCH 00/15] arm/arm64: fix use of irq_find_mapping outside of legal RCU context Christopher Covington
2014-07-29 14:28 ` 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=1404825038-547-3-git-send-email-marc.zyngier@arm.com \
--to=marc.zyngier@arm.com \
--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;
as well as URLs for NNTP newsgroup(s).