Re: [PATCH v3 1/2] PCI: Add D3cold as general reset method

From: Lukas Wunner

Date: Wed May 13 2026 - 10:55:45 EST


On Wed, May 13, 2026 at 02:23:48PM +0200, Jose Ignacio Tornos Martinez wrote:
> Add D3cold power cycle as a general PCI reset method, available for
> single-function devices. This provides a more robust reset mechanism
> than D3hot for devices where a full power cycle is beneficial.
>
> The implementation uses pci_set_power_state(dev, PCI_D3cold), which
> automatically handles platform differences:
> - Platforms WITH _PR3 ACPI power resources: true D3cold (power cycle)
> - Platforms WITHOUT _PR3: automatic fallback to D3hot transition

Why fall back to D3hot, even though the name of the reset method
suggests it uses D3cold? If D3cold isn't supported, I'd just not
expose the new reset method.

> Reset hierarchy with this change:
> 1. device_specific
> 2. acpi
> 3. flr
> 4. af_flr
> 5. pm (D3hot via config space)
> 6. bus (SBR)
> 7. cxl_bus
> 8. d3cold (NEW - power cycle with D3hot fallback)

I'd call it "powercycle" for clarity but that's just my preferred
bikeshed color.

> +static int pci_d3cold_reset(struct pci_dev *dev, bool probe)
> +{
> + int ret;
> +
> + if (dev->multifunction)
> + return -ENOTTY;
> +
> + if (probe) {
> + if (!pci_pr3_present(dev))
> + pci_dbg(dev, "d3cold reset: no _PR3 support, will use D3hot fallback\n");
> + return 0;
> + }

So I'd just return -ENOTTY here in the !pci_pr3_present() case
and I'd do that for probe == 0 as well.

Thanks,

Lukas