From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.95 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796290169; b=gn+dyO9qjVVWxviMYh9tunJOf5TISj8aDn5gNN+3ZILdIpu1EWJPHZDOCSt3yXkLVHMl VVpqPMFbbofyLPeDByDdyCFCgxUA8WspH3aNOOjmMGaK+6o6rwdGgeQHHpo/CuAiSloTw +5fCeMtltSTTuVz0BX3Xgc1ExfZqM6nvmt5Q7ijJeAX9IeblZxKNf2cc6IC93o9CUiVas imucZ6s42aWBEHxdvnmJhHkrnet1UXPUfWVxKX+K17JiHRWixHv0+IpXOwbTMMVjsLzI9 iVuorG+DvKlS2R3gyl0MBKhEWa1q8Wb3keQL8/D0DOjmt2WrAQvpS2dANU53clUzpRA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796290169; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:From:Subject:Date:Message-Id: MIME-Version:Content-Type:Content-Transfer-Encoding:X-B4-Tracking: X-Change-ID:To:Cc:X-Mailer; bh=nWLO19W/NEvYGfdxOaQCa0XxLJYHcuJsthbqUL82gU0=; b=1cq1JpGG6OFb+hufqGqMXbA993Ji6D7aC3FRgPiShRDiBY91YCI3InOp4XqHkR6WnTxe VYSeusozqJbv4lQYUfl+Gf7m8gMel6AWB22Eqq0xCrtN4b1gd8pD6TTKxOvcMCZkQ9knN YF3KGRB2zEkb8PdNyhP1V/rccF3Aqdu6zFdOHNQ+0ZJETzAaVRTqOt3QlvUdhTEfVTMbh UmCD6UwgvJQdZh6P5If5osXYYJFs9/tpW6n8eO9K7PvaeQ3/51srSF6DwQdZ+xEX8/mnL N0C/xOm5o35fLa7XgTJyR98wGy1+nBvk7jJ8KlkdXhKAMK4u6BH1qH7lW4COYmdejTA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=T4arspZy; arc=none smtp.remote-ip=95.215.58.95 Received: from mta1.migadu.com (out-95.mta1.migadu.com [95.215.58.95]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B719606A330 for ; Thu, 3 Dec 2026 09:29:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3B719606A330 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=T4arspZy X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=JyvL6zE5F+kklFl262uKIlbt15D4qu1dTY/HpaZnJDQ=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796290167; v=1; x=1796894967; b=T4arspZy08PaYjQiUqKYlwXRW7E3wzIcmb46ZS1pBxO7ylmuvjJiWNqrU3zVd9STlcZTZaP8 am0H5sIzjjeI4RDSyWNYzKKaBrYFQu/CUbx+4BhlmJ5DLLWnZmBHc3zvcSiWdhncnNm/z5nEYhy VmHqxeIEFfffECdUNcuB0Mfc= X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id 524e2aa83307b013; Thu, 03 Dec 2026 09:29:27 +0000 X-Mizu-Trace-ID: 524e2aa83307b013 X-Migadu-Flow: FLOW_OUT From: Peng Fan Subject: [PATCH v2 0/8] irqchip/imx-intmux: Fix and modernize resource management Date: Thu, 03 Dec 2026 17:29:12 +0800 Message-Id: <20261203-imx-intmux-v2-0-a6db1eed3b5f@nxp.com> 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" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/03MQQrDIBCF4auEWdeiLqLpqvcoWUSdNrPQBE3EE rx7baDQ5f/gfQckjIQJbt0BETMlWkILeenAzlN4ISPXGiSXvRCiZ+QLo7D5vTBl0DhrtJXcQDu sEZ9UTuwxtp4pbUt8n3YW3/XHqH8mC8aZ0AMq5JMbtLuHsl7t4mGstX4AoB7kpqIAAAA= X-Change-ID: 20261116-imx-intmux-7bebdcb8c20b To: Thomas Gleixner , Radu Rendec , Frank Li , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , Shengjiu Wang , Marc Zyngier Cc: linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Peng Fan X-Mailer: b4 0.14.3 When I worked on guard_chained_irq patch, sashiko reported pre-exist issues in imx-intmux driver. So I gave a look on this driver and found more that need to be addressed. Even there are a few fixes, but I think they are not critial for current release cycle. The first patch avoids creating parent IRQ mappings while counting channels. It counts the entries with of_irq_count() and resolves each parent lazily with of_irq_get() in the channel loop, preserving -EPROBE_DEFER. The next two patches fix the removal and probe error paths. Both mask the parent interrupt, wait for an in-flight chained handler, detach it, dispose the child mappings, and release the parent mapping. The probe error path also unwinds the initialized channels, tears down runtime PM, and enables the clock before touching runtime PM so that a clock failure cannot leave the usage counter unbalanced; a pm_runtime_set_active() failure is propagated after unwinding. The next three patches tighten the device-tree input handling: reject a zero channel count, return -EINVAL instead of WARNing on malformed interrupt specifiers (including source numbers beyond the 32 inputs), and mark the multiplexed interrupts as level-triggered to match handle_level_irq() and the type advertised by xlate(). The last two patches are cleanups with no functional change: use devm_irq_domain_create_linear() for the per-channel domains and factor the per-channel teardown into a helper shared by the probe error and remove paths. The teardown assumes the default fw_devlink=on/rpm behaviour, where managed device links unbind consumers before the interrupt controller so that consumers release their IRQ actions first. With fw_devlink=off or permissive, an active consumer can keep its IRQ actions and threads while child mappings are disposed, and a concurrently probing consumer can race with the deferred domain removal; those configurations are not supported by this series. Signed-off-by: Peng Fan --- Changes in v2: - Add a patch to avoid creating parent IRQ mappings while counting channels, using of_irq_count() and lazy of_irq_get(). - Rework the zero channel count check for of_irq_count(). - Drain in-flight chained handlers before detaching them in the remove and probe error paths. - Check pm_runtime_set_active() and enable the clock before runtime PM. - Reject malformed interrupt specifiers in xlate instead of WARNing. - Correct the devm IRQ domain lifetime description in the commit message. - Document that the teardown relies on fw_devlink=on/rpm consumer ordering. - Link to v1: https://lore.kernel.org/r/20261117-imx-intmux-v1-0-189e7e0ad98d@nxp.com --- Peng Fan (8): irqchip/imx-intmux: Don't create parent mappings while counting channels irqchip/imx-intmux: Dispose IRQ mappings on remove irqchip/imx-intmux: Fix probe error path irqchip/imx-intmux: Reject zero channel count irqchip/imx-intmux: Mark input interrupts as level-triggered irqchip/imx-intmux: Don't WARN on malformed interrupt specifiers irqchip/imx-intmux: Use devm_irq_domain_create_linear() irqchip/imx-intmux: Factor out imx_intmux_teardown_channel() drivers/irqchip/irq-imx-intmux.c | 70 ++++++++++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 21 deletions(-) --- base-commit: 799dd936553182df5770dde7f38d94c8337df75a change-id: 20261116-imx-intmux-7bebdcb8c20b Best regards, -- Peng Fan