From: Radu Rendec <rrendec@redhat.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org, Brian Masney <bmasney@redhat.com>,
Eric Chanudet <echanude@redhat.com>
Subject: [PATCH 0/1] irqchip test driver/sandbox
Date: Tue, 23 Sep 2025 19:29:04 -0400 [thread overview]
Message-ID: <20250923232905.1510547-1-rrendec@redhat.com> (raw)
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
next reply other threads:[~2025-09-23 23:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-23 23:29 Radu Rendec [this message]
2025-09-23 23:29 ` [PATCH 1/1] samples: Add irqchip test driver Radu Rendec
2025-09-25 23:27 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250923232905.1510547-1-rrendec@redhat.com \
--to=rrendec@redhat.com \
--cc=bmasney@redhat.com \
--cc=echanude@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox