[irqchip: irq/irqchip-next] genirq: Define ack_irq() and eoi_irq() helpers

irqchip-bot for Valentin Schneider
2021-08-12T15:13:41Z

The following commit has been merged into the irq/irqchip-next branch of irqchip:

Commit-ID: 635e4fd40660d189e1a83973ddd663abf7bbc849
Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/635e4fd40660d189e1a83973ddd663abf7bbc849
Author: Valentin Schneider <valentin.schneider@arm.com>
AuthorDate: Tue, 29 Jun 2021 13:49:59 +01:00
Committer: Marc Zyngier <maz@kernel.org>
CommitterDate: Thu, 12 Aug 2021 15:48:19 +01:00

genirq: Define ack_irq() and eoi_irq() helpers

The newly-added IRQCHIP_AUTOMASKS_FLOW flag requires some additional
bookkeeping around chip->{irq_ack, irq_eoi}() calls. Define wrappers around
those chip callbacks to drive the IRQD_IRQ_FLOW_MASKED state of an IRQ when
the chip has the IRQCHIP_AUTOMASKS_FLOW flag.

Signed-off-by: Valentin Schneider <valentin.schneider@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20210629125010.458872-3-valentin.schneider@arm.com
---
kernel/irq/chip.c | 16 ++++++++++++++++
kernel/irq/internals.h | 2 ++
2 files changed, 18 insertions(+)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 21a21ba..793dbd8 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -408,6 +408,22 @@ void irq_percpu_disable(struct irq_desc *desc, unsigned int cpu)
cpumask_clear_cpu(cpu, desc->percpu_enabled);
}

+void ack_irq(struct irq_desc *desc)
+{
+ desc->irq_data.chip->irq_ack(&desc->irq_data);
+
+ if (desc->irq_data.chip->flags & IRQCHIP_AUTOMASKS_FLOW)
+ irq_state_set_flow_masked(desc);
+}
+
+void eoi_irq(struct irq_desc *desc)
+{
+ desc->irq_data.chip->irq_eoi(&desc->irq_data);
+
+ if (desc->irq_data.chip->flags & IRQCHIP_AUTOMASKS_FLOW)
+ irq_state_clr_flow_masked(desc);
+}
+
static inline void mask_ack_irq(struct irq_desc *desc)
{
if (desc->irq_data.chip->irq_mask_ack) {
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index b6c1cce..6d6a621 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -87,6 +87,8 @@ extern void irq_enable(struct irq_desc *desc);
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);
+extern void ack_irq(struct irq_desc *desc);
+extern void eoi_irq(struct irq_desc *desc);
extern void mask_irq(struct irq_desc *desc);
extern void unmask_irq(struct irq_desc *desc);
extern void unmask_threaded_irq(struct irq_desc *desc);