Skip to contentSkip to conversation

simulated interrupts

PATCH Superseded Bartosz Golaszewski 7 participants 16 messages Jul 19, 2017 – Aug 2, 2017

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover simulated interrupts

Some frameworks (e.g. iio, gpiolib) use irq_work to implement simulated interrupts that can be 'fired' from process context when needed and requested just like normal interrupts. This is useful for testing and development purposes.

Currently this code is reimplemented by every user. This series proposes to add a new set of functions that can be used by drivers that want to simulate interrupts without having to duplicate any boilerplate code.

The first patch adds a simple irq simulator framework. The second extends it with resource management. The third uses the new functionality in the gpio-mockup testing driver.

NOTE: The next candidate for using this API would be iio-dummy-evgen.

Bartosz Golaszewski (3):
irq/irq_sim: add a simple interrupt simulator framework irq/irq_sim: add a devres variant of irq_sim_init()
gpio: mockup: use irq_sim

 Documentation/driver-model/devres.txt |   1 +
 drivers/gpio/Kconfig                  |   2 +-
 drivers/gpio/gpio-mockup.c            |  77 ++--------------
 include/linux/irq_sim.h               |  41 +++++++++
 init/Kconfig                          |   4 +
 kernel/Makefile                       |   1 +
 kernel/irq_sim.c                      | 161 ++++++++++++++++++++++++++++++++++
 7 files changed, 216 insertions(+), 71 deletions(-)
 create mode 100644 include/linux/irq_sim.h
 create mode 100644 kernel/irq_sim.c
Signature · 1 line
2.13.2
#1 lore raw

PATCH 1/3 irq/irq_sim: add a simple interrupt simulator framework

Implement a simple, irq_work-based framework for simulating interrupts. Currently the API exposes routines for initializing and deinitializing the simulator object, enqueueing the interrupts and retrieving the allocated interrupt numbers based on the offset of the dummy interrupt in the simulator struct.

---
 include/linux/irq_sim.h |  37 +++++++++++++++
 init/Kconfig            |   4 ++
 kernel/Makefile         |   1 +
 kernel/irq_sim.c        | 118 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 160 insertions(+)
 create mode 100644 include/linux/irq_sim.h
 create mode 100644 kernel/irq_sim.c
include/linux/irq_sim.h new file +37 -0
new file mode 100644
index 000000000000..0c1abf0e3244
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2017 Bartosz Golaszewski <[email protected]>
+ *
+ * Provides a framework for allocating simulated interrupts which can be
+ * requested like normal irqs and enqueued from process context.
+ */
+
+#ifndef _LINUX_IRQ_SIM_H
+#define _LINUX_IRQ_SIM_H
+
+#include <linux/irq_work.h>
+
+struct irq_sim_work_ctx {
+	struct irq_work work;
+	int irq;
+};
+
+struct irq_sim_irq_ctx {
+	int irqnum;
+	bool enabled;
+};
+
+struct irq_sim {
+	struct irq_sim_work_ctx work_ctx;
+	int irq_base;
+	unsigned int irq_count;
+	struct irq_sim_irq_ctx *irqs;
+};
+
+int irq_sim_init(struct irq_sim *sim, unsigned int num_irqs);
+void irq_sim_fini(struct irq_sim *sim);
+
+void irq_sim_fire(struct irq_sim *sim, unsigned int offset);
+
+int irq_sim_irqnum(struct irq_sim *sim, unsigned int offset);
+
+#endif /* _LINUX_IRQ_SIM_H */
init/Kconfig +4 -0
index 8514b25db21c..220456599c3f 100644
@@ -23,6 +23,10 @@ config CONSTRUCTORS
 config IRQ_WORK
 	bool
 
+config IRQ_SIM
+	bool
+	select IRQ_WORK
+
 config BUILDTIME_EXTABLE_SORT
 	bool
 
kernel/Makefile +1 -0
index 4cb8e8b23c6e..4472567c5835 100644
@@ -97,6 +97,7 @@ obj-$(CONFIG_TRACE_CLOCK) += trace/
 obj-$(CONFIG_RING_BUFFER) += trace/
 obj-$(CONFIG_TRACEPOINTS) += trace/
 obj-$(CONFIG_IRQ_WORK) += irq_work.o
+obj-$(CONFIG_IRQ_SIM) += irq_sim.o
 obj-$(CONFIG_CPU_PM) += cpu_pm.o
 obj-$(CONFIG_BPF) += bpf/
 
kernel/irq_sim.c new file +118 -0

118 lines not on this page · raw message

Signature · 1 line
2.13.2
#2 lore raw

Re: [PATCH 1/3] irq/irq_sim: add a simple interrupt simulator framework

Quoted 7 lines · On Wed, 19 Jul 2017 14:20:12 +0200 Bartosz Golaszewski <[email protected]> wrote:

Implement a simple, irq_work-based framework for simulating interrupts. Currently the API exposes routines for initializing and deinitializing the simulator object, enqueueing the interrupts and retrieving the allocated interrupt numbers based on the offset of the dummy interrupt in the simulator struct.

Mostly looks good. A comment and a question inline.

Jonathan

Quoted 141 lines
---
 include/linux/irq_sim.h |  37 +++++++++++++++
 init/Kconfig            |   4 ++
 kernel/Makefile         |   1 +
 kernel/irq_sim.c        | 118 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 160 insertions(+)
 create mode 100644 include/linux/irq_sim.h
 create mode 100644 kernel/irq_sim.c
include/linux/irq_sim.h new file +37 -0
new file mode 100644
index 000000000000..0c1abf0e3244
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2017 Bartosz Golaszewski <[email protected]>
+ *
+ * Provides a framework for allocating simulated interrupts which can be
+ * requested like normal irqs and enqueued from process context.
+ */
+
+#ifndef _LINUX_IRQ_SIM_H
+#define _LINUX_IRQ_SIM_H
+
+#include <linux/irq_work.h>
+
+struct irq_sim_work_ctx {
+	struct irq_work work;
+	int irq;
+};
+
+struct irq_sim_irq_ctx {
+	int irqnum;
+	bool enabled;
+};
+
+struct irq_sim {
+	struct irq_sim_work_ctx work_ctx;
+	int irq_base;
+	unsigned int irq_count;
+	struct irq_sim_irq_ctx *irqs;
+};
+
+int irq_sim_init(struct irq_sim *sim, unsigned int num_irqs);
+void irq_sim_fini(struct irq_sim *sim);
+
+void irq_sim_fire(struct irq_sim *sim, unsigned int offset);
+
+int irq_sim_irqnum(struct irq_sim *sim, unsigned int offset);
+
+#endif /* _LINUX_IRQ_SIM_H */
init/Kconfig +4 -0
index 8514b25db21c..220456599c3f 100644
@@ -23,6 +23,10 @@ config CONSTRUCTORS
 config IRQ_WORK
 	bool
 
+config IRQ_SIM
+	bool
+	select IRQ_WORK
+
 config BUILDTIME_EXTABLE_SORT
 	bool
 
kernel/Makefile +1 -0
index 4cb8e8b23c6e..4472567c5835 100644
@@ -97,6 +97,7 @@ obj-$(CONFIG_TRACE_CLOCK) += trace/
 obj-$(CONFIG_RING_BUFFER) += trace/
 obj-$(CONFIG_TRACEPOINTS) += trace/
 obj-$(CONFIG_IRQ_WORK) += irq_work.o
+obj-$(CONFIG_IRQ_SIM) += irq_sim.o
 obj-$(CONFIG_CPU_PM) += cpu_pm.o
 obj-$(CONFIG_BPF) += bpf/
 
kernel/irq_sim.c new file +56 -0
new file mode 100644
index 000000000000..062110c90d2a
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2017 Bartosz Golaszewski <[email protected]>
+ *
+ * Provides a framework for allocating simulated interrupts which can be
+ * requested like normal irqs and enqueued from process context.
+ */
+
+#include <linux/irq_sim.h>
+#include <linux/irq.h>
+
+static void irq_sim_irqmask(struct irq_data *data)
+{
+	struct irq_sim_irq_ctx *irq_ctx = irq_data_get_irq_chip_data(data);
+
+	irq_ctx->enabled = false;
+}
+
+static void irq_sim_irqunmask(struct irq_data *data)
+{
+	struct irq_sim_irq_ctx *irq_ctx = irq_data_get_irq_chip_data(data);
+
+	irq_ctx->enabled = true;
+}
+
+static struct irq_chip irq_sim_irqchip = {
+	.name		= "irq_sim",
+	.irq_mask	= irq_sim_irqmask,
+	.irq_unmask	= irq_sim_irqunmask,
+};
+
+static void irq_sim_handle_irq(struct irq_work *work)
+{
+	struct irq_sim_work_ctx *work_ctx;
+
+	work_ctx = container_of(work, struct irq_sim_work_ctx, work);
+	handle_simple_irq(irq_to_desc(work_ctx->irq));
+}
+
+/**
+ * irq_sim_init - Initialize the interrupt simulator: allocate a range of
+ *                dummy interrupts.
+ *
+ * @sim:        The interrupt simulator object to initialize.
+ * @num_irqs:   Number of interrupts to allocate
+ *
+ * Returns 0 on success and a negative error number on failure.
+ */
+int irq_sim_init(struct irq_sim *sim, unsigned int num_irqs)
+{
+	int i;
+
+	sim->irqs = kmalloc_array(num_irqs, sizeof(*sim->irqs), GFP_KERNEL);
+	if (!sim->irqs)
+		return -ENOMEM;
+
+	sim->irq_base = irq_alloc_descs(-1, 0, num_irqs, 0);

kernel/irq_sim.c line 66

Quoted 10 lines
kernel/irq_sim.c new file +10 -0
+	if (sim->irq_base < 0) {
+		kfree(sim->irqs);
+		return sim->irq_base;
+	}
+
+	for (i = 0; i < num_irqs; i++) {
+		sim->irqs[i].irqnum = sim->irq_base + i;
+		sim->irqs[i].enabled = false;
+		irq_set_chip(sim->irq_base + i, &irq_sim_irqchip);
+		irq_set_chip_data(sim->irq_base + i, &sim->irqs[i]);

Cool. That's nicer than what we have in IIO :) This function really doesn't have a clear name though as I initially thought the data was shared by the chip, where as it is the chip_data associated with a particular IRQ. Had me briefly confused!

Just goes to show the advantage of a unified bit of code for similar users - the gpio code was nicer than the IIO one as it turned out.

Quoted 25 lines
kernel/irq_sim.c new file +25 -0
+		irq_set_handler(sim->irq_base + i, &handle_simple_irq);
+		irq_modify_status(sim->irq_base + i,
+				  IRQ_NOREQUEST | IRQ_NOAUTOEN, IRQ_NOPROBE);
+	}
+
+	init_irq_work(&sim->work_ctx.work, irq_sim_handle_irq);
+	sim->irq_count = num_irqs;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(irq_sim_init);
+
+/**
+ * irq_sim_fini - Deinitialize the interrupt simulator: free the interrupt
+ *                descriptors and allocated memory.
+ *
+ * @sim:        The interrupt simulator to tear down.
+ */
+void irq_sim_fini(struct irq_sim *sim)
+{
+	irq_free_descs(sim->irq_base, sim->irq_count);
+	kfree(sim->irqs);
+}
+EXPORT_SYMBOL_GPL(irq_sim_fini);
+

kernel/irq_sim.c line 101

Quoted 10 lines
kernel/irq_sim.c new file +10 -0
+/**
+ * irq_sim_fire - Enqueue an interrupt.
+ *
+ * @sim:        The interrupt simulator object.
+ * @offset:     Offset of the simulated interrupt which should be fired.
+ */
+void irq_sim_fire(struct irq_sim *sim, unsigned int offset)
+{
+	if (sim->irqs[offset].enabled) {
+		sim->work_ctx.irq = irq_sim_irqnum(sim, offset);

Is this safe against more than one firing at a time? Or is it the responsibility of the caller to prevent that?

Quoted 17 lines
kernel/irq_sim.c new file +17 -0
+		irq_work_queue(&sim->work_ctx.work);
+	}
+}
+EXPORT_SYMBOL_GPL(irq_sim_fire);
+
+/**
+ * irq_sim_irqnum - Get the allocated number of a dummy interrupt.
+ *
+ * @sim:        The interrupt simulator object.
+ * @offset:     Offset of the simulated interrupt for which to retrieve
+ *              the number.
+ */
+int irq_sim_irqnum(struct irq_sim *sim, unsigned int offset)
+{
+	return sim->irqs[offset].irqnum;
+}
+EXPORT_SYMBOL_GPL(irq_sim_irqnum);
#3 lore raw

Re: [PATCH 1/3] irq/irq_sim: add a simple interrupt simulator framework

2017-07-22 22:59 GMT+02:00 Jonathan Cameron <[email protected]>:

Quoted 5 lines
Quoted 5 lines
kernel/irq_sim.c new file +5 -0
+
+/**
+ * irq_sim_fire - Enqueue an interrupt.
+ *
+ * @sim:        The interrupt simulator object.
Quoted 9 lines

kernel/irq_sim.c line 101

Quoted 6 lines

+ * @offset: Offset of the simulated interrupt which should be fired.
+ */

kernel/irq_sim.c new file +4 -0
+void irq_sim_fire(struct irq_sim *sim, unsigned int offset)
+{
+     if (sim->irqs[offset].enabled) {
+             sim->work_ctx.irq = irq_sim_irqnum(sim, offset);

Is this safe against more than one firing at a time? Or is it the responsibility of the caller to prevent that?

Yes, I assumed this should be the responsibility of the caller. Let me know if there's an important reason to implement separate locking within this framework. My goal was to keep it simple, hence no generalized UAPI too - callers should use their own interfaces to expose this to the user space if needed.

Thanks,
Bartosz

#4 lore raw

Re: [PATCH 1/3] irq/irq_sim: add a simple interrupt simulator framework

In reply to Bartosz Golaszewski

On 07/19/2017 02:20 PM, Bartosz Golaszewski wrote:
[...]

Review

Quoted 2 lines
(quoted diff) +2 -0
+void irq_sim_fini(struct irq_sim *sim)
+{

Not very likely to happen in practice, but for correctness we should probably put a irq_work_sync() here for each of the IRQs to make sure that the memory associated with the irq_sim_work_ctx struct is no longer accessed and that handle_simple_irq() is not called after irq_free_descs().

Quoted 4 lines
kernel/irq_sim.c new file +4 -0
+	irq_free_descs(sim->irq_base, sim->irq_count);
+	kfree(sim->irqs);
+}
+EXPORT_SYMBOL_GPL(irq_sim_fini);
#5 lore raw

PATCH 2/3 irq/irq_sim: add a devres variant of irq_sim_init()

In reply to Bartosz Golaszewski

Add a resource managed version of irq_sim_init(). This can be conveniently used in device drivers.

---
 Documentation/driver-model/devres.txt |  1 +
 include/linux/irq_sim.h               |  4 ++++
 kernel/irq_sim.c                      | 43 +++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+)
Documentation/driver-model/devres.txt +1 -0
index 30e04f7a690d..69f08c0f23a8 100644
@@ -312,6 +312,7 @@ IRQ
   devm_irq_alloc_descs_from()
   devm_irq_alloc_generic_chip()
   devm_irq_setup_generic_chip()
+  devm_irq_sim_init()
 
 LED
   devm_led_classdev_register()
include/linux/irq_sim.h +4 -0
index 0c1abf0e3244..94c4bfc9b7a9 100644
@@ -9,6 +9,7 @@
 #define _LINUX_IRQ_SIM_H
 
 #include <linux/irq_work.h>
+#include <linux/device.h>
 
 struct irq_sim_work_ctx {
 	struct irq_work work;
@@ -30,6 +31,9 @@ struct irq_sim {
 int irq_sim_init(struct irq_sim *sim, unsigned int num_irqs);
 void irq_sim_fini(struct irq_sim *sim);
 
+int devm_irq_sim_init(struct device *dev,
+		      struct irq_sim *sim, unsigned int num_irqs);
+
 void irq_sim_fire(struct irq_sim *sim, unsigned int offset);
 
 int irq_sim_irqnum(struct irq_sim *sim, unsigned int offset);
kernel/irq_sim.c +43 -0

49 lines not on this page · raw message

Signature · 1 line
2.13.2
#6 lore raw

PATCH 3/3 gpio: mockup: use irq_sim

In reply to Bartosz Golaszewski

Shrink the driver by removing the code dealing with dummy interrupts and replacing it with calls to the irq_sim API.

---
 drivers/gpio/Kconfig       |  2 +-
 drivers/gpio/gpio-mockup.c | 77 +++++-----------------------------------------
 2 files changed, 8 insertions(+), 71 deletions(-)
drivers/gpio/Kconfig +1 -1
index f235eae04c16..e2264fb31f87 100644
@@ -311,7 +311,7 @@ config GPIO_MOCKUP
 	depends on GPIOLIB && SYSFS
 	select GPIO_SYSFS
 	select GPIOLIB_IRQCHIP
-	select IRQ_WORK
+	select IRQ_SIM
 	help
 	  This enables GPIO Testing driver, which provides a way to test GPIO
 	  subsystem through sysfs(or char device) and debugfs. GPIO_SYSFS
drivers/gpio/gpio-mockup.c +7 -70

115 lines not on this page · raw message

Signature · 1 line
2.13.2
#8 lore raw
In reply to Bartosz Golaszewski
Quoted 10 lines · Bartosz Golaszewski

Some frameworks (e.g. iio, gpiolib) use irq_work to implement simulated interrupts that can be 'fired' from process context when needed and requested just like normal interrupts. This is useful for testing and development purposes.

Currently this code is reimplemented by every user. This series proposes to add a new set of functions that can be used by drivers that want to simulate interrupts without having to duplicate any boilerplate code.

Quoted 5 lines

The first patch adds a simple irq simulator framework. The second extends it with resource management. The third uses the new functionality in the gpio-mockup testing driver.

NOTE: The next candidate for using this API would be iio-dummy-evgen.

I like the general idea - have not looked at the code yet. Just a quick
question: How many copies/variants of this scheme do we have in tree?

Thanks,

tglx

#9 lore raw

2017-07-19 14:25 GMT+02:00 Thomas Gleixner <[email protected]>:

Quoted 16 lines · Bartosz Golaszewski
Quoted 15 lines

Some frameworks (e.g. iio, gpiolib) use irq_work to implement simulated interrupts that can be 'fired' from process context when needed and requested just like normal interrupts. This is useful for testing and development purposes.

Currently this code is reimplemented by every user. This series proposes to add a new set of functions that can be used by drivers that want to simulate interrupts without having to duplicate any boilerplate code.

The first patch adds a simple irq simulator framework. The second extends it with resource management. The third uses the new functionality in the gpio-mockup testing driver.

Quoted 8 lines
Quoted 1 line

NOTE: The next candidate for using this API would be iio-dummy-evgen.

I like the general idea - have not looked at the code yet. Just a quick
question: How many copies/variants of this scheme do we have in tree?

Thanks,

tglx

Currently there are two: iio and gpiolib basically duplicate the same code in their respective testing drivers. I only used irq_sim in gpio-mockup in this series as an example and to see if there's any interest in merging it before spending time on iio-dummy-evgen.

In the future this could be used in any framework that uses interrupts and wants to test the irq code paths without touching any specific hardware.

Thanks,
Bartosz

#10 lore raw
Quoted 22 lines · Bartosz Golaszewski

2017-07-19 14:25 GMT+02:00 Thomas Gleixner <[email protected]>:

Quoted 21 lines · Bartosz Golaszewski
Quoted 11 lines

Some frameworks (e.g. iio, gpiolib) use irq_work to implement simulated interrupts that can be 'fired' from process context when needed and requested just like normal interrupts. This is useful for testing and development purposes.

Currently this code is reimplemented by every user. This series proposes to add a new set of functions that can be used by drivers that want to simulate interrupts without having to duplicate any boilerplate code.

Quoted 5 lines

The first patch adds a simple irq simulator framework. The second extends it with resource management. The third uses the new functionality in the gpio-mockup testing driver.

NOTE: The next candidate for using this API would be iio-dummy-evgen.

I like the general idea - have not looked at the code yet. Just a quick
question: How many copies/variants of this scheme do we have in tree?

Quoted 8 lines
Quoted 3 lines

Thanks,

tglx

Currently there are two: iio and gpiolib basically duplicate the same code in their respective testing drivers. I only used irq_sim in gpio-mockup in this series as an example and to see if there's any interest in merging it before spending time on iio-dummy-evgen.

Yes, I think so. Consolidation is always a good thing and simulation is useful for developing or validating code.

Thanks,

tglx

#11 lore raw
Quoted 28 lines · Thomas Gleixner
Quoted 26 lines · Bartosz Golaszewski

2017-07-19 14:25 GMT+02:00 Thomas Gleixner <[email protected]>:

Quoted 24 lines · Bartosz Golaszewski
Quoted 11 lines

Some frameworks (e.g. iio, gpiolib) use irq_work to implement simulated interrupts that can be 'fired' from process context when needed and requested just like normal interrupts. This is useful for testing and development purposes.

Currently this code is reimplemented by every user. This series proposes to add a new set of functions that can be used by drivers that want to simulate interrupts without having to duplicate any boilerplate code.

Quoted 5 lines

The first patch adds a simple irq simulator framework. The second extends it with resource management. The third uses the new functionality in the gpio-mockup testing driver.

NOTE: The next candidate for using this API would be iio-dummy-evgen.

I like the general idea - have not looked at the code yet. Just a quick
question: How many copies/variants of this scheme do we have in tree?

Thanks,

tglx

Quoted 7 lines
Quoted 4 lines

Currently there are two: iio and gpiolib basically duplicate the same code in their respective testing drivers. I only used irq_sim in gpio-mockup in this series as an example and to see if there's any interest in merging it before spending time on iio-dummy-evgen.

Yes, I think so. Consolidation is always a good thing and simulation is useful for developing or validating code.

Indeed, that's pretty interesting.

On a slightly tangential subject, there is another aspect that I thought of implementing for a while, but always ended up just relying on a quick
hack: forcing the injection of an actual interrupt. A number of interrupt controllers have the ability to make an interrupt pending, for it to be handled as if a device had actually triggered it.

In my case, it has proved to be incredibly useful when debugging the interrupt controller itself, and also things that mess with interrupts in a creative way (like KVM) while relying on a particular interrupt controller.

What I had in mind was something like:

echo 1 >/proc/irq/9/trigger (or the corresponding /sys/kernel/debug/irq/irqs/ interface if we want to make sure that this is really not for production use...).

If there is any interest, I'll try to whip something up.

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
#12 lore raw
Quoted 6 lines · Marc Zyngier
Quoted 1 line · Thomas Gleixner

On Wed, 19 Jul 2017, Bartosz Golaszewski wrote:

echo 1 >/proc/irq/9/trigger
(or the corresponding /sys/kernel/debug/irq/irqs/ interface if we want to make sure that this is really not for production use...).

or /sys/kernel/irq as a successor of /proc/irq

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#13 lore raw
Quoted 9 lines · Andy Shevchenko
Quoted 6 lines · Marc Zyngier
Quoted 1 line · Thomas Gleixner

On Wed, 19 Jul 2017, Bartosz Golaszewski wrote:

echo 1 >/proc/irq/9/trigger
(or the corresponding /sys/kernel/debug/irq/irqs/ interface if we want to make sure that this is really not for production use...).

or /sys/kernel/irq as a successor of /proc/irq

/sys/kernel/debug/irq/irqs/ is already there and it's DEBUG and not something which is in the regular sysfs maze.

Thanks,

tglx

#14 lore raw
Quoted 11 lines · Thomas Gleixner
Quoted 7 lines · Andy Shevchenko
Quoted 3 lines · Marc Zyngier

echo 1 >/proc/irq/9/trigger
(or the corresponding /sys/kernel/debug/irq/irqs/ interface if we want to make sure that this is really not for production use...).

or /sys/kernel/irq as a successor of /proc/irq

/sys/kernel/debug/irq/irqs/ is already there and it's DEBUG and not something which is in the regular sysfs maze.

Yep. My point was "not to extend /proc/irq interface". From the description of the series it indeed looks suitable rather for debug.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#15 lore raw
In reply to Marc Zyngier
Quoted 5 lines · Marc Zyngier

On a slightly tangential subject, there is another aspect that I thought of implementing for a while, but always ended up just relying on a quick
hack: forcing the injection of an actual interrupt. A number of interrupt controllers have the ability to make an interrupt pending, for it to be handled as if a device had actually triggered it.

This would be especially useful for a class of embedded systems that are woken up from deep sleep by an asynchronous interrupt controller.

Usually GPIO(-ish) lines are armed and the system put to sleep, and when it comes up, the information of what line woke it up is there in a special register, but the actual (synchronous) interrupt line is no longer asserted or edge triggered, so an interrupt need to be inserted.

Yours,
Linus Walleij