Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH v7 01/14] PCI: rzg3s-host: Follow hardware manual clock/reset initialization order
       [not found] <20261019065025.2146539-1-claudiu.beznea@kernel.org>
@ 2026-10-19  6:50 ` Claudiu Beznea
  2026-10-19  6:50 ` [PATCH v7 02/14] PCI: rzg3s-host: Fix runtime PM handling in the NOIRQ suspend/resume phase Claudiu Beznea
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 14+ messages in thread
From: Claudiu Beznea @ 2026-10-19  6:50 UTC (permalink / raw)
  To: lpieralisi, kwilczynski, mani, robh, bhelgaas, p.zabel,
	geert+renesas, magnus.damm
  Cc: claudiu.beznea, linux-pci, linux-kernel, linux-renesas-soc,
	Claudiu Beznea, stable, Lad Prabhakar

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

The RZ/G3S PCIe hardware manual specifies that the clocks must be enabled
before the reset signals are deasserted during initialization.

Follow this sequence in the probe(), suspend(), and resume() paths to
match the hardware requirements and avoid potential issues.

Fixes: 7ef502fb35b2 ("PCI: Add Renesas RZ/G3S host controller driver")
Cc: stable@vger.kernel.org
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---

Changes in v7:
- none

Changes in v6:
- none

Changes in v5:
- collected tags

Changes in v4:
- none

Changes in v3:
- none, this patch is new

 drivers/pci/controller/pcie-rzg3s-host.c | 40 +++++++++++++-----------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c
index 077cfb0834b3..e1105b1f2652 100644
--- a/drivers/pci/controller/pcie-rzg3s-host.c
+++ b/drivers/pci/controller/pcie-rzg3s-host.c
@@ -1888,10 +1888,6 @@ static int rzg3s_pcie_probe(struct platform_device *pdev)
 	if (ret)
 		goto sysc_signal_restore;
 
-	ret = rzg3s_pcie_power_resets_deassert(host);
-	if (ret)
-		goto sysc_signal_restore;
-
 	pm_runtime_enable(dev);
 
 	/*
@@ -1902,12 +1898,16 @@ static int rzg3s_pcie_probe(struct platform_device *pdev)
 	if (ret)
 		goto rpm_disable;
 
+	ret = rzg3s_pcie_power_resets_deassert(host);
+	if (ret)
+		goto rpm_put;
+
 	raw_spin_lock_init(&host->hw_lock);
 
 	ret = rzg3s_pcie_host_setup(host, rzg3s_pcie_init_irqdomain,
 				    rzg3s_pcie_teardown_irqdomain);
 	if (ret)
-		goto rpm_put;
+		goto power_resets_assert;
 
 	bridge->sysdata = host;
 	bridge->ops = &rzg3s_pcie_root_ops;
@@ -1922,12 +1922,13 @@ static int rzg3s_pcie_probe(struct platform_device *pdev)
 	clk_disable_unprepare(host->port.refclk);
 	rzg3s_pcie_teardown_irqdomain(host);
 	host->data->config_deinit(host);
+power_resets_assert:
+	reset_control_bulk_assert(host->data->num_power_resets,
+				  host->power_resets);
 rpm_put:
 	pm_runtime_put_sync(dev);
 rpm_disable:
 	pm_runtime_disable(dev);
-	reset_control_bulk_assert(host->data->num_power_resets,
-				  host->power_resets);
 sysc_signal_restore:
 	/*
 	 * SYSC RST_RSM_B signal need to be asserted before turning off the
@@ -1948,10 +1949,6 @@ static int rzg3s_pcie_suspend_noirq(struct device *dev)
 	struct rzg3s_sysc *sysc = host->sysc;
 	int ret;
 
-	ret = pm_runtime_put_sync(dev);
-	if (ret)
-		return ret;
-
 	clk_disable_unprepare(port->refclk);
 
 	/* SoC-specific de-initialization */
@@ -1964,13 +1961,19 @@ static int rzg3s_pcie_suspend_noirq(struct device *dev)
 	if (ret)
 		goto config_reinit;
 
-	ret = rzg3s_sysc_config_func(sysc, RZG3S_SYSC_FUNC_ID_RST_RSM_B, 0);
+	ret = pm_runtime_put_sync(dev);
 	if (ret)
 		goto power_resets_restore;
 
+	ret = rzg3s_sysc_config_func(sysc, RZG3S_SYSC_FUNC_ID_RST_RSM_B, 0);
+	if (ret)
+		goto rpm_resume;
+
 	return 0;
 
 	/* Restore the previous state if any error happens */
+rpm_resume:
+	pm_runtime_resume_and_get(dev);
 power_resets_restore:
 	reset_control_bulk_deassert(data->num_power_resets,
 				    host->power_resets);
@@ -1980,7 +1983,6 @@ static int rzg3s_pcie_suspend_noirq(struct device *dev)
 	data->config_post_init(host);
 refclk_restore:
 	clk_prepare_enable(port->refclk);
-	pm_runtime_resume_and_get(dev);
 	return ret;
 }
 
@@ -2009,18 +2011,18 @@ static int rzg3s_pcie_resume_noirq(struct device *dev)
 			goto assert_rst_rsm_b;
 	}
 
-	ret = rzg3s_pcie_power_resets_deassert(host);
+	ret = pm_runtime_resume_and_get(dev);
 	if (ret)
 		goto assert_rst_rsm_b;
 
-	ret = pm_runtime_resume_and_get(dev);
+	ret = rzg3s_pcie_power_resets_deassert(host);
 	if (ret)
-		goto assert_power_resets;
+		goto rpm_put;
 
 	ret = rzg3s_pcie_host_setup(host, rzg3s_pcie_msi_hw_setup,
 				    rzg3s_pcie_msi_hw_teardown);
 	if (ret)
-		goto rpm_put;
+		goto assert_power_resets;
 
 	return 0;
 
@@ -2028,11 +2030,11 @@ static int rzg3s_pcie_resume_noirq(struct device *dev)
 	 * If any error happens there is no way to recover the IP. Put it in the
 	 * lowest possible power state.
 	 */
-rpm_put:
-	pm_runtime_put_sync(dev);
 assert_power_resets:
 	reset_control_bulk_assert(data->num_power_resets,
 				  host->power_resets);
+rpm_put:
+	pm_runtime_put_sync(dev);
 assert_rst_rsm_b:
 	rzg3s_sysc_config_func(sysc, RZG3S_SYSC_FUNC_ID_RST_RSM_B, 0);
 	return ret;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v7 02/14] PCI: rzg3s-host: Fix runtime PM handling in the NOIRQ suspend/resume phase
       [not found] <20261019065025.2146539-1-claudiu.beznea@kernel.org>
  2026-10-19  6:50 ` [PATCH v7 01/14] PCI: rzg3s-host: Follow hardware manual clock/reset initialization order Claudiu Beznea
@ 2026-10-19  6:50 ` Claudiu Beznea
  2026-11-25 16:39   ` Manivannan Sadhasivam
  2026-10-19  6:50 ` [PATCH v7 03/14] PCI: rzg3s-host: Don't mix goto-based unwinding and cleanup helpers Claudiu Beznea
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Claudiu Beznea @ 2026-10-19  6:50 UTC (permalink / raw)
  To: lpieralisi, kwilczynski, mani, robh, bhelgaas, p.zabel,
	geert+renesas, magnus.damm
  Cc: claudiu.beznea, linux-pci, linux-kernel, linux-renesas-soc,
	Claudiu Beznea, stable, Lad Prabhakar

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

The runtime PM documentation states the following:
- During system suspend, pm_runtime_get_noresume() is called for every
  device right before executing the subsystem-level .prepare() callback
  (in device_prepare()). In addition, the PM core disables runtime PM for
  every device right before executing the subsystem-level .suspend_late()
  callback (in device_suspend_late()).
- During system resume, pm_runtime_enable() is called for every device
  right after executing the subsystem-level .resume_early() callback (in
  device_resume_early()), and pm_runtime_put() is called right after
  executing the subsystem-level .complete() callback (in
  device_complete()).

The driver's .suspend_noirq() callback is invoked after .suspend_late(),
while .resume_noirq() is invoked before .resume_early().

If:
- the device is not part of the wake-up path, and
- its runtime PM status is not RPM_SUSPENDED,
the generic power domain .suspend_noirq()/.resume_noirq() callbacks
(genpd_suspend_noirq()/genpd_resume_noirq()) invoke the driver's
.suspend_noirq()/.resume_noirq() callbacks and call
genpd_stop_dev()/genpd_start_dev() before and after them, respectively.

Calling genpd_stop_dev()/genpd_start_dev() allows devices whose power is
controlled by generic power domains to be powered off and on during
system suspend and resume, even though their runtime PM usage count does
not reach zero.

Since the runtime PM usage count is incremented in device_prepare() and
decremented in device_complete(), runtime PM operations performed from
the driver's .suspend_noirq()/.resume_noirq() callbacks are no-ops. The
actual power transitions are handled by the generic power domain
.suspend_noirq()/.resume_noirq() callbacks.

Moreover, attempting to runtime resume a device while runtime PM is
disabled may return -EACCES. This may cause system resume to fail when
resuming after a failed Root Port reset, as described in a subsequent
patch adding hot-plug support.

Remove the runtime PM calls from the driver's
.suspend_noirq()/.resume_noirq() callbacks and rely on the generic power
domain callbacks to power the device off and on.

Fixes: 7ef502fb35b2 ("PCI: Add Renesas RZ/G3S host controller driver")
Cc: stable@vger.kernel.org
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Tested-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---

Changes in v7:
- none

Changes in v6:
- none

Changes in v5:
- collected tags

Changes in v4:
- simplified the comments in rzg3s_pcie_suspend_noirq()/rzg3s_pcie_resume_noirq()

Changes in v3:
- none, this patch is new

 drivers/pci/controller/pcie-rzg3s-host.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c
index e1105b1f2652..0ef49bb5ab1a 100644
--- a/drivers/pci/controller/pcie-rzg3s-host.c
+++ b/drivers/pci/controller/pcie-rzg3s-host.c
@@ -1961,19 +1961,18 @@ static int rzg3s_pcie_suspend_noirq(struct device *dev)
 	if (ret)
 		goto config_reinit;
 
-	ret = pm_runtime_put_sync(dev);
-	if (ret)
-		goto power_resets_restore;
+	/*
+	 * Since the power domain's genpd_suspend_noirq() will disable clocks,
+	 * there is no need to manually invoke runtime PM API here.
+	 */
 
 	ret = rzg3s_sysc_config_func(sysc, RZG3S_SYSC_FUNC_ID_RST_RSM_B, 0);
 	if (ret)
-		goto rpm_resume;
+		goto power_resets_restore;
 
 	return 0;
 
 	/* Restore the previous state if any error happens */
-rpm_resume:
-	pm_runtime_resume_and_get(dev);
 power_resets_restore:
 	reset_control_bulk_deassert(data->num_power_resets,
 				    host->power_resets);
@@ -2011,13 +2010,14 @@ static int rzg3s_pcie_resume_noirq(struct device *dev)
 			goto assert_rst_rsm_b;
 	}
 
-	ret = pm_runtime_resume_and_get(dev);
-	if (ret)
-		goto assert_rst_rsm_b;
+	/*
+	 * Since the power domain's genpd_resume_noirq() will enable clocks,
+	 * there is no need to manually invoke runtime PM API here.
+	 */
 
 	ret = rzg3s_pcie_power_resets_deassert(host);
 	if (ret)
-		goto rpm_put;
+		goto assert_rst_rsm_b;
 
 	ret = rzg3s_pcie_host_setup(host, rzg3s_pcie_msi_hw_setup,
 				    rzg3s_pcie_msi_hw_teardown);
@@ -2033,8 +2033,6 @@ static int rzg3s_pcie_resume_noirq(struct device *dev)
 assert_power_resets:
 	reset_control_bulk_assert(data->num_power_resets,
 				  host->power_resets);
-rpm_put:
-	pm_runtime_put_sync(dev);
 assert_rst_rsm_b:
 	rzg3s_sysc_config_func(sysc, RZG3S_SYSC_FUNC_ID_RST_RSM_B, 0);
 	return ret;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v7 03/14] PCI: rzg3s-host: Don't mix goto-based unwinding and cleanup helpers
       [not found] <20261019065025.2146539-1-claudiu.beznea@kernel.org>
  2026-10-19  6:50 ` [PATCH v7 01/14] PCI: rzg3s-host: Follow hardware manual clock/reset initialization order Claudiu Beznea
  2026-10-19  6:50 ` [PATCH v7 02/14] PCI: rzg3s-host: Fix runtime PM handling in the NOIRQ suspend/resume phase Claudiu Beznea
@ 2026-10-19  6:50 ` Claudiu Beznea
  2026-11-25 16:40   ` Manivannan Sadhasivam
  2026-10-19  6:50 ` [PATCH v7 04/14] PCI: rzg3s-host: Create the INTx IRQ domain before setting the chained handlers Claudiu Beznea
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Claudiu Beznea @ 2026-10-19  6:50 UTC (permalink / raw)
  To: lpieralisi, kwilczynski, mani, robh, bhelgaas, p.zabel,
	geert+renesas, magnus.damm
  Cc: claudiu.beznea, linux-pci, linux-kernel, linux-renesas-soc,
	Claudiu Beznea, stable

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

rzg3s_pcie_probe() releases the sysc_np OF node through the
__free(device_node) annotation, while the rest of the function uses
goto-based unwinding. According to cleanup.h, the two styles should
not be mixed within a function, as this makes the ownership semantics
hard to follow. Drop the annotation and call of_node_put() explicitly
on the exit paths instead.

Fixes: 7ef502fb35b2 ("PCI: Add Renesas RZ/G3S host controller driver")
Cc: stable@vger.kernel.org
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---

Changes in v7:
- none, this patch is new

 drivers/pci/controller/pcie-rzg3s-host.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c
index 0ef49bb5ab1a..bee3e46d025f 100644
--- a/drivers/pci/controller/pcie-rzg3s-host.c
+++ b/drivers/pci/controller/pcie-rzg3s-host.c
@@ -1822,9 +1822,8 @@ static int rzg3s_pcie_probe(struct platform_device *pdev)
 	struct pci_host_bridge *bridge;
 	struct device *dev = &pdev->dev;
 	struct device_node *np = dev->of_node;
-	struct device_node *sysc_np __free(device_node) =
-		of_parse_phandle(np, "renesas,sysc", 0);
 	struct rzg3s_pcie_host *host;
+	struct device_node *sysc_np;
 	struct rzg3s_sysc *sysc;
 	int ret;
 
@@ -1859,7 +1858,14 @@ static int rzg3s_pcie_probe(struct platform_device *pdev)
 	if (ret)
 		return ret;
 
+	sysc_np = of_parse_phandle(np, "renesas,sysc", 0);
+	if (!sysc_np) {
+		ret = -ENODEV;
+		goto port_refclk_put;
+	}
+
 	sysc->regmap = syscon_node_to_regmap(sysc_np);
+	of_node_put(sysc_np);
 	if (IS_ERR(sysc->regmap)) {
 		ret = PTR_ERR(sysc->regmap);
 		goto port_refclk_put;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v7 04/14] PCI: rzg3s-host: Create the INTx IRQ domain before setting the chained handlers
       [not found] <20261019065025.2146539-1-claudiu.beznea@kernel.org>
                   ` (2 preceding siblings ...)
  2026-10-19  6:50 ` [PATCH v7 03/14] PCI: rzg3s-host: Don't mix goto-based unwinding and cleanup helpers Claudiu Beznea
@ 2026-10-19  6:50 ` Claudiu Beznea
  2026-11-25 16:44   ` Manivannan Sadhasivam
  2026-10-19  6:50 ` [PATCH v7 05/14] PCI: rzg3s-host: Initialize the IRQ domains after the IRQs are masked Claudiu Beznea
  2026-10-19  6:50 ` [PATCH v7 06/14] PCI: rzg3s-host: Drop read-modify-write approach for the R/W1C registers Claudiu Beznea
  5 siblings, 1 reply; 14+ messages in thread
From: Claudiu Beznea @ 2026-10-19  6:50 UTC (permalink / raw)
  To: lpieralisi, kwilczynski, mani, robh, bhelgaas, p.zabel,
	geert+renesas, magnus.damm
  Cc: claudiu.beznea, linux-pci, linux-kernel, linux-renesas-soc,
	Claudiu Beznea, stable

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

rzg3s_pcie_init_irqdomain() installs the chained INTx handlers before
creating the INTx IRQ domain. irq_set_chained_handler_and_data() also
enables the interrupt, so an INTx interrupt arriving in between is
handled by rzg3s_pcie_intx_irq_handler() while host->intx_domain is
still NULL, leading to a NULL pointer dereference.

Move the IRQ domain creation before the loop that installs the chained
handlers.

Fixes: 7ef502fb35b2 ("PCI: Add Renesas RZ/G3S host controller driver")
Cc: stable@vger.kernel.org
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---

Changes in v7:
- none, this patch is new

 drivers/pci/controller/pcie-rzg3s-host.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c
index bee3e46d025f..cc985020d962 100644
--- a/drivers/pci/controller/pcie-rzg3s-host.c
+++ b/drivers/pci/controller/pcie-rzg3s-host.c
@@ -1024,6 +1024,16 @@ static int rzg3s_pcie_init_irqdomain(struct rzg3s_pcie_host *host)
 	struct platform_device *pdev = to_platform_device(dev);
 	int i, ret;
 
+	host->intx_domain = irq_domain_create_linear(dev_fwnode(dev),
+						     PCI_NUM_INTX,
+						     &rzg3s_pcie_intx_domain_ops,
+						     host);
+	if (!host->intx_domain) {
+		return dev_err_probe(dev, -EINVAL,
+				     "Failed to add irq domain for INTx IRQs\n");
+	}
+	irq_domain_update_bus_token(host->intx_domain, DOMAIN_BUS_WIRED);
+
 	for (i = 0; i < PCI_NUM_INTX; i++) {
 		char irq_name[5] = {0};
 		int irq;
@@ -1045,18 +1055,6 @@ static int rzg3s_pcie_init_irqdomain(struct rzg3s_pcie_host *host)
 						 host);
 	}
 
-	host->intx_domain = irq_domain_create_linear(dev_fwnode(dev),
-						     PCI_NUM_INTX,
-						     &rzg3s_pcie_intx_domain_ops,
-						     host);
-	if (!host->intx_domain) {
-		ret = -EINVAL;
-		dev_err_probe(dev, ret,
-			      "Failed to add irq domain for INTx IRQs\n");
-		goto teardown_intx;
-	}
-	irq_domain_update_bus_token(host->intx_domain, DOMAIN_BUS_WIRED);
-
 	if (IS_ENABLED(CONFIG_PCI_MSI)) {
 		ret = rzg3s_pcie_init_msi(host);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v7 05/14] PCI: rzg3s-host: Initialize the IRQ domains after the IRQs are masked
       [not found] <20261019065025.2146539-1-claudiu.beznea@kernel.org>
                   ` (3 preceding siblings ...)
  2026-10-19  6:50 ` [PATCH v7 04/14] PCI: rzg3s-host: Create the INTx IRQ domain before setting the chained handlers Claudiu Beznea
@ 2026-10-19  6:50 ` Claudiu Beznea
  2026-11-25 16:49   ` Manivannan Sadhasivam
  2026-10-19  6:50 ` [PATCH v7 06/14] PCI: rzg3s-host: Drop read-modify-write approach for the R/W1C registers Claudiu Beznea
  5 siblings, 1 reply; 14+ messages in thread
From: Claudiu Beznea @ 2026-10-19  6:50 UTC (permalink / raw)
  To: lpieralisi, kwilczynski, mani, robh, bhelgaas, p.zabel,
	geert+renesas, magnus.damm
  Cc: claudiu.beznea, linux-pci, linux-kernel, linux-renesas-soc,
	Claudiu Beznea, stable

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

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
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---

Changes in v7:
- none, this patch is new

 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 cc985020d962..94345d6f0bee 100644
--- a/drivers/pci/controller/pcie-rzg3s-host.c
+++ b/drivers/pci/controller/pcie-rzg3s-host.c
@@ -1418,7 +1418,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;
@@ -1445,10 +1448,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,
@@ -1466,6 +1473,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:
@@ -1721,15 +1730,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)
@@ -1738,11 +1742,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)
@@ -1923,8 +1922,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


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v7 06/14] PCI: rzg3s-host: Drop read-modify-write approach for the R/W1C registers
       [not found] <20261019065025.2146539-1-claudiu.beznea@kernel.org>
                   ` (4 preceding siblings ...)
  2026-10-19  6:50 ` [PATCH v7 05/14] PCI: rzg3s-host: Initialize the IRQ domains after the IRQs are masked Claudiu Beznea
@ 2026-10-19  6:50 ` Claudiu Beznea
  5 siblings, 0 replies; 14+ messages in thread
From: Claudiu Beznea @ 2026-10-19  6:50 UTC (permalink / raw)
  To: lpieralisi, kwilczynski, mani, robh, bhelgaas, p.zabel,
	geert+renesas, magnus.damm
  Cc: claudiu.beznea, linux-pci, linux-kernel, linux-renesas-soc,
	Claudiu Beznea, stable

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

The AXI registers PCI_PINTRCVIS and PCI_PINTRCVIS_MSI are R/W1C. According
to the RZ/G3S HW manual, Rev. 1.30, R/W1C means "it can be cleared to 0b by
writing 1b. Writing 0b does not change anything."

Drop the read-modify-write approach and make use of this hardware
capability. This avoids clearing unwanted interrupts.

Fixes: 7ef502fb35b2 ("PCI: Add Renesas RZ/G3S host controller driver")
Cc: stable@vger.kernel.org
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---

Changes in v7:
- none, this patch is new

 drivers/pci/controller/pcie-rzg3s-host.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c
index 94345d6f0bee..b0a150262959 100644
--- a/drivers/pci/controller/pcie-rzg3s-host.c
+++ b/drivers/pci/controller/pcie-rzg3s-host.c
@@ -82,6 +82,7 @@
 #define RZG3S_PCI_MSGRCVIE			0x120
 #define RZG3S_PCI_MSGRCVIE_MSG_RCV		BIT(24)
 
+/* Register is R/W1C, it doesn't require locking. */
 #define RZG3S_PCI_MSGRCVIS			0x124
 #define RZG3S_PCI_MSGRCVIS_MRI			BIT(24)
 
@@ -591,11 +592,10 @@ static irqreturn_t rzg3s_pcie_msi_irq(int irq, void *data)
 		return IRQ_NONE;
 
 	/* Clear the MSI */
-	rzg3s_pcie_update_bits(host->axi, RZG3S_PCI_PINTRCVIS,
-			       RZG3S_PCI_PINTRCVIS_MSI,
-			       RZG3S_PCI_PINTRCVIS_MSI);
-	rzg3s_pcie_update_bits(host->axi, RZG3S_PCI_MSGRCVIS,
-			       RZG3S_PCI_MSGRCVIS_MRI, RZG3S_PCI_MSGRCVIS_MRI);
+	writel_relaxed(RZG3S_PCI_PINTRCVIS_MSI,
+		       host->axi + RZG3S_PCI_PINTRCVIS);
+	writel_relaxed(RZG3S_PCI_MSGRCVIS_MRI,
+		       host->axi + RZG3S_PCI_MSGRCVIS);
 
 	for (u8 reg_id = 0; reg_id < regs; reg_id++) {
 		status = readl_relaxed(host->axi + RZG3S_PCI_MSIRS(reg_id));
@@ -958,9 +958,8 @@ static void rzg3s_pcie_intx_irq_ack(struct irq_data *d)
 {
 	struct rzg3s_pcie_host *host = irq_data_get_irq_chip_data(d);
 
-	rzg3s_pcie_update_bits(host->axi, RZG3S_PCI_PINTRCVIS,
-			       RZG3S_PCI_PINTRCVIS_INTX(d->hwirq),
-			       RZG3S_PCI_PINTRCVIS_INTX(d->hwirq));
+	writel_relaxed(RZG3S_PCI_PINTRCVIS_INTX(d->hwirq),
+		       host->axi + RZG3S_PCI_PINTRCVIS);
 }
 
 static void rzg3s_pcie_intx_irq_mask(struct irq_data *d)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v7 02/14] PCI: rzg3s-host: Fix runtime PM handling in the NOIRQ suspend/resume phase
  2026-10-19  6:50 ` [PATCH v7 02/14] PCI: rzg3s-host: Fix runtime PM handling in the NOIRQ suspend/resume phase Claudiu Beznea
@ 2026-11-25 16:39   ` Manivannan Sadhasivam
  2026-11-26 17:04     ` Claudiu Beznea
  0 siblings, 1 reply; 14+ messages in thread
From: Manivannan Sadhasivam @ 2026-11-25 16:39 UTC (permalink / raw)
  To: Claudiu Beznea
  Cc: lpieralisi, kwilczynski, mani, robh, bhelgaas, p.zabel,
	geert+renesas, magnus.damm, claudiu.beznea, linux-pci,
	linux-kernel, linux-renesas-soc, Claudiu Beznea, stable,
	Lad Prabhakar

On 2026-10-19 09:50 +0300, Claudiu Beznea wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> 
> The runtime PM documentation states the following:
> - During system suspend, pm_runtime_get_noresume() is called for every
>   device right before executing the subsystem-level .prepare() callback
>   (in device_prepare()). In addition, the PM core disables runtime PM for
>   every device right before executing the subsystem-level .suspend_late()
>   callback (in device_suspend_late()).
> - During system resume, pm_runtime_enable() is called for every device
>   right after executing the subsystem-level .resume_early() callback (in
>   device_resume_early()), and pm_runtime_put() is called right after
>   executing the subsystem-level .complete() callback (in
>   device_complete()).
> 
> The driver's .suspend_noirq() callback is invoked after .suspend_late(),
> while .resume_noirq() is invoked before .resume_early().
> 
> If:
> - the device is not part of the wake-up path, and
> - its runtime PM status is not RPM_SUSPENDED,
> the generic power domain .suspend_noirq()/.resume_noirq() callbacks
> (genpd_suspend_noirq()/genpd_resume_noirq()) invoke the driver's
> .suspend_noirq()/.resume_noirq() callbacks and call
> genpd_stop_dev()/genpd_start_dev() before and after them, respectively.
> 
> Calling genpd_stop_dev()/genpd_start_dev() allows devices whose power is
> controlled by generic power domains to be powered off and on during
> system suspend and resume, even though their runtime PM usage count does
> not reach zero.
> 
> Since the runtime PM usage count is incremented in device_prepare() and
> decremented in device_complete(), runtime PM operations performed from
> the driver's .suspend_noirq()/.resume_noirq() callbacks are no-ops. The
> actual power transitions are handled by the generic power domain
> .suspend_noirq()/.resume_noirq() callbacks.
> 
> Moreover, attempting to runtime resume a device while runtime PM is
> disabled may return -EACCES. This may cause system resume to fail when
> resuming after a failed Root Port reset, as described in a subsequent
> patch adding hot-plug support.
> 
> Remove the runtime PM calls from the driver's
> .suspend_noirq()/.resume_noirq() callbacks and rely on the generic power
> domain callbacks to power the device off and on.
> 

Going by this logic, do you really need the pm_runtime_resume_and_get() in
probe()? Genpd should also enable the power domain before this driver's probe().

- Mani


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v7 03/14] PCI: rzg3s-host: Don't mix goto-based unwinding and cleanup helpers
  2026-10-19  6:50 ` [PATCH v7 03/14] PCI: rzg3s-host: Don't mix goto-based unwinding and cleanup helpers Claudiu Beznea
@ 2026-11-25 16:40   ` Manivannan Sadhasivam
  2026-11-26 17:10     ` Claudiu Beznea
  0 siblings, 1 reply; 14+ messages in thread
From: Manivannan Sadhasivam @ 2026-11-25 16:40 UTC (permalink / raw)
  To: Claudiu Beznea
  Cc: lpieralisi, kwilczynski, mani, robh, bhelgaas, p.zabel,
	geert+renesas, magnus.damm, claudiu.beznea, linux-pci,
	linux-kernel, linux-renesas-soc, Claudiu Beznea, stable

On 2026-10-19 09:50 +0300, Claudiu Beznea wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> 
> rzg3s_pcie_probe() releases the sysc_np OF node through the
> __free(device_node) annotation, while the rest of the function uses
> goto-based unwinding. According to cleanup.h, the two styles should
> not be mixed within a function, as this makes the ownership semantics
> hard to follow. Drop the annotation and call of_node_put() explicitly
> on the exit paths instead.
> 
> Fixes: 7ef502fb35b2 ("PCI: Add Renesas RZ/G3S host controller driver")
> Cc: stable@vger.kernel.org

Is this really a stable candidate?

- Mani



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v7 04/14] PCI: rzg3s-host: Create the INTx IRQ domain before setting the chained handlers
  2026-10-19  6:50 ` [PATCH v7 04/14] PCI: rzg3s-host: Create the INTx IRQ domain before setting the chained handlers Claudiu Beznea
@ 2026-11-25 16:44   ` Manivannan Sadhasivam
  2026-11-26 17:12     ` Claudiu Beznea
  0 siblings, 1 reply; 14+ messages in thread
From: Manivannan Sadhasivam @ 2026-11-25 16:44 UTC (permalink / raw)
  To: Claudiu Beznea
  Cc: lpieralisi, kwilczynski, mani, robh, bhelgaas, p.zabel,
	geert+renesas, magnus.damm, claudiu.beznea, linux-pci,
	linux-kernel, linux-renesas-soc, Claudiu Beznea, stable

On 2026-10-19 09:50 +0300, Claudiu Beznea wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> 
> rzg3s_pcie_init_irqdomain() installs the chained INTx handlers before
> creating the INTx IRQ domain. irq_set_chained_handler_and_data() also
> enables the interrupt, so an INTx interrupt arriving in between is
> handled by rzg3s_pcie_intx_irq_handler() while host->intx_domain is
> still NULL, leading to a NULL pointer dereference.
> 

Did you observe the NULL ptr dereference on the device or just figuring it out
from the code? If you have seen it, please include the log, otherwise just state
it that it could be possible.

- Mani



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v7 05/14] PCI: rzg3s-host: Initialize the IRQ domains after the IRQs are masked
  2026-10-19  6:50 ` [PATCH v7 05/14] PCI: rzg3s-host: Initialize the IRQ domains after the IRQs are masked Claudiu Beznea
@ 2026-11-25 16:49   ` Manivannan Sadhasivam
  0 siblings, 0 replies; 14+ messages in thread
From: Manivannan Sadhasivam @ 2026-11-25 16:49 UTC (permalink / raw)
  To: Claudiu Beznea
  Cc: lpieralisi, kwilczynski, mani, robh, bhelgaas, p.zabel,
	geert+renesas, magnus.damm, claudiu.beznea, linux-pci,
	linux-kernel, linux-renesas-soc, Claudiu Beznea, stable

On 2026-10-19 09:50 +0300, Claudiu Beznea wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> 
> 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
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> ---
> 
> Changes in v7:
> - none, this patch is new
> 
>  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 cc985020d962..94345d6f0bee 100644
> --- a/drivers/pci/controller/pcie-rzg3s-host.c
> +++ b/drivers/pci/controller/pcie-rzg3s-host.c
> @@ -1418,7 +1418,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,

This split seems unnecessary.

- Mani



^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v7 02/14] PCI: rzg3s-host: Fix runtime PM handling in the NOIRQ suspend/resume phase
  2026-11-25 16:39   ` Manivannan Sadhasivam
@ 2026-11-26 17:04     ` Claudiu Beznea
  2026-11-30  7:18       ` Manivannan Sadhasivam
  0 siblings, 1 reply; 14+ messages in thread
From: Claudiu Beznea @ 2026-11-26 17:04 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: lpieralisi, kwilczynski, mani, robh, bhelgaas, p.zabel,
	geert+renesas, magnus.damm, claudiu.beznea, linux-pci,
	linux-kernel, linux-renesas-soc, Claudiu Beznea, stable,
	Lad Prabhakar



On 11/25/26 18:39, Manivannan Sadhasivam wrote:
> On 2026-10-19 09:50 +0300, Claudiu Beznea wrote:
>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>>
>> The runtime PM documentation states the following:
>> - During system suspend, pm_runtime_get_noresume() is called for every
>>    device right before executing the subsystem-level .prepare() callback
>>    (in device_prepare()). In addition, the PM core disables runtime PM for
>>    every device right before executing the subsystem-level .suspend_late()
>>    callback (in device_suspend_late()).
>> - During system resume, pm_runtime_enable() is called for every device
>>    right after executing the subsystem-level .resume_early() callback (in
>>    device_resume_early()), and pm_runtime_put() is called right after
>>    executing the subsystem-level .complete() callback (in
>>    device_complete()).
>>
>> The driver's .suspend_noirq() callback is invoked after .suspend_late(),
>> while .resume_noirq() is invoked before .resume_early().
>>
>> If:
>> - the device is not part of the wake-up path, and
>> - its runtime PM status is not RPM_SUSPENDED,
>> the generic power domain .suspend_noirq()/.resume_noirq() callbacks
>> (genpd_suspend_noirq()/genpd_resume_noirq()) invoke the driver's
>> .suspend_noirq()/.resume_noirq() callbacks and call
>> genpd_stop_dev()/genpd_start_dev() before and after them, respectively.
>>
>> Calling genpd_stop_dev()/genpd_start_dev() allows devices whose power is
>> controlled by generic power domains to be powered off and on during
>> system suspend and resume, even though their runtime PM usage count does
>> not reach zero.
>>
>> Since the runtime PM usage count is incremented in device_prepare() and
>> decremented in device_complete(), runtime PM operations performed from
>> the driver's .suspend_noirq()/.resume_noirq() callbacks are no-ops. The
>> actual power transitions are handled by the generic power domain
>> .suspend_noirq()/.resume_noirq() callbacks.
>>
>> Moreover, attempting to runtime resume a device while runtime PM is
>> disabled may return -EACCES. This may cause system resume to fail when
>> resuming after a failed Root Port reset, as described in a subsequent
>> patch adding hot-plug support.
>>
>> Remove the runtime PM calls from the driver's
>> .suspend_noirq()/.resume_noirq() callbacks and rely on the generic power
>> domain callbacks to power the device off and on.
>>
> 
> Going by this logic, do you really need the pm_runtime_resume_and_get() in
> probe()?

Yes, it's needed. I just dropped it and it leads to:

[    0.688377] rzg3s-pcie-host 11e40000.pcie: host bridge /soc/pcie@11e40000 ranges:
[    0.688484] rzg3s-pcie-host 11e40000.pcie:      MEM 
0x0030000000..0x0037ffffff -> 0x0030000000
[    0.688525] rzg3s-pcie-host 11e40000.pcie:   IB MEM 
0x0040000000..0x013fffffff -> 0x0040000000
[    0.690412] 1004b800.serial: ttySC3 MMIO:0x000000001004b800 (irq = 44, 
base_baud = 0) is a scif
[    0.690581] printk: legacy console [ttySC3] enabled
[    1.814157] SError Interrupt on CPU0, code 0x00000000be000011 -- SError
[    1.814180] CPU: 0 UID: 0 PID: 37 Comm: kworker/u4:1 Tainted: G   M 
      7.4.0-rc3-next-20261120-00008-gd09508e93329-dirty #251 PREEMPT(full)
[    1.814193] Tainted: [M]=MACHINE_CHECK
[    1.814197] Hardware name: Renesas SMARC EVK version 2 based on r9a08g045s33 (DT)
[    1.814204] Workqueue: async async_run_entry_fn
[    1.814234] pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[    1.814242] pc : rzg3s_pcie_host_setup+0x17c/0x830
[    1.814261] lr : 0x(____ptrval____)
[    1.814271] sp : ffff80008383baf0
[    1.814275] x29: ffff80008383baf0 x28: ffff00000cbcdb58 x27: 0000000000000000
[    1.814287] x26: ffff00000cbcdbc0 x25: ffff00000cb70e40 x24: 0000000000000001
[    1.814297] x23: ffff800081e532b8 x22: ffff00000ba72010 x21: ffff00000cbcd800
[    1.814307] x20: ffff8000807d0b84 x19: 0000000000001014 x18: ffff800083a21044
[    1.814317] x17: ffff00000cb8b2c0 x16: 8000000000000000 x15: ffffffffffffffff
[    1.814327] x14: 0000000000001000 x13: 0000000140000000 x12: 000000013fffffff
[    1.814337] x11: 0000000000001010 x10: fffffffffffffff8 x9 : fffffffffffffff4
[    1.814347] x8 : fffffffffffffff0 x7 : 0000000000000001 x6 : 0000000100000000
[    1.814356] x5 : ffff800083a21054 x4 : 0000000100000000 x3 : 0000000040000000
[    1.814365] x2 : ffffffffffffffec x1 : 0000000000000002 x0 : fffffffffffffffc
[    1.814379] Kernel panic - not syncing: Asynchronous SError Interrupt
[    1.814386] CPU: 0 UID: 0 PID: 37 Comm: kworker/u4:1 Tainted: G   M 
      7.4.0-rc3-next-20261120-00008-gd09508e93329-dirty #251 PREEMPT(full)
[    1.814396] Tainted: [M]=MACHINE_CHECK
[    1.814399] Hardware name: Renesas SMARC EVK version 2 based on r9a08g045s33 (DT)
[    1.814403] Workqueue: async async_run_entry_fn
[    1.814412] Call trace:
[    1.814418]  show_stack+0x18/0x24 (C)
[    1.814437]  dump_stack_lvl+0x38/0x90
[    1.814455]  dump_stack+0x18/0x24
[    1.814465]  vpanic+0x39c/0x3b4
[    1.814478]  nmi_panic+0xf0/0x108
[    1.814487]  arm64_serror_panic+0x70/0x80
[    1.814496]  arm64_is_fatal_ras_serror+0x3c/0xb4
[    1.814504]  do_serror+0x58/0x78
[    1.814511]  el1h_64_error_handler+0x34/0x54
[    1.814523]  el1h_64_error+0x78/0x7c
[    1.814531]  rzg3s_pcie_host_setup+0x17c/0x830 (P)
[    1.814542]  rzg3s_pcie_probe+0x3d8/0x5f8
[    1.814552]  platform_probe+0x5c/0xac
[    1.814567]  really_probe+0xbc/0x2a0
[    1.814576]  __driver_probe_device+0x16c/0x19c
[    1.814585]  driver_probe_device+0x3c/0x114
[    1.814595]  __device_attach_driver+0xb8/0x118
[    1.814604]  bus_for_each_drv+0x80/0xdc
[    1.814613]  __device_attach_async_helper+0xec/0x134
[    1.814622]  async_run_entry_fn+0x34/0xe0
[    1.814631]  process_one_work+0x180/0x2dc
[    1.814646]  worker_thread+0x190/0x2f0
[    1.814656]  kthread+0x120/0x124
[    1.814667]  ret_from_fork+0x10/0x20
[    1.814683] Kernel Offset: disabled
[    1.814685] CPU features: 0x0,80000000,00800050,02300a02,0800e21b
[    1.814692] Memory Limit: none
[    2.083468] ---[ end Kernel panic - not syncing: Asynchronous SError 
Interrupt ]---

Genpd should also enable the power domain before this driver's probe().
Genpd calls genpd_power_on() through platform_probe() but the clock power 
domains implemented for the devices that uses this driver [1], [2], don't 
implement genpd .power_on()/.power_off().

On platform drivers probe:

platform_probe() ->
   dev_pm_domain_attach() ->
     genpd_dev_pm_attach() ->
       __genpd_dev_pm_attach(dev, dev, 0, 1, true) ->
         if (power_on) {
           genpd_lock(pd);
           ret = genpd_power_on(pd, dev, 0);
           genpd_unlock(pd);
         } 


pm_runtime_resume_and_get() calls genpd_start_dev(), which is, for [1] and [2]:

genpd->dev_ops.start = pm_clk_resume;

This enable the clocks for us and is what genpd calls on its own though resume.

Thank you for your review,
Claudiu

[1] 
https://elixir.bootlin.com/linux/v7.4-rc1/source/drivers/clk/renesas/rzg2l-cpg.c#L2607

[2] 
https://elixir.bootlin.com/linux/v7.4-rc1/source/drivers/clk/renesas/rzv2h-cpg.c#L1533

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v7 03/14] PCI: rzg3s-host: Don't mix goto-based unwinding and cleanup helpers
  2026-11-25 16:40   ` Manivannan Sadhasivam
@ 2026-11-26 17:10     ` Claudiu Beznea
  0 siblings, 0 replies; 14+ messages in thread
From: Claudiu Beznea @ 2026-11-26 17:10 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: lpieralisi, kwilczynski, mani, robh, bhelgaas, p.zabel,
	geert+renesas, magnus.damm, claudiu.beznea, linux-pci,
	linux-kernel, linux-renesas-soc, Claudiu Beznea, stable



On 11/25/26 18:40, Manivannan Sadhasivam wrote:
> On 2026-10-19 09:50 +0300, Claudiu Beznea wrote:
>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>>
>> rzg3s_pcie_probe() releases the sysc_np OF node through the
>> __free(device_node) annotation, while the rest of the function uses
>> goto-based unwinding. According to cleanup.h, the two styles should
>> not be mixed within a function, as this makes the ownership semantics
>> hard to follow. Drop the annotation and call of_node_put() explicitly
>> on the exit paths instead.
>>
>> Fixes: 7ef502fb35b2 ("PCI: Add Renesas RZ/G3S host controller driver")
>> Cc: stable@vger.kernel.org
> 
> Is this really a stable candidate?
Indeed, will drop the fixes tag.

Thank you for your review,
Claudiu

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v7 04/14] PCI: rzg3s-host: Create the INTx IRQ domain before setting the chained handlers
  2026-11-25 16:44   ` Manivannan Sadhasivam
@ 2026-11-26 17:12     ` Claudiu Beznea
  0 siblings, 0 replies; 14+ messages in thread
From: Claudiu Beznea @ 2026-11-26 17:12 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: lpieralisi, kwilczynski, mani, robh, bhelgaas, p.zabel,
	geert+renesas, magnus.damm, claudiu.beznea, linux-pci,
	linux-kernel, linux-renesas-soc, Claudiu Beznea, stable



On 11/25/26 18:44, Manivannan Sadhasivam wrote:
> On 2026-10-19 09:50 +0300, Claudiu Beznea wrote:
>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>>
>> rzg3s_pcie_init_irqdomain() installs the chained INTx handlers before
>> creating the INTx IRQ domain. irq_set_chained_handler_and_data() also
>> enables the interrupt, so an INTx interrupt arriving in between is
>> handled by rzg3s_pcie_intx_irq_handler() while host->intx_domain is
>> still NULL, leading to a NULL pointer dereference.
>>
> 
> Did you observe the NULL ptr dereference on the device or just figuring it out
> from the code? If you have seen it, please include the log, otherwise just state
> it that it could be possible.
I haven't reproduce it. Will mention it in the patch description.

Thank you for your review,
Claudiu

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v7 02/14] PCI: rzg3s-host: Fix runtime PM handling in the NOIRQ suspend/resume phase
  2026-11-26 17:04     ` Claudiu Beznea
@ 2026-11-30  7:18       ` Manivannan Sadhasivam
  0 siblings, 0 replies; 14+ messages in thread
From: Manivannan Sadhasivam @ 2026-11-30  7:18 UTC (permalink / raw)
  To: Claudiu Beznea
  Cc: lpieralisi, kwilczynski, robh, bhelgaas, p.zabel, geert+renesas,
	magnus.damm, claudiu.beznea, linux-pci, linux-kernel,
	linux-renesas-soc, Claudiu Beznea, stable, Lad Prabhakar

On Thu, Nov 26, 2026 at 07:04:28PM +0200, Claudiu Beznea wrote:

[...]

> Genpd should also enable the power domain before this driver's probe().
> Genpd calls genpd_power_on() through platform_probe() but the clock power
> domains implemented for the devices that uses this driver [1], [2], don't
> implement genpd .power_on()/.power_off().
> 
> On platform drivers probe:
> 
> platform_probe() ->
>   dev_pm_domain_attach() ->
>     genpd_dev_pm_attach() ->
>       __genpd_dev_pm_attach(dev, dev, 0, 1, true) ->
>         if (power_on) {
>           genpd_lock(pd);
>           ret = genpd_power_on(pd, dev, 0);
>           genpd_unlock(pd);
>         }
> 
> 
> pm_runtime_resume_and_get() calls genpd_start_dev(), which is, for [1] and [2]:
> 
> genpd->dev_ops.start = pm_clk_resume;
> 
> This enable the clocks for us and is what genpd calls on its own though resume.
> 

Ah, this looks like a broken design. A genpd power domain must power on all
resources required for the consumers to work in its power_on callback.

Anyhow, it is not my problem to fix it. Atleast you should add a comment above
the probe's pm_runtime_resume_and_get() call.

- Mani

-- 
மணிவண்ணன் சதாசிவம்

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-11-30  7:18 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261019065025.2146539-1-claudiu.beznea@kernel.org>
2026-10-19  6:50 ` [PATCH v7 01/14] PCI: rzg3s-host: Follow hardware manual clock/reset initialization order Claudiu Beznea
2026-10-19  6:50 ` [PATCH v7 02/14] PCI: rzg3s-host: Fix runtime PM handling in the NOIRQ suspend/resume phase Claudiu Beznea
2026-11-25 16:39   ` Manivannan Sadhasivam
2026-11-26 17:04     ` Claudiu Beznea
2026-11-30  7:18       ` Manivannan Sadhasivam
2026-10-19  6:50 ` [PATCH v7 03/14] PCI: rzg3s-host: Don't mix goto-based unwinding and cleanup helpers Claudiu Beznea
2026-11-25 16:40   ` Manivannan Sadhasivam
2026-11-26 17:10     ` Claudiu Beznea
2026-10-19  6:50 ` [PATCH v7 04/14] PCI: rzg3s-host: Create the INTx IRQ domain before setting the chained handlers Claudiu Beznea
2026-11-25 16:44   ` Manivannan Sadhasivam
2026-11-26 17:12     ` Claudiu Beznea
2026-10-19  6:50 ` [PATCH v7 05/14] PCI: rzg3s-host: Initialize the IRQ domains after the IRQs are masked Claudiu Beznea
2026-11-25 16:49   ` Manivannan Sadhasivam
2026-10-19  6:50 ` [PATCH v7 06/14] PCI: rzg3s-host: Drop read-modify-write approach for the R/W1C registers Claudiu Beznea

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox