From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796414372; b=J4ckhHMa80GDh2nL2x70slOndAGu/zmk8987eQnC6+DnkmrEw78HHIv5DM7ISTMCXlCK XTHmIYM3TzRInDb1yUqf0AFEyXdqCVJB9j9ImDphcuktEi0ZzguFzX7Nd4A7jnFcXSm8J e6WbOd6V5OuaDzWXqLZKKYuBMPTTakS1xj8wgDgx2bfaGr6T5exFIisd08ExN0eDxasB3 sJEWHJOpgbVhPJbL2C9PJ/biyzbMT5NHuqSLknLCucgBnYkBIOV0MbpcG3AkUgcLN4ZUI pv4uY6yM+ffRaNt+B4ZagKP4ydNEkXZR5YBGc+fyuQRosqI3qc+xmu0vN5Hc5bkoMeA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796414372; h=Received:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=lx+ym9U/E5fZ/LBf8QfXAx+PbT58/VohpOIhVt+t6Ic=; b=mhKA6flgwBMKU9cuyqOcAsUnniLoD8QFmO8e6rfryKbPLsZwwNiXEG3/AwKkYm8gBhDh hoyxwingDfOfiDuZhnIxzo480kngXDb6gaYtjsmn6qXgfcGwvxqBJX5IW4dD3zIsbXZJs x7dVWMSbr8vZL1afkt9x4l2TV012lkhURZBfg+uUPpweDptUiS2UmXEaUiAN5szN/xOzG 5CkWOVUVhXu1Im45wnGgD5exGLa4Wvc7sNVfnvFt464xl6iaYkhiYMhgVU7ngKiAIlYQg iK+KkiDFZQVF162v8SdYkueLbX0PNbVx/z10CvU4RThAJF956nSh/XlK/My3/+R5V+w== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=aqi5nWlW; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 978AC606A322; Fri, 4 Dec 2026 19:59:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=aqi5nWlW Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1796414372; b=OJ32fo7at482CFMhq0sKEB2wIW899pryziAr7e8q1z0oOMlYhhDkMYemCwGHANcErg3r NQe63wQgYZ6CeDidSlrAkjBsUU5JHhOcpKU1xSztJ8u8epp6CaWXZTdDBvZTZQ2TbYFC7 YuCfhXqUNc0rmMStXUu5jdC4S+1h/YEBVAn3vK4eQtSfeZNm3BJj1xFwvzSS3HLOcvU+p sMxrU6tEbISqlHJsJ+jKZB5sULI7g0TY3Au7pAqTVuE/jlhSAqvpL+ttixtCJ5wgyUJB6 /l55Dip6fvrax4QNV8fuSqyet57qAD3L5HJFazn7H4XTmLG8KqSjGAlas7oGDT4V93g== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796414372; h=DKIM-Signature:Received:From:Date:Subject:MIME-Version:Content-Type: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To:Content-Transfer-Encoding; bh=lx+ym9U/E5fZ/LBf8QfXAx+PbT58/VohpOIhVt+t6Ic=; b=etQVlGDOvgvZWYf/uAs89d0aPfnKlFZkOMw+xCZjvukaC/5027D1MqHlhNSNSzq/jSPJ gKPt771qbBdIe5B2cFNxy1TvnlHyHJ9W9xntApnA9lbz375fGPVYHtQFWc2xlMkUXn9Ed mSVnd5lmupz+FfAsDNdjqs3+GJfXW2lZ8W4uzSv6FlhsYse556UpVDYV4FKsznGK5Pebh fW5O4q9/6OAspPSwBi+Z/oBivoEzJOw59REIJzAHilDpIL7rUJEHUC0e35+5GzVTWcgn4 BufxEZq8fbZT8knnKelpYUKAOGrSia2pXZAfxzn/1cyCRMXoEMB6XBa4Xzwx60nHFQA== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id BFF5B1F0093B; Fri, 4 Dec 2026 19:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796414372; bh=lx+ym9U/E5fZ/LBf8QfXAx+PbT58/VohpOIhVt+t6Ic=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=aqi5nWlWraEdEvJxSrkm9OUPVIAKb+KdiHW9OJsTBAWZzGl5rIbCk2kLCdmtcH89D vLbWEtk27IXEBcMyiZHQFnYwfw0vEm0jqH7eUOJoGGv8LttMjC1MpfC67f5YCbPlh/ 0qm68NIEKIc13SZtnuERbAecWz4Tp1q/IpPFztdlHF4kDtS0++Rbx6HPFndShcdbGi Pxh4oIm2dkO5AHTQBxxZlfbY3J/bAvQxe/+pyze0gDx8LcuWxYT0+NFkQ3hhpyQCLt oqQI7ql0R4s5WeQLX+Sr3RX6FBYGmlQfiM1nN+C5lrR4bzRCRuRkbCil1SatGoAoH+ d+9PiZAwBiIcw== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id 47C3A50007; Fri, 4 Dec 2026 19:59:31 +0000 (UTC) From: Fil Dunsky via B4 Relay Date: Fri, 04 Dec 2026 22:59:30 +0300 Subject: [PATCH v7 1/3] irqdomain: Pass temporary data to initialization callbacks X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Message-Id: <20261204-cs75xx-intc-v7-1-c5e6e23a1a8c@gmail.com> References: <20261204-cs75xx-intc-v7-0-c5e6e23a1a8c@gmail.com> In-Reply-To: <20261204-cs75xx-intc-v7-0-c5e6e23a1a8c@gmail.com> To: Thomas Gleixner , Radu Rendec , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Fil Dunsky X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796414369; l=3272; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=lmP6mNjT5a7f7ChsIyWDWiSxPGiMYH79FT6ViiBi3L8=; b=9Q7KFc3ckEvnomXAhwk3AuJxLiFnHmQii0D5LZOJs//WNDKy5yWMXH9JvDrZaq3UPpeH3e0yu exXjxoZIROUCcAN5wmqo8ExRj4rAlUI9syZdYL8fTjqycXK7p15kklu X-Developer-Key: i=filipp.dunsky@gmail.com; a=ed25519; pk=JAYP8e2rJ54DHOmhNtXud8rl1igAaAXoOHxtJmVXI1g= X-Endpoint-Received: by B4 Relay for filipp.dunsky@gmail.com/20260930 with auth_id=1085 X-Original-From: Fil Dunsky Reply-To: filipp.dunsky@gmail.com Content-Transfer-Encoding: 7bit From: Fil Dunsky 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 Link: https://lore.kernel.org/r/87zeuoogwp.ffs@fw13 Signed-off-by: Fil Dunsky --- 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