Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796290367; b=qiOb/UOs4Wk5nESEOvVIuVl6b8WjqtF48sbxvWK0h8VjV80e+J3nELQ22qqR/GaF4HWl Gof7TB+v7rf4dBYTTebaaigF40yCeH1kLM0HNH1uUKtv7UQ+vWHb95z9t0iLAzeoyuutu lryatNxO+EitcVoETWLvmU8VAsbbb1Po8jKHqaN5NckeNHspf+GA/w9qS4LujnZM52n0O /Icl4FEYq/iHXx1jLQzCedY8Kq0v4JrwASG9obA9Mnf8wjkgn4PwdBwFoMZjVhH4D00/J zIBT3pXsZdza4fFu9EPiTDx3gMCwJoHUqnJPV74+yGMwTF0jds1b81Zc3HY3Xc+Y2CA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796290367; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=O1oPO99coDaCSkYoABHKKReCN/R3WI+QrRtvTXzJxqM=; b=TsOjh1biyHNrl5fHuZYQCUxbyyzH9XlQ++Az/Xq0A5dQQplZWm2Jh9G4a9etkBHgok3f KBxxUDOAVMu3bKpr0GbLxMvTTIvuOehiR3gNqiZsbY+YOb3YaHddR9gexfIlmfVCWWIT8 tju7NC/cLWNwIjmznz9+G5qm/C0J7kxXh00ZmJvzCDZIO66S4Q7qt2hFzEe3nY3ZSVvd7 ouwgNPVQplhR2Hgbzb+mAvB94mm1vSiCfKDG48bWOZZu3OmBkXS61W5/h300SS3vQRi12 VwU9ZPZkrfFq0OWevDRRy1ZTL/3bqwjYksuWKMnOYndGbiRLtztnl7LmcL3Va/8T/0g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=aMjgc0Ts; arc=none 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 81793606A32D; Thu, 3 Dec 2026 09:32:47 +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=aMjgc0Ts Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60D571F00898; Thu, 3 Dec 2026 09:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796290367; bh=O1oPO99coDaCSkYoABHKKReCN/R3WI+QrRtvTXzJxqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=aMjgc0TsWQJWvZKEOhFxSO1TF+Db0ecLrpCgoxSuzrGBEJWk2dXmTQuRn/FJYfmYx xaw51kIM6Ywle3IjgU2cO5sccozIDHvzIMdE7OPzRRmCqV3uNQ+JzBCnoEtCurrpux JQk7WvXMVTzXUjQFRhEL1CS0qtduPxrZY7/y55q6A80rgB7q0iyGqQ06Zs9NE0iaMh S2ShAxVMOhELYDcC/sFAJXarwddJaaLRyIQg3eMJm5da6+aBFLh8cxfilAD1IQ4ykv 1TRbgieaJh409hNgy8BGQInCj1XfA7g61SEto/t70QTgC+DXDvObg6u4jgEk9INMFj IvLtmd0r+hsig== From: Claudiu Beznea To: lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org, bhelgaas@google.com, p.zabel@pengutronix.de Cc: claudiu.beznea@tuxon.dev, linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Claudiu Beznea , stable@vger.kernel.org, Wolfram Sang Subject: [PATCH 4/6] PCI: rzg3s-host: Initialize the IRQ domains after the IRQs are masked Date: Thu, 3 Dec 2026 11:32:22 +0200 Message-ID: <20261203093224.247349-5-claudiu.beznea@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261203093224.247349-1-claudiu.beznea@kernel.org> References: <20261203093224.247349-1-claudiu.beznea@kernel.org> X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Claudiu Beznea The IRQ domain initialization requests the interrupts and installs the chained handlers before rzg3s_pcie_irq_init() masks the controller interrupt sources. An interrupt left enabled (e.g. by the bootloader, or latched from a previous controller state) could therefore fire before the controller initialization is complete and be handled on half-initialized state. Move the IRQ domain initialization after rzg3s_pcie_irq_init(), so that all the interrupt sources are masked by the time the handlers are installed. Fixes: 7ef502fb35b2 ("PCI: Add Renesas RZ/G3S host controller driver") Cc: stable@vger.kernel.org Tested-by: Wolfram Sang Signed-off-by: Claudiu Beznea --- Changes since [1]: - collected tags [1] https://lore.kernel.org/all/20261019065025.2146539-1-claudiu.beznea@kernel.org drivers/pci/controller/pcie-rzg3s-host.c | 31 ++++++++++++------------ 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c index 201888f1f525..cbe25615eb96 100644 --- a/drivers/pci/controller/pcie-rzg3s-host.c +++ b/drivers/pci/controller/pcie-rzg3s-host.c @@ -1414,7 +1414,10 @@ static int rzg3s_pcie_host_init_port(struct rzg3s_pcie_host *host) return ret; } -static int rzg3s_pcie_host_init(struct rzg3s_pcie_host *host) +static int +rzg3s_pcie_host_init(struct rzg3s_pcie_host *host, + int (*init_irqdomain)(struct rzg3s_pcie_host *host), + void (*teardown_irqdomain)(struct rzg3s_pcie_host *host)) { u32 val; int ret; @@ -1441,10 +1444,14 @@ static int rzg3s_pcie_host_init(struct rzg3s_pcie_host *host) /* Initialize the interrupts */ rzg3s_pcie_irq_init(host); + ret = init_irqdomain(host); + if (ret) + goto config_deinit_and_refclk; + /* SoC-specific post-configuration */ ret = host->data->config_post_init(host); if (ret) - goto config_deinit_and_refclk; + goto teardown_irqdomain; /* Wait for link up */ ret = readl_poll_timeout(host->axi + RZG3S_PCI_PCSTAT1, val, @@ -1462,6 +1469,8 @@ static int rzg3s_pcie_host_init(struct rzg3s_pcie_host *host) config_deinit_post: host->data->config_deinit(host); +teardown_irqdomain: + teardown_irqdomain(host); config_deinit_and_refclk: clk_disable_unprepare(host->port.refclk); config_deinit: @@ -1717,15 +1726,10 @@ rzg3s_pcie_host_setup(struct rzg3s_pcie_host *host, return dev_err_probe(dev, ret, "Failed to set outbound windows!\n"); - ret = init_irqdomain(host); + ret = rzg3s_pcie_host_init(host, init_irqdomain, teardown_irqdomain); if (ret) - return dev_err_probe(dev, ret, "Failed to init IRQ domain\n"); - - ret = rzg3s_pcie_host_init(host); - if (ret) { - dev_err_probe(dev, ret, "Failed to initialize the HW!\n"); - goto teardown_irqdomain; - } + return dev_err_probe(dev, ret, + "Failed to initialize the HW!\n"); ret = rzg3s_pcie_set_max_link_speed(host); if (ret) @@ -1734,11 +1738,6 @@ rzg3s_pcie_host_setup(struct rzg3s_pcie_host *host, pci_host_common_link_train_delay(host->max_link_speed); return 0; - -teardown_irqdomain: - teardown_irqdomain(host); - - return ret; } static int rzg3s_pcie_get_controller_id(struct rzg3s_pcie_host *host) @@ -1913,8 +1912,8 @@ static int rzg3s_pcie_probe(struct platform_device *pdev) return 0; host_probe_teardown: - clk_disable_unprepare(host->port.refclk); rzg3s_pcie_teardown_irqdomain(host); + clk_disable_unprepare(host->port.refclk); host->data->config_deinit(host); power_resets_assert: reset_control_bulk_assert(host->data->num_power_resets, -- 2.43.0