* [PATCH v2 02/15] ARM: pass IRQ domain to the core IRQ handler
@ 2014-07-08 13:45 Marc Zyngier
2014-07-08 13:45 ` [PATCH v2 04/15] irqchip: armada-370-xp: convert to handle_domain_irq Marc Zyngier
2014-07-13 22:48 ` [PATCH v2 02/15] ARM: pass IRQ domain to the core IRQ handler Jason Cooper
0 siblings, 2 replies; 3+ messages in thread
From: Marc Zyngier @ 2014-07-08 13:45 UTC (permalink / raw)
To: linux-arm-kernel
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>
---
Sending the right patch this time, with the missing includes that would
otherwise break the build...
arch/arm/include/asm/irq.h | 2 ++
arch/arm/kernel/irq.c | 25 +++++++++++++++++++++----
2 files changed, 23 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..a9e37434 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -27,7 +27,9 @@
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/irqchip.h>
+#include <linux/irqdomain.h>
#include <linux/random.h>
+#include <linux/ratelimit.h>
#include <linux/smp.h>
#include <linux/init.h>
#include <linux/seq_file.h>
@@ -62,20 +64,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 +97,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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 04/15] irqchip: armada-370-xp: convert to handle_domain_irq
2014-07-08 13:45 [PATCH v2 02/15] ARM: pass IRQ domain to the core IRQ handler Marc Zyngier
@ 2014-07-08 13:45 ` Marc Zyngier
2014-07-13 22:48 ` [PATCH v2 02/15] ARM: pass IRQ domain to the core IRQ handler Jason Cooper
1 sibling, 0 replies; 3+ messages in thread
From: Marc Zyngier @ 2014-07-08 13:45 UTC (permalink / raw)
To: linux-arm-kernel
Use the new handle_domain_irq method to handle interrupts.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
Sending the right patch this time...
drivers/irqchip/irq-armada-370-xp.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 574aba0..fa75a29 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -393,13 +393,15 @@ static void armada_370_xp_handle_msi_irq(struct pt_regs *regs, bool is_chained)
if (!(msimask & BIT(msinr)))
continue;
- irq = irq_find_mapping(armada_370_xp_msi_domain,
- msinr - 16);
-
- if (is_chained)
+ if (is_chained) {
+ irq = irq_find_mapping(armada_370_xp_msi_domain,
+ msinr - 16);
generic_handle_irq(irq);
- else
- handle_IRQ(irq, regs);
+ } else {
+ irq = msinr - 16;
+ handle_domain_irq(armada_370_xp_msi_domain,
+ irq, regs);
+ }
}
}
#else
@@ -444,9 +446,8 @@ armada_370_xp_handle_irq(struct pt_regs *regs)
break;
if (irqnr > 1) {
- irqnr = irq_find_mapping(armada_370_xp_mpic_domain,
- irqnr);
- handle_IRQ(irqnr, regs);
+ handle_domain_irq(armada_370_xp_mpic_domain,
+ irqnr, regs);
continue;
}
--
2.0.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 02/15] ARM: pass IRQ domain to the core IRQ handler
2014-07-08 13:45 [PATCH v2 02/15] ARM: pass IRQ domain to the core IRQ handler Marc Zyngier
2014-07-08 13:45 ` [PATCH v2 04/15] irqchip: armada-370-xp: convert to handle_domain_irq Marc Zyngier
@ 2014-07-13 22:48 ` Jason Cooper
1 sibling, 0 replies; 3+ messages in thread
From: Jason Cooper @ 2014-07-13 22:48 UTC (permalink / raw)
To: linux-arm-kernel
Marc,
On Tue, Jul 08, 2014 at 02:45:40PM +0100, Marc Zyngier wrote:
> 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>
> ---
> Sending the right patch this time, with the missing includes that would
> otherwise break the build...
>
> arch/arm/include/asm/irq.h | 2 ++
> arch/arm/kernel/irq.c | 25 +++++++++++++++++++++----
> 2 files changed, 23 insertions(+), 4 deletions(-)
Please place in Russell's patch tracker,
Acked-by: Jason Cooper <jason@lakedaemon.net>
Once it lands in a release, we'll apply the rest. Please send me a
gentle reminder ;-)
thx,
Jason.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-13 22:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-08 13:45 [PATCH v2 02/15] ARM: pass IRQ domain to the core IRQ handler Marc Zyngier
2014-07-08 13:45 ` [PATCH v2 04/15] irqchip: armada-370-xp: convert to handle_domain_irq Marc Zyngier
2014-07-13 22:48 ` [PATCH v2 02/15] ARM: pass IRQ domain to the core IRQ handler Jason Cooper
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).