Skip to content

irqchip test driver/sandbox

Radu Rendec lkml 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest posting 2/21 patch 0 repliesNew
  2. v2 posting 1/21 patch 0 repliesSuperseded
  3. v11 patch 0 repliesSuperseded

Changes in v2 from the cover letter

- Fix sysfs file mode on module parameter
- Add "depends" to Kconfig to prevent build failures on unsupported architectures (no IRQ domain hierarchy support e.g. x86_32)
- Link to v1: https://lore.kernel.org/all/[email protected]/

Patches in v2 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1samples: Add irqchip test driversamples/Kconfig samples/Makefile samples/irqchip/Makefile +1 more+589 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH RESEND v2 0/1] irqchip test driver/sandbox

This is a dummy irqchip driver that implements three different types of IRQ chips, requests interrupts like a real device driver would do, and provides the ability to manually trigger any of these interrupts. The main reason why I wrote it was to be able to hack on the kernel IRQ core without depending on any hardware (even virtual, inside a VM). But it can also be used as an example for implementing irqchip drivers.

The irqchip setup/layout is described in detail in a comment block at the top of the driver's source file, so I'm not repeating it here. Two "leaf" IRQ domains are implemented: hierarchical and multiplexing. These are attached to an additional "root" domain, which is similar to APIC (x86_64) or GIC (arm64). Interrupts are simulated by calling the generic interrupt handling function on the "root" domain, in a workqueue context and with local interrupts disabled.

A few notes on the implementation:
- The driver cannot be compiled as a loadable module, and the only reason is because it uses irq_move_irq(), which is not exported. I could not find a better way to make IRQ affinity control for the "root" domain work on x86. This is also documented in the source code.
- The driver uses a write-only module parameter with a custom handler as the interface to trigger simulated interrupts. While this slightly abuses the module parameter API, it's very simple to implement and also keeps the sysfs file confined in the module's own "namespace" at /sys/module/irqc_test. Of course, setting the parameter on the kernel command line makes no sense but doesn't have any side effect either.

---
Changes in v2:
- Fix sysfs file mode on module parameter
- Add "depends" to Kconfig to prevent build failures on unsupported architectures (no IRQ domain hierarchy support e.g. x86_32)
- Link to v1: https://lore.kernel.org/all/[email protected]/

---
Radu Rendec (1):
samples: Add irqchip test driver

 samples/Kconfig             |  11 +
 samples/Makefile            |   1 +
 samples/irqchip/Makefile    |   1 +
 samples/irqchip/irqc_test.c | 576 ++++++++++++++++++++++++++++++++++++
 4 files changed, 589 insertions(+)
 create mode 100644 samples/irqchip/Makefile
 create mode 100644 samples/irqchip/irqc_test.c
Signature · 1 line
2.51.1