[Skiboot] [PATCH 1/2] interrupts: Add an "irq_for_each_source" iterator
Benjamin Herrenschmidt
benh at kernel.crashing.org
Fri Apr 7 16:01:17 AEST 2017
This will be used by subsequent XIVE reset improvements
Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
core/interrupts.c | 12 ++++++++++++
include/interrupts.h | 6 ++++++
2 files changed, 18 insertions(+)
diff --git a/core/interrupts.c b/core/interrupts.c
index 006d555..b9f4d14 100644
--- a/core/interrupts.c
+++ b/core/interrupts.c
@@ -126,6 +126,18 @@ struct irq_source *irq_find_source(uint32_t isn)
return NULL;
}
+void irq_for_each_source(void (*cb)(struct irq_source *, void *), void *data)
+{
+ struct irq_source *is;
+
+ lock(&irq_lock);
+ list_for_each(&irq_sources, is, link)
+ cb(is, data);
+ list_for_each(&irq_sources2, is, link)
+ cb(is, data);
+ unlock(&irq_lock);
+}
+
/*
* This takes a 6-bit chip id and returns a 20 bit value representing
* the PSI interrupt. This includes all the fields above, ie, is a
diff --git a/include/interrupts.h b/include/interrupts.h
index 7576610..0376e8f 100644
--- a/include/interrupts.h
+++ b/include/interrupts.h
@@ -301,6 +301,12 @@ extern void register_irq_source(const struct irq_source_ops *ops, void *data,
extern void unregister_irq_source(uint32_t start, uint32_t count);
extern struct irq_source *irq_find_source(uint32_t isn);
+/* Warning: callback is called with internal source lock held
+ * so don't call back into any of our irq_ APIs from it
+ */
+extern void irq_for_each_source(void (*cb)(struct irq_source *, void *),
+ void *data);
+
extern uint32_t get_psi_interrupt(uint32_t chip_id);
extern struct dt_node *add_ics_node(void);
More information about the Skiboot
mailing list