On Fri, Feb 03, 2023 at 12:00:37PM +0800, Huacai Chen wrote: > Hi, Bjorn, > > On Fri, Feb 3, 2023 at 4:30 AM Bjorn Helgaas <helgaas@xxxxxxxxxx> wrote: > > > > On Thu, Feb 02, 2023 at 09:27:03PM +0800, Huacai Chen wrote: > > > On Thu, Feb 2, 2023 at 2:17 AM Bjorn Helgaas <helgaas@xxxxxxxxxx> wrote: > > > > On Wed, Feb 01, 2023 at 12:30:17PM +0800, Huacai Chen wrote: > > > > > > > +static void pcie_portdrv_shutdown(struct pci_dev *dev) > > > > > +{ > > > > > + if (pci_bridge_d3_possible(dev)) { > > > > > + pm_runtime_forbid(&dev->dev); > > > > > + pm_runtime_get_noresume(&dev->dev); > > > > > + pm_runtime_dont_use_autosuspend(&dev->dev); > > > > > + } > > > > > + > > > > > + pcie_port_device_remove(dev); > > > > > > > > Thanks! I guess you verified that this actually *does* call all the > > > > port service .remove() methods, right? aer_remove(), dpc_remove(), > > > > etc? > > > > > > I have tested, but aer_probe(), dpc_probe() doesn't get called at > > > boot, so does aer_remove(), dpc_remove() when poweroff. I haven't got > > > the root cause but I will continue to investigate. > > > > We'll only call aer_probe() and dpc_probe() if the port supports those > > services and the platform has granted us control of them. I don't > > know if your platform does. It may support PCIe native hotplug > > (pcie_hp_init()) or PME (pcie_pme_init()). > > When I use pcie_ports=native to boot kernel, I verified that > aer_remove() and pcie_pme_remove() are both called, while DPC and > HOTPLUG are both not supported. Great, thank you!