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=1796500782; b=VBnnod/QhWD3lARFUJvQ/siTwFugYFRvsDGFR/02ej9pVsbNDT9uVasAKn5j1izdOiVS 1+K3pGJAtgCc9V5RBeac4K6ZiAtHUSr7RGaQAiY0ZB5Zyqo7OcTUN8YVsqZGkoUdvYipt hspdJxnjU2mmoqWpRb9h93o2bnHXXQYL4RVt5N4lIJbF1PC/fM9MpJaFPEoaO16mgRg6n r1uCzc0YG2u8f1QvOv+7uuV3ySZqpgLKg0U4AWMLpMOULHctTNYPtm14/giB2X2EocF6r ucd3d8M0xUZRH0ZOSMt9Ukn5XBza275ZZDEVqkLiX20WVzhnGb7ELtqVLUzrBYQ0mUA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796500782; 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=YE1BEQPEQodSsYe2nSISJEkj/NlPqeyony43re3uvCT+HCe1Tt6OVYIVlFkowEGrmkwO qEtkEe2wqaQIp4aGexp2raAwDBhLYkFEbk/ZXI19POoGJ38vCVc6LfBlaOIxT39LOYG43 GlvZAgI0/RZ4XO6Jr4iS8buSPPkflbl67hvQPGUrpWTy2oXGotnDqBUDwMB8pHZIN3BgW /OMdCgCyzZ24ZZAaILYRO2CABcbT9XYDSeGv6r8bxF2nSVqumkAmQbByvVqZ+HBIli1JM fJ5QSFxfGqaKBNjLCgtLJD0MGM85cZYBKx3z7zj/8RLycvHbQkPNZCKpg58CVLVv8Fw== 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=HOZrp9P5; 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 1ADC0606A31F; Sat, 5 Dec 2026 19:59:41 +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=HOZrp9P5 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=1796500781; b=M3rAerBvPMP2rLaOYucBOwzfg0GyH8DbeDdF4hOhTlSLObYmuscXzMLx0cMekbTjwgM8 3iLYdOUh0sunP3pncSPCKfUoBqniudNS1K61YT/Erfs95c/wxeuHfi+IMc/3HpWN3e9hR fmxbQG+hj7vzVElXZn+9gpeG4jRe4JgXk5sXD9856AVyrUPF1guPYFjp6zDWnCi9Xz3P6 Gzgv0M1Ydl6arlvIGz+UHonWX82gyPbD80SBMfbLGOZ5ua0BlVngfDpUSbqYcCPUaLinM r6KEIllYQjrclWBIAJCLVtXYR+wu/HHtGU6WfNhv368T0z7fCmE+1lhgPtIlC1wqBMw== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796500781; 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=yhKUyOKqmWRT6nJJWokVmwgfzylnIm0XJfLbmoGpndkDy/s68OBULS7DyUk87q6Xo77R GzsJKF/huPcWL6KcEDZSe9MY+wCpkJZHdrkRVW6BF12BZy0VuPlf6XbdaXnvvvQ80gqdT 5eoEyT8eUBIoiAhwz4CjzXtvvj2maacCIPSNn1ODeeS2NaYP/azWk+B7RHpa6OEffSCi0 QA5eFwoWuie9XRLNOagVm1MeEjU2XPCpcENplPk6b2bkOWrydHBHqUp4RtJR+F5jjGg3h sRejwUESU3Sw7oXchXGjTESy8++B1vIu39BI1igqXRI62Gft4e0CIAYon5toZdsAfsg== 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 281531F00936; Sat, 5 Dec 2026 19:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796500781; bh=lx+ym9U/E5fZ/LBf8QfXAx+PbT58/VohpOIhVt+t6Ic=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To; b=HOZrp9P5xLtFPH2UvO9zqde/trzWdx+67+UgyeCiM/3G2j0xQVb6BoOGWbh9wjjuq DMzS5PJPJEUPcsdGvyngV6Hxf4WlXVQK4arDBTKZ9U36LmJX1lhnVzlr0AsERJE9Xj lW5h2h3fNuiECYDIWVjVsPjIaynChBWpuRyTjs38Myb/vO9xae3KELnQrHBAKDy4Tn rJzstDZnlwi+TZKlD8o/iYVeyhEfor6emD8wVz//vj4CAACJTC/zNMImdHg94gVjng Nd9QkzX+cnrub7EncMbOUQMFmwHWg5eJ7lt+8XcZ+PL5IQsV219a0JqIkdOKehvnLo 2lAv8DYt0gg3g== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id A8FC55047C; Sat, 5 Dec 2026 19:59:40 +0000 (UTC) From: Fil Dunsky via B4 Relay Date: Sat, 05 Dec 2026 22:59:40 +0300 Subject: [PATCH v8 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: <20261205-cs75xx-intc-v8-1-a8159d212d38@gmail.com> References: <20261205-cs75xx-intc-v8-0-a8159d212d38@gmail.com> In-Reply-To: <20261205-cs75xx-intc-v8-0-a8159d212d38@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.16.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796500779; l=3272; i=filipp.dunsky@gmail.com; s=20260930; h=from:subject:message-id; bh=lmP6mNjT5a7f7ChsIyWDWiSxPGiMYH79FT6ViiBi3L8=; b=ZdY1FLEvKBxwCjIUeCOGyhOkKQyQyolzvg1CKXBYT6SsaO0GFepAYvoTrQ67gy5iDv04ojQ/6 6uLMxmnkOdOCEzsKPdQqHVlPb6BA48nBmDA0Y3RvlP1R7hKzHjeqE99 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