Re: [PATCH v2 01/17] PCI/DPC: Allocate the DPC save buffer during device setup

From: Lukas Wunner

Date: Sat Dec 05 2026 - 03:46:29 EST


On Fri, Dec 04, 2026 at 02:53:07PM -0800, David Matlack wrote:
> My plan is to keep reserving DPC Control in pci_dpc_init()

I'd be fine with that. An alternative approach would be to allow
multiple calls to pci_saved_caps_finalize() and have it reallocate
the buffer if necessary.

> and have
> pci_restore_dpc_state() skip the write unless the kernel owns DPC, via a
> flag set in dpc_probe() and cleared in dpc_remove(). That keeps today's
> behavior of restoring DPC Control only after the DPC service has bound
> to the port.

We've changed this cycle how the kernel decides whether to instantiate
a DPC port service: The check at the top of dpc_probe() is gone.
There's now only a check in get_port_device_capability() and it's very
small:

if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC) &&
host->native_dpc)
services |= PCIE_PORT_SERVICE_DPC;

So you don't need a new flag. You can just check for "pdev->dpc_cap &&
pci_find_host_bridge(pdev->bus)->native_dpc".

Those changes are queued on the pci/aer branch:

https://web.git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/log/?h=aer

> The one difference is that pci_save_state() would read DPC Control on
> every port with a DPC capability, since saving reads every reserved
> register. My understanding is that a read doesn't count as modifying the
> capability, but I could gate the save on the same flag if you'd prefer.

Either way is fine, but perhaps checking the flag is more consistent
since you have to check it in pci_restore_state() as well.

Thanks,

Lukas