Re: [PATCH v3 1/2] PCI: dwc: Force L2 link entry on shutdown/reboot without D3cold check

From: Konrad Dybcio

Date: Mon Aug 24 2026 - 02:44:54 EST


On 8/24/26 7:34 AM, Krishna Chaitanya Chundru wrote:
> dw_pcie_suspend_noirq() normally calls pci_host_common_d3cold_possible()
> to check whether every downstream endpoint can be put into D3cold before
> bothering to move the link to L2. If no endpoint supports it, the
> function returns early and leaves the link up.

[...]

> int dw_pcie_suspend_noirq(struct dw_pcie *pci)
> {
> - bool pme_capable = false;
> + bool shutdown = system_state == SYSTEM_HALT ||
> + system_state == SYSTEM_POWER_OFF ||
> + system_state == SYSTEM_RESTART;
> + bool d3cold, pme_capable = false;
> int ret = 0;
> u32 val;
>
> if (!dw_pcie_link_up(pci))
> goto stop_link;
>
> - if (!pci_host_common_d3cold_possible(pci->pp.bridge, &pme_capable))
> + /*
> + * During reboot/halt/poweroff the link is going away regardless, so
> + * force L2 entry without checking whether endpoints have transitioned
> + * to D3hot -- there's no point walking the bus to find out.
> + */
> + if (shutdown)
> + goto d3cold;
> +
> + d3cold = pci_host_common_d3cold_possible(pci->pp.bridge, &pme_capable);
> + if (!d3cold)
> return 0;
>
> +d3cold:

I don't really see why we need a goto here, and I especially don't like
that the label is named the same as a nearby local variable.

Can the check above be simply changed to "if (!d3cold && !shutdown)"?

Konrad