From: Fil Dunsky via B4 Relay <devnull+filipp.dunsky.gmail.com@kernel.org>
To: Thomas Gleixner <tglx@kernel.org>, Radu Rendec <radu@rendec.net>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Fil Dunsky <filipp.dunsky@gmail.com>
Subject: [PATCH v7 1/3] irqdomain: Pass temporary data to initialization callbacks
Date: Fri, 04 Dec 2026 22:59:30 +0300 [thread overview]
Message-ID: <20261204-cs75xx-intc-v7-1-c5e6e23a1a8c@gmail.com> (raw)
In-Reply-To: <20261204-cs75xx-intc-v7-0-c5e6e23a1a8c@gmail.com>
From: Fil Dunsky <filipp.dunsky@gmail.com>
Interrupt controller drivers may need the same temporary setup data in
both their generic chip and domain initialization callbacks. Passing it
through host_data requires managing its lifetime outside the core and
risks exposing the transient pointer with a published domain.
Add init_data for the initialization callbacks and clear it before
the domain is published. Callbacks must not retain this pointer.
Suggested-by: Thomas Gleixner <tglx@kernel.org>
Link: https://lore.kernel.org/r/87zeuoogwp.ffs@fw13
Signed-off-by: Fil Dunsky <filipp.dunsky@gmail.com>
---
include/linux/irqdomain.h | 7 +++++++
kernel/irq/irqdomain.c | 3 +++
2 files changed, 10 insertions(+)
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index d8caafcecc..2c5b9a2fe7 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -149,6 +149,9 @@ struct irq_domain_chip_generic;
* @gc: Pointer to a list of generic chips. There is a helper function for
* setting up one or more generic chips for interrupt controllers
* drivers using the generic chip library which uses this pointer.
+ * @init_data: Temporary private data for the domain and generic chip init
+ * callbacks. It may point to stack memory and is cleared before
+ * the domain is published. Callbacks must not retain this pointer.
* @dev: Pointer to the device which instantiated the irqdomain
* With per device irq domains this is not necessarily the same
* as @pm_dev.
@@ -188,6 +191,7 @@ struct irq_domain {
const struct msi_parent_ops *msi_parent_ops;
#endif
void (*exit)(struct irq_domain *d);
+ void *init_data;
/* reverse map data. The linear map gets appended to the irq_domain */
irq_hw_number_t hwirq_max;
@@ -325,6 +329,8 @@ struct irq_domain_chip_generic_info;
* domains are added using same fwnode
* @ops: Domain operation callbacks
* @host_data: Controller private data pointer
+ * @init_data: Temporary data for the domain and generic chip init
+ * callbacks. It may point to stack memory.
* @dev: Device which creates the domain
* @dgc_info: Geneneric chip information structure pointer used to
* create generic chips for the domain if not NULL.
@@ -345,6 +351,7 @@ struct irq_domain_info {
const char *name_suffix;
const struct irq_domain_ops *ops;
void *host_data;
+ void *init_data;
struct device *dev;
#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
/**
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
index 4fdcb6df53..daa7894c05 100644
--- a/kernel/irq/irqdomain.c
+++ b/kernel/irq/irqdomain.c
@@ -332,6 +332,7 @@ static struct irq_domain *__irq_domain_instantiate(const struct irq_domain_info
domain->flags |= info->domain_flags;
domain->exit = info->exit;
domain->dev = info->dev;
+ domain->init_data = info->init_data;
#ifdef CONFIG_IRQ_DOMAIN_HIERARCHY
if (info->parent) {
@@ -353,6 +354,8 @@ static struct irq_domain *__irq_domain_instantiate(const struct irq_domain_info
goto err_domain_gc_remove;
}
+ /* The temporary data may live on the caller's stack. */
+ domain->init_data = NULL;
__irq_domain_publish(domain);
if (cond_alloc_descs && info->virq_base > 0)
--
2.53.0
next prev parent reply other threads:[~2026-12-04 19:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 19:59 [PATCH v7 0/3] irqchip: Add Cortina Systems CS75xx peripheral interrupt controller Fil Dunsky via B4 Relay
2026-12-04 19:59 ` Fil Dunsky via B4 Relay [this message]
2026-12-04 19:59 ` [PATCH v7 2/3] dt-bindings: interrupt-controller: Add Cortina Systems CS7542 " Fil Dunsky via B4 Relay
2026-12-04 19:59 ` [PATCH v7 3/3] irqchip: Add Cortina Systems CS75xx " Fil Dunsky via B4 Relay
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=20261204-cs75xx-intc-v7-1-c5e6e23a1a8c@gmail.com \
--to=devnull+filipp.dunsky.gmail.com@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=filipp.dunsky@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=radu@rendec.net \
--cc=robh@kernel.org \
--cc=tglx@kernel.org \
/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
all inboxes | Powered by JetHome®