* [PATCH] PCI: rockchip-host: Support hibernation with endpoints in D0
@ 2026-11-19 1:12 ` Igor Velkov via B4 Relay
0 siblings, 0 replies; 10+ messages in thread
From: Igor Velkov via B4 Relay @ 2026-11-19 1:12 UTC (permalink / raw)
To: Shawn Lin, Manivannan Sadhasivam, Lorenzo Pieralisi,
Krzysztof Wilczyński, Bjorn Helgaas
Cc: linux-pci, Heiko Stuebner, linux-rockchip, linux-arm-kernel,
linux-kernel, Rob Herring, Igor Velkov
From: Igor Velkov <iav@iav.lv>
The driver runs its suspend callback on every system sleep transition,
including hibernation freeze and the quiesce step of the kernel that
loads the image. The PCI core leaves the endpoints in D0 there, the
link does not enter L2 after PME_Turn_Off, and hibernation aborts:
rockchip-pcie f8000000.pcie: PCIe link enter L2 timeout!
rockchip-pcie f8000000.pcie: PM: failed to freeze noirq: error -110
Keep the link up across freeze and thaw. On restore, power the port
down and bring it up as on resume, because the kernel that loaded the
image may have left it in any state. The port may already be down if
poweroff_noirq ran, so track that state.
Signed-off-by: Igor Velkov <iav@iav.lv>
---
Tested on v7.4-rc3 with this patch, ROCK Pi 4A with a WD SN770 NVMe:
5 of 5 hibernation cycles restored, the NVMe readable after each.
---
drivers/pci/controller/pcie-rockchip-host.c | 33 +++++++++++++++++++++++++++--
drivers/pci/controller/pcie-rockchip.h | 1 +
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c
index 1e1556e436b8..df4b9b3ec031 100644
--- a/drivers/pci/controller/pcie-rockchip-host.c
+++ b/drivers/pci/controller/pcie-rockchip-host.c
@@ -863,6 +863,8 @@ static int rockchip_pcie_suspend_noirq(struct device *dev)
regulator_disable(rockchip->vpcie0v9);
+ rockchip->powered_down = true;
+
return ret;
}
@@ -893,6 +895,8 @@ static int rockchip_pcie_resume_noirq(struct device *dev)
rockchip_pcie_update_txcredit_mui(rockchip);
rockchip_pcie_enable_interrupts(rockchip);
+ rockchip->powered_down = false;
+
return 0;
err_err_deinit_port:
@@ -904,6 +908,25 @@ static int rockchip_pcie_resume_noirq(struct device *dev)
return err;
}
+static int rockchip_pcie_restore_noirq(struct device *dev)
+{
+ struct rockchip_pcie *rockchip = dev_get_drvdata(dev);
+
+ /*
+ * The boot kernel may have left the port in any state, while the image
+ * holds the enable counts of a running port. Power it down so that
+ * resume brings it up from scratch.
+ */
+ if (!rockchip->powered_down) {
+ rockchip_pcie_deinit_phys(rockchip);
+ rockchip_pcie_disable_clocks(rockchip);
+ regulator_disable(rockchip->vpcie0v9);
+ rockchip->powered_down = true;
+ }
+
+ return rockchip_pcie_resume_noirq(dev);
+}
+
static int rockchip_pcie_probe(struct platform_device *pdev)
{
struct rockchip_pcie *rockchip;
@@ -1011,9 +1034,15 @@ static void rockchip_pcie_remove(struct platform_device *pdev)
regulator_disable(rockchip->vpcie0v9);
}
+/*
+ * Freeze leaves the endpoints in D0 and the link does not reach L2 then,
+ * so keep the link up across freeze and thaw; restore re-inits the port.
+ */
static const struct dev_pm_ops rockchip_pcie_pm_ops = {
- NOIRQ_SYSTEM_SLEEP_PM_OPS(rockchip_pcie_suspend_noirq,
- rockchip_pcie_resume_noirq)
+ .suspend_noirq = pm_sleep_ptr(rockchip_pcie_suspend_noirq),
+ .resume_noirq = pm_sleep_ptr(rockchip_pcie_resume_noirq),
+ .poweroff_noirq = pm_sleep_ptr(rockchip_pcie_suspend_noirq),
+ .restore_noirq = pm_sleep_ptr(rockchip_pcie_restore_noirq),
};
static const struct of_device_id rockchip_pcie_of_match[] = {
diff --git a/drivers/pci/controller/pcie-rockchip.h b/drivers/pci/controller/pcie-rockchip.h
index b5da15601b58..51877678d3df 100644
--- a/drivers/pci/controller/pcie-rockchip.h
+++ b/drivers/pci/controller/pcie-rockchip.h
@@ -324,6 +324,7 @@ struct rockchip_pcie {
void __iomem *msg_region;
phys_addr_t msg_bus_addr;
bool is_rc;
+ bool powered_down;
struct resource *mem_res;
};
---
base-commit: 35f800669ce835aa77364a2ab5b61be19b778d3c
change-id: 20261119-b4-rockchip-pcie-hib-004e1adc4042
Best regards,
--
Igor Velkov <iav@iav.lv>
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH] PCI: rockchip-host: Support hibernation with endpoints in D0
@ 2026-11-19 1:12 ` Igor Velkov via B4 Relay
0 siblings, 0 replies; 10+ messages in thread
From: Igor Velkov via B4 Relay @ 2026-11-19 1:12 UTC (permalink / raw)
To: Shawn Lin, Manivannan Sadhasivam, Lorenzo Pieralisi,
Krzysztof Wilczyński, Bjorn Helgaas
Cc: linux-pci, Heiko Stuebner, linux-rockchip, linux-arm-kernel,
linux-kernel, Rob Herring, Igor Velkov
From: Igor Velkov <iav@iav.lv>
The driver runs its suspend callback on every system sleep transition,
including hibernation freeze and the quiesce step of the kernel that
loads the image. The PCI core leaves the endpoints in D0 there, the
link does not enter L2 after PME_Turn_Off, and hibernation aborts:
rockchip-pcie f8000000.pcie: PCIe link enter L2 timeout!
rockchip-pcie f8000000.pcie: PM: failed to freeze noirq: error -110
Keep the link up across freeze and thaw. On restore, power the port
down and bring it up as on resume, because the kernel that loaded the
image may have left it in any state. The port may already be down if
poweroff_noirq ran, so track that state.
Signed-off-by: Igor Velkov <iav@iav.lv>
---
Tested on v7.4-rc3 with this patch, ROCK Pi 4A with a WD SN770 NVMe:
5 of 5 hibernation cycles restored, the NVMe readable after each.
---
drivers/pci/controller/pcie-rockchip-host.c | 33 +++++++++++++++++++++++++++--
drivers/pci/controller/pcie-rockchip.h | 1 +
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c
index 1e1556e436b8..df4b9b3ec031 100644
--- a/drivers/pci/controller/pcie-rockchip-host.c
+++ b/drivers/pci/controller/pcie-rockchip-host.c
@@ -863,6 +863,8 @@ static int rockchip_pcie_suspend_noirq(struct device *dev)
regulator_disable(rockchip->vpcie0v9);
+ rockchip->powered_down = true;
+
return ret;
}
@@ -893,6 +895,8 @@ static int rockchip_pcie_resume_noirq(struct device *dev)
rockchip_pcie_update_txcredit_mui(rockchip);
rockchip_pcie_enable_interrupts(rockchip);
+ rockchip->powered_down = false;
+
return 0;
err_err_deinit_port:
@@ -904,6 +908,25 @@ static int rockchip_pcie_resume_noirq(struct device *dev)
return err;
}
+static int rockchip_pcie_restore_noirq(struct device *dev)
+{
+ struct rockchip_pcie *rockchip = dev_get_drvdata(dev);
+
+ /*
+ * The boot kernel may have left the port in any state, while the image
+ * holds the enable counts of a running port. Power it down so that
+ * resume brings it up from scratch.
+ */
+ if (!rockchip->powered_down) {
+ rockchip_pcie_deinit_phys(rockchip);
+ rockchip_pcie_disable_clocks(rockchip);
+ regulator_disable(rockchip->vpcie0v9);
+ rockchip->powered_down = true;
+ }
+
+ return rockchip_pcie_resume_noirq(dev);
+}
+
static int rockchip_pcie_probe(struct platform_device *pdev)
{
struct rockchip_pcie *rockchip;
@@ -1011,9 +1034,15 @@ static void rockchip_pcie_remove(struct platform_device *pdev)
regulator_disable(rockchip->vpcie0v9);
}
+/*
+ * Freeze leaves the endpoints in D0 and the link does not reach L2 then,
+ * so keep the link up across freeze and thaw; restore re-inits the port.
+ */
static const struct dev_pm_ops rockchip_pcie_pm_ops = {
- NOIRQ_SYSTEM_SLEEP_PM_OPS(rockchip_pcie_suspend_noirq,
- rockchip_pcie_resume_noirq)
+ .suspend_noirq = pm_sleep_ptr(rockchip_pcie_suspend_noirq),
+ .resume_noirq = pm_sleep_ptr(rockchip_pcie_resume_noirq),
+ .poweroff_noirq = pm_sleep_ptr(rockchip_pcie_suspend_noirq),
+ .restore_noirq = pm_sleep_ptr(rockchip_pcie_restore_noirq),
};
static const struct of_device_id rockchip_pcie_of_match[] = {
diff --git a/drivers/pci/controller/pcie-rockchip.h b/drivers/pci/controller/pcie-rockchip.h
index b5da15601b58..51877678d3df 100644
--- a/drivers/pci/controller/pcie-rockchip.h
+++ b/drivers/pci/controller/pcie-rockchip.h
@@ -324,6 +324,7 @@ struct rockchip_pcie {
void __iomem *msg_region;
phys_addr_t msg_bus_addr;
bool is_rc;
+ bool powered_down;
struct resource *mem_res;
};
---
base-commit: 35f800669ce835aa77364a2ab5b61be19b778d3c
change-id: 20261119-b4-rockchip-pcie-hib-004e1adc4042
Best regards,
--
Igor Velkov <iav@iav.lv>
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH] PCI: rockchip-host: Support hibernation with endpoints in D0
@ 2026-11-19 1:12 ` Igor Velkov via B4 Relay
0 siblings, 0 replies; 10+ messages in thread
From: Igor Velkov @ 2026-11-19 1:12 UTC (permalink / raw)
To: Shawn Lin, Manivannan Sadhasivam, Lorenzo Pieralisi,
Krzysztof Wilczyński, Bjorn Helgaas
Cc: linux-pci, Heiko Stuebner, linux-rockchip, linux-arm-kernel,
linux-kernel, Rob Herring, Igor Velkov
The driver runs its suspend callback on every system sleep transition,
including hibernation freeze and the quiesce step of the kernel that
loads the image. The PCI core leaves the endpoints in D0 there, the
link does not enter L2 after PME_Turn_Off, and hibernation aborts:
rockchip-pcie f8000000.pcie: PCIe link enter L2 timeout!
rockchip-pcie f8000000.pcie: PM: failed to freeze noirq: error -110
Keep the link up across freeze and thaw. On restore, power the port
down and bring it up as on resume, because the kernel that loaded the
image may have left it in any state. The port may already be down if
poweroff_noirq ran, so track that state.
Signed-off-by: Igor Velkov <iav@iav.lv>
---
Tested on v7.4-rc3 with this patch, ROCK Pi 4A with a WD SN770 NVMe:
5 of 5 hibernation cycles restored, the NVMe readable after each.
---
drivers/pci/controller/pcie-rockchip-host.c | 33 +++++++++++++++++++++++++++--
drivers/pci/controller/pcie-rockchip.h | 1 +
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c
index 1e1556e436b8..df4b9b3ec031 100644
--- a/drivers/pci/controller/pcie-rockchip-host.c
+++ b/drivers/pci/controller/pcie-rockchip-host.c
@@ -863,6 +863,8 @@ static int rockchip_pcie_suspend_noirq(struct device *dev)
regulator_disable(rockchip->vpcie0v9);
+ rockchip->powered_down = true;
+
return ret;
}
@@ -893,6 +895,8 @@ static int rockchip_pcie_resume_noirq(struct device *dev)
rockchip_pcie_update_txcredit_mui(rockchip);
rockchip_pcie_enable_interrupts(rockchip);
+ rockchip->powered_down = false;
+
return 0;
err_err_deinit_port:
@@ -904,6 +908,25 @@ static int rockchip_pcie_resume_noirq(struct device *dev)
return err;
}
+static int rockchip_pcie_restore_noirq(struct device *dev)
+{
+ struct rockchip_pcie *rockchip = dev_get_drvdata(dev);
+
+ /*
+ * The boot kernel may have left the port in any state, while the image
+ * holds the enable counts of a running port. Power it down so that
+ * resume brings it up from scratch.
+ */
+ if (!rockchip->powered_down) {
+ rockchip_pcie_deinit_phys(rockchip);
+ rockchip_pcie_disable_clocks(rockchip);
+ regulator_disable(rockchip->vpcie0v9);
+ rockchip->powered_down = true;
+ }
+
+ return rockchip_pcie_resume_noirq(dev);
+}
+
static int rockchip_pcie_probe(struct platform_device *pdev)
{
struct rockchip_pcie *rockchip;
@@ -1011,9 +1034,15 @@ static void rockchip_pcie_remove(struct platform_device *pdev)
regulator_disable(rockchip->vpcie0v9);
}
+/*
+ * Freeze leaves the endpoints in D0 and the link does not reach L2 then,
+ * so keep the link up across freeze and thaw; restore re-inits the port.
+ */
static const struct dev_pm_ops rockchip_pcie_pm_ops = {
- NOIRQ_SYSTEM_SLEEP_PM_OPS(rockchip_pcie_suspend_noirq,
- rockchip_pcie_resume_noirq)
+ .suspend_noirq = pm_sleep_ptr(rockchip_pcie_suspend_noirq),
+ .resume_noirq = pm_sleep_ptr(rockchip_pcie_resume_noirq),
+ .poweroff_noirq = pm_sleep_ptr(rockchip_pcie_suspend_noirq),
+ .restore_noirq = pm_sleep_ptr(rockchip_pcie_restore_noirq),
};
static const struct of_device_id rockchip_pcie_of_match[] = {
diff --git a/drivers/pci/controller/pcie-rockchip.h b/drivers/pci/controller/pcie-rockchip.h
index b5da15601b58..51877678d3df 100644
--- a/drivers/pci/controller/pcie-rockchip.h
+++ b/drivers/pci/controller/pcie-rockchip.h
@@ -324,6 +324,7 @@ struct rockchip_pcie {
void __iomem *msg_region;
phys_addr_t msg_bus_addr;
bool is_rc;
+ bool powered_down;
struct resource *mem_res;
};
---
base-commit: 35f800669ce835aa77364a2ab5b61be19b778d3c
change-id: 20261119-b4-rockchip-pcie-hib-004e1adc4042
Best regards,
--
Igor Velkov <iav@iav.lv>
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH] PCI: rockchip-host: Support hibernation with endpoints in D0
2026-11-19 1:12 ` Igor Velkov via B4 Relay
(?)
(?)
@ 2026-11-19 1:33 ` sashiko-bot
-1 siblings, 0 replies; 10+ messages in thread
From: sashiko-bot @ 2026-11-19 1:33 UTC (permalink / raw)
To: Igor Velkov; +Cc: linux-pci
> From: Igor Velkov <iav@iav.lv>
>
> The driver runs its suspend callback on every system sleep transition,
> including hibernation freeze and the quiesce step of the kernel that
> loads the image. The PCI core leaves the endpoints in D0 there, the
> link does not enter L2 after PME_Turn_Off, and hibernation aborts:
>
> rockchip-pcie f8000000.pcie: PCIe link enter L2 timeout!
> rockchip-pcie f8000000.pcie: PM: failed to freeze noirq: error -110
>
> Keep the link up across freeze and thaw. On restore, power the port
> down and bring it up as on resume, because the kernel that loaded the
> image may have left it in any state. The port may already be down if
> poweroff_noirq ran, so track that state.
>
> Signed-off-by: Igor Velkov <iav@iav.lv>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119-b4-rockchip-pcie-hib-v1-1-05df24cc77e6@iav.lv?part=1
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] PCI: rockchip-host: Support hibernation with endpoints in D0
2026-11-19 1:12 ` Igor Velkov via B4 Relay
@ 2026-11-19 6:04 ` Anand Moon
-1 siblings, 0 replies; 10+ messages in thread
From: Anand Moon @ 2026-11-19 6:04 UTC (permalink / raw)
To: iav
Cc: Shawn Lin, Manivannan Sadhasivam, Lorenzo Pieralisi,
Krzysztof Wilczyński, Bjorn Helgaas, linux-pci,
Heiko Stuebner, linux-rockchip, linux-arm-kernel, linux-kernel,
Rob Herring
Hi Igor,
On Thu, 19 Nov 2026 at 06:42, Igor Velkov via B4 Relay
<devnull+iav.iav.lv@kernel.org> wrote:
>
> From: Igor Velkov <iav@iav.lv>
>
> The driver runs its suspend callback on every system sleep transition,
> including hibernation freeze and the quiesce step of the kernel that
> loads the image. The PCI core leaves the endpoints in D0 there, the
> link does not enter L2 after PME_Turn_Off, and hibernation aborts:
>
> rockchip-pcie f8000000.pcie: PCIe link enter L2 timeout!
> rockchip-pcie f8000000.pcie: PM: failed to freeze noirq: error -110
>
> Keep the link up across freeze and thaw. On restore, power the port
> down and bring it up as on resume, because the kernel that loaded the
> image may have left it in any state. The port may already be down if
> poweroff_noirq ran, so track that state.
>
It looks like we aren't disabling all the PCIe regulators (0.9V, 1.8V,
3.3V, and 12V)
during suspend and re-enabling them during resume.
Shouldn't we power down all of them on suspend and bring them back up on resume?
Thanks
-Anand
> Signed-off-by: Igor Velkov <iav@iav.lv>
> ---
> Tested on v7.4-rc3 with this patch, ROCK Pi 4A with a WD SN770 NVMe:
> 5 of 5 hibernation cycles restored, the NVMe readable after each.
> ---
> drivers/pci/controller/pcie-rockchip-host.c | 33 +++++++++++++++++++++++++++--
> drivers/pci/controller/pcie-rockchip.h | 1 +
> 2 files changed, 32 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c
> index 1e1556e436b8..df4b9b3ec031 100644
> --- a/drivers/pci/controller/pcie-rockchip-host.c
> +++ b/drivers/pci/controller/pcie-rockchip-host.c
> @@ -863,6 +863,8 @@ static int rockchip_pcie_suspend_noirq(struct device *dev)
>
> regulator_disable(rockchip->vpcie0v9);
>
> + rockchip->powered_down = true;
> +
> return ret;
> }
>
> @@ -893,6 +895,8 @@ static int rockchip_pcie_resume_noirq(struct device *dev)
> rockchip_pcie_update_txcredit_mui(rockchip);
> rockchip_pcie_enable_interrupts(rockchip);
>
> + rockchip->powered_down = false;
> +
> return 0;
>
> err_err_deinit_port:
> @@ -904,6 +908,25 @@ static int rockchip_pcie_resume_noirq(struct device *dev)
> return err;
> }
>
> +static int rockchip_pcie_restore_noirq(struct device *dev)
> +{
> + struct rockchip_pcie *rockchip = dev_get_drvdata(dev);
> +
> + /*
> + * The boot kernel may have left the port in any state, while the image
> + * holds the enable counts of a running port. Power it down so that
> + * resume brings it up from scratch.
> + */
> + if (!rockchip->powered_down) {
> + rockchip_pcie_deinit_phys(rockchip);
> + rockchip_pcie_disable_clocks(rockchip);
> + regulator_disable(rockchip->vpcie0v9);
> + rockchip->powered_down = true;
> + }
> +
> + return rockchip_pcie_resume_noirq(dev);
> +}
> +
> static int rockchip_pcie_probe(struct platform_device *pdev)
> {
> struct rockchip_pcie *rockchip;
> @@ -1011,9 +1034,15 @@ static void rockchip_pcie_remove(struct platform_device *pdev)
> regulator_disable(rockchip->vpcie0v9);
> }
>
> +/*
> + * Freeze leaves the endpoints in D0 and the link does not reach L2 then,
> + * so keep the link up across freeze and thaw; restore re-inits the port.
> + */
> static const struct dev_pm_ops rockchip_pcie_pm_ops = {
> - NOIRQ_SYSTEM_SLEEP_PM_OPS(rockchip_pcie_suspend_noirq,
> - rockchip_pcie_resume_noirq)
> + .suspend_noirq = pm_sleep_ptr(rockchip_pcie_suspend_noirq),
> + .resume_noirq = pm_sleep_ptr(rockchip_pcie_resume_noirq),
> + .poweroff_noirq = pm_sleep_ptr(rockchip_pcie_suspend_noirq),
> + .restore_noirq = pm_sleep_ptr(rockchip_pcie_restore_noirq),
> };
>
> static const struct of_device_id rockchip_pcie_of_match[] = {
> diff --git a/drivers/pci/controller/pcie-rockchip.h b/drivers/pci/controller/pcie-rockchip.h
> index b5da15601b58..51877678d3df 100644
> --- a/drivers/pci/controller/pcie-rockchip.h
> +++ b/drivers/pci/controller/pcie-rockchip.h
> @@ -324,6 +324,7 @@ struct rockchip_pcie {
> void __iomem *msg_region;
> phys_addr_t msg_bus_addr;
> bool is_rc;
> + bool powered_down;
> struct resource *mem_res;
> };
>
>
> ---
> base-commit: 35f800669ce835aa77364a2ab5b61be19b778d3c
> change-id: 20261119-b4-rockchip-pcie-hib-004e1adc4042
>
> Best regards,
> --
> Igor Velkov <iav@iav.lv>
>
>
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] PCI: rockchip-host: Support hibernation with endpoints in D0
@ 2026-11-19 6:04 ` Anand Moon
0 siblings, 0 replies; 10+ messages in thread
From: Anand Moon @ 2026-11-19 6:04 UTC (permalink / raw)
To: iav
Cc: Shawn Lin, Manivannan Sadhasivam, Lorenzo Pieralisi,
Krzysztof Wilczyński, Bjorn Helgaas, linux-pci,
Heiko Stuebner, linux-rockchip, linux-arm-kernel, linux-kernel,
Rob Herring
Hi Igor,
On Thu, 19 Nov 2026 at 06:42, Igor Velkov via B4 Relay
<devnull+iav.iav.lv@kernel.org> wrote:
>
> From: Igor Velkov <iav@iav.lv>
>
> The driver runs its suspend callback on every system sleep transition,
> including hibernation freeze and the quiesce step of the kernel that
> loads the image. The PCI core leaves the endpoints in D0 there, the
> link does not enter L2 after PME_Turn_Off, and hibernation aborts:
>
> rockchip-pcie f8000000.pcie: PCIe link enter L2 timeout!
> rockchip-pcie f8000000.pcie: PM: failed to freeze noirq: error -110
>
> Keep the link up across freeze and thaw. On restore, power the port
> down and bring it up as on resume, because the kernel that loaded the
> image may have left it in any state. The port may already be down if
> poweroff_noirq ran, so track that state.
>
It looks like we aren't disabling all the PCIe regulators (0.9V, 1.8V,
3.3V, and 12V)
during suspend and re-enabling them during resume.
Shouldn't we power down all of them on suspend and bring them back up on resume?
Thanks
-Anand
> Signed-off-by: Igor Velkov <iav@iav.lv>
> ---
> Tested on v7.4-rc3 with this patch, ROCK Pi 4A with a WD SN770 NVMe:
> 5 of 5 hibernation cycles restored, the NVMe readable after each.
> ---
> drivers/pci/controller/pcie-rockchip-host.c | 33 +++++++++++++++++++++++++++--
> drivers/pci/controller/pcie-rockchip.h | 1 +
> 2 files changed, 32 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/controller/pcie-rockchip-host.c b/drivers/pci/controller/pcie-rockchip-host.c
> index 1e1556e436b8..df4b9b3ec031 100644
> --- a/drivers/pci/controller/pcie-rockchip-host.c
> +++ b/drivers/pci/controller/pcie-rockchip-host.c
> @@ -863,6 +863,8 @@ static int rockchip_pcie_suspend_noirq(struct device *dev)
>
> regulator_disable(rockchip->vpcie0v9);
>
> + rockchip->powered_down = true;
> +
> return ret;
> }
>
> @@ -893,6 +895,8 @@ static int rockchip_pcie_resume_noirq(struct device *dev)
> rockchip_pcie_update_txcredit_mui(rockchip);
> rockchip_pcie_enable_interrupts(rockchip);
>
> + rockchip->powered_down = false;
> +
> return 0;
>
> err_err_deinit_port:
> @@ -904,6 +908,25 @@ static int rockchip_pcie_resume_noirq(struct device *dev)
> return err;
> }
>
> +static int rockchip_pcie_restore_noirq(struct device *dev)
> +{
> + struct rockchip_pcie *rockchip = dev_get_drvdata(dev);
> +
> + /*
> + * The boot kernel may have left the port in any state, while the image
> + * holds the enable counts of a running port. Power it down so that
> + * resume brings it up from scratch.
> + */
> + if (!rockchip->powered_down) {
> + rockchip_pcie_deinit_phys(rockchip);
> + rockchip_pcie_disable_clocks(rockchip);
> + regulator_disable(rockchip->vpcie0v9);
> + rockchip->powered_down = true;
> + }
> +
> + return rockchip_pcie_resume_noirq(dev);
> +}
> +
> static int rockchip_pcie_probe(struct platform_device *pdev)
> {
> struct rockchip_pcie *rockchip;
> @@ -1011,9 +1034,15 @@ static void rockchip_pcie_remove(struct platform_device *pdev)
> regulator_disable(rockchip->vpcie0v9);
> }
>
> +/*
> + * Freeze leaves the endpoints in D0 and the link does not reach L2 then,
> + * so keep the link up across freeze and thaw; restore re-inits the port.
> + */
> static const struct dev_pm_ops rockchip_pcie_pm_ops = {
> - NOIRQ_SYSTEM_SLEEP_PM_OPS(rockchip_pcie_suspend_noirq,
> - rockchip_pcie_resume_noirq)
> + .suspend_noirq = pm_sleep_ptr(rockchip_pcie_suspend_noirq),
> + .resume_noirq = pm_sleep_ptr(rockchip_pcie_resume_noirq),
> + .poweroff_noirq = pm_sleep_ptr(rockchip_pcie_suspend_noirq),
> + .restore_noirq = pm_sleep_ptr(rockchip_pcie_restore_noirq),
> };
>
> static const struct of_device_id rockchip_pcie_of_match[] = {
> diff --git a/drivers/pci/controller/pcie-rockchip.h b/drivers/pci/controller/pcie-rockchip.h
> index b5da15601b58..51877678d3df 100644
> --- a/drivers/pci/controller/pcie-rockchip.h
> +++ b/drivers/pci/controller/pcie-rockchip.h
> @@ -324,6 +324,7 @@ struct rockchip_pcie {
> void __iomem *msg_region;
> phys_addr_t msg_bus_addr;
> bool is_rc;
> + bool powered_down;
> struct resource *mem_res;
> };
>
>
> ---
> base-commit: 35f800669ce835aa77364a2ab5b61be19b778d3c
> change-id: 20261119-b4-rockchip-pcie-hib-004e1adc4042
>
> Best regards,
> --
> Igor Velkov <iav@iav.lv>
>
>
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] PCI: rockchip-host: Support hibernation with endpoints in D0
2026-11-19 6:04 ` Anand Moon
@ 2026-11-19 6:23 ` Igor Velkov
-1 siblings, 0 replies; 10+ messages in thread
From: Igor Velkov @ 2026-11-19 6:23 UTC (permalink / raw)
To: Anand Moon
Cc: Shawn Lin, Manivannan Sadhasivam, Lorenzo Pieralisi,
Krzysztof Wilczyński, Bjorn Helgaas, linux-pci,
Heiko Stuebner, linux-rockchip, linux-arm-kernel, linux-kernel,
Rob Herring, iav
On Thu, 19 Nov 2026, Anand Moon wrote:
> It looks like we aren't disabling all the PCIe regulators (0.9V, 1.8V,
> 3.3V, and 12V)
> during suspend and re-enabling them during resume.
> Shouldn't we power down all of them on suspend and bring them back up on resume?
This patch keeps the rails as they are: suspend_noirq() already turns
off only vpcie0v9, and the other rails stay on from probe to remove.
The 3.3 V and 12 V rails power the endpoint; cutting them in suspend
loses the state that the PCI core and the endpoint driver expect to
keep in D3hot. Doing that would be a separate change.
--
Igor Velkov <iav@iav.lv>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] PCI: rockchip-host: Support hibernation with endpoints in D0
@ 2026-11-19 6:23 ` Igor Velkov
0 siblings, 0 replies; 10+ messages in thread
From: Igor Velkov @ 2026-11-19 6:23 UTC (permalink / raw)
To: Anand Moon
Cc: Shawn Lin, Manivannan Sadhasivam, Lorenzo Pieralisi,
Krzysztof Wilczyński, Bjorn Helgaas, linux-pci,
Heiko Stuebner, linux-rockchip, linux-arm-kernel, linux-kernel,
Rob Herring, iav
On Thu, 19 Nov 2026, Anand Moon wrote:
> It looks like we aren't disabling all the PCIe regulators (0.9V, 1.8V,
> 3.3V, and 12V)
> during suspend and re-enabling them during resume.
> Shouldn't we power down all of them on suspend and bring them back up on resume?
This patch keeps the rails as they are: suspend_noirq() already turns
off only vpcie0v9, and the other rails stay on from probe to remove.
The 3.3 V and 12 V rails power the endpoint; cutting them in suspend
loses the state that the PCI core and the endpoint driver expect to
keep in D3hot. Doing that would be a separate change.
--
Igor Velkov <iav@iav.lv>
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] PCI: rockchip-host: Support hibernation with endpoints in D0
2026-11-19 6:23 ` Igor Velkov
@ 2026-11-19 8:03 ` Anand Moon
-1 siblings, 0 replies; 10+ messages in thread
From: Anand Moon @ 2026-11-19 8:03 UTC (permalink / raw)
To: Igor Velkov
Cc: Shawn Lin, Manivannan Sadhasivam, Lorenzo Pieralisi,
Krzysztof Wilczyński, Bjorn Helgaas, linux-pci,
Heiko Stuebner, linux-rockchip, linux-arm-kernel, linux-kernel,
Rob Herring
Hi Igor,
On Thu, 19 Nov 2026 at 11:54, Igor Velkov <iav@iav.lv> wrote:
>
> On Thu, 19 Nov 2026, Anand Moon wrote:
> > It looks like we aren't disabling all the PCIe regulators (0.9V, 1.8V,
> > 3.3V, and 12V)
> > during suspend and re-enabling them during resume.
> > Shouldn't we power down all of them on suspend and bring them back up on resume?
>
> This patch keeps the rails as they are: suspend_noirq() already turns
> off only vpcie0v9, and the other rails stay on from probe to remove.
> The 3.3 V and 12 V rails power the endpoint; cutting them in suspend
> loses the state that the PCI core and the endpoint driver expect to
> keep in D3hot. Doing that would be a separate change.
>
Makes sense. Thanks
I will check the disable and enable regulators to help with this issue
and will update you.
> --
> Igor Velkov <iav@iav.lv>
Thanks
-Anand
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] PCI: rockchip-host: Support hibernation with endpoints in D0
@ 2026-11-19 8:03 ` Anand Moon
0 siblings, 0 replies; 10+ messages in thread
From: Anand Moon @ 2026-11-19 8:03 UTC (permalink / raw)
To: Igor Velkov
Cc: Shawn Lin, Manivannan Sadhasivam, Lorenzo Pieralisi,
Krzysztof Wilczyński, Bjorn Helgaas, linux-pci,
Heiko Stuebner, linux-rockchip, linux-arm-kernel, linux-kernel,
Rob Herring
Hi Igor,
On Thu, 19 Nov 2026 at 11:54, Igor Velkov <iav@iav.lv> wrote:
>
> On Thu, 19 Nov 2026, Anand Moon wrote:
> > It looks like we aren't disabling all the PCIe regulators (0.9V, 1.8V,
> > 3.3V, and 12V)
> > during suspend and re-enabling them during resume.
> > Shouldn't we power down all of them on suspend and bring them back up on resume?
>
> This patch keeps the rails as they are: suspend_noirq() already turns
> off only vpcie0v9, and the other rails stay on from probe to remove.
> The 3.3 V and 12 V rails power the endpoint; cutting them in suspend
> loses the state that the PCI core and the endpoint driver expect to
> keep in D3hot. Doing that would be a separate change.
>
Makes sense. Thanks
I will check the disable and enable regulators to help with this issue
and will update you.
> --
> Igor Velkov <iav@iav.lv>
Thanks
-Anand
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2026-11-19 8:03 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 1:12 [PATCH] PCI: rockchip-host: Support hibernation with endpoints in D0 Igor Velkov via B4 Relay
2026-11-19 1:12 ` Igor Velkov
2026-11-19 1:12 ` Igor Velkov via B4 Relay
2026-11-19 1:33 ` sashiko-bot
2026-11-19 6:04 ` Anand Moon
2026-11-19 6:04 ` Anand Moon
2026-11-19 6:23 ` Igor Velkov
2026-11-19 6:23 ` Igor Velkov
2026-11-19 8:03 ` Anand Moon
2026-11-19 8:03 ` Anand Moon
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.