[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250923232905.1510547-1-rrendec@redhat.com>
Date: Tue, 23 Sep 2025 19:29:04 -0400
From: Radu Rendec <rrendec@...hat.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-kernel@...r.kernel.org,
Brian Masney <bmasney@...hat.com>,
Eric Chanudet <echanude@...hat.com>
Subject: [PATCH 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.
Radu Rendec (1):
samples: Add irqchip test driver
samples/Kconfig | 10 +
samples/Makefile | 1 +
samples/irqchip/Makefile | 1 +
samples/irqchip/irqc_test.c | 576 ++++++++++++++++++++++++++++++++++++
4 files changed, 588 insertions(+)
create mode 100644 samples/irqchip/Makefile
create mode 100644 samples/irqchip/irqc_test.c
--
2.51.0
Powered by blists - more mailing lists