Re: [PATCH v7 2/2] PCI: Enable runtime pm of the host bridge

Johan Hovold
2025-01-07T13:19:22Z

On Mon, Nov 11, 2024 at 02:11:53PM +0530, Krishna chaitanya chundru wrote:
> The Controller driver is the parent device of the PCIe host bridge,
> PCI-PCI bridge and PCIe endpoint as shown below.
>
> PCIe controller(Top level parent & parent of host bridge)
> |
> v
> PCIe Host bridge(Parent of PCI-PCI bridge)
> |
> v
> PCI-PCI bridge(Parent of endpoint driver)
> |
> v
> PCIe endpoint driver
>
> Now, when the controller device goes to runtime suspend, PM framework
> will check the runtime PM state of the child device (host bridge) and
> will find it to be disabled. So it will allow the parent (controller
> device) to go to runtime suspend. Only if the child device's state was
> 'active' it will prevent the parent to get suspended.

> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>

> @@ -3106,6 +3106,17 @@ int pci_host_probe(struct pci_host_bridge *bridge)
> pcie_bus_configure_settings(child);
>
> pci_bus_add_devices(bus);
> +
> + /*
> + * Ensure pm_runtime_enable() is called for the controller drivers,
> + * before calling pci_host_probe() as pm frameworks expects if the
> + * parent device supports runtime pm then it needs to enabled before
> + * child runtime pm.
> + */
> + pm_runtime_set_active(&bridge->dev);
> + pm_runtime_no_callbacks(&bridge->dev);
> + devm_pm_runtime_enable(&bridge->dev);
> +
> return 0;
> }
> EXPORT_SYMBOL_GPL(pci_host_probe);

I just noticed that this change in 6.13-rc1 is causing the following
warning on resume from suspend on machines like the Lenovo ThinkPad
X13s:

pci0004:00: pcie4: Enabling runtime PM for inactive device with active children

which may have unpopulated ports (this laptop SKU does not have a modem).

Reverting dc421bb3c0db ("PCI: Enable runtime PM of the host bridge")
makes the warning go away.

Johan

#regzbot introduced: dc421bb3c0db