Re: [PATCH v3 1/2] PCI: pciehp: Add support for async hotplug with native AER and DPC/EDR
From: Lukas Wunner
Date: Wed Jun 28 2023 - 09:30:44 EST
On Tue, Jun 27, 2023 at 10:48:37AM -0700, Smita Koralahalli wrote:
> On 6/22/2023 4:22 PM, Sathyanarayanan Kuppuswamy wrote:
> > On 6/21/23 11:51 AM, Smita Koralahalli wrote:
> > > +static void dpc_handle_surprise_removal(struct pci_dev *pdev)
> > > +{
> > > + if (pdev->dpc_rp_extensions && dpc_wait_rp_inactive(pdev)) {
> > > + pci_err(pdev, "failed to retrieve DPC root port on async remove\n");
> > > + goto out;
> > > + }
> > > +
> > > + pci_aer_raw_clear_status(pdev);
> > > + pci_clear_surpdn_errors(pdev);
> > > +
> > > + pci_write_config_word(pdev, pdev->dpc_cap + PCI_EXP_DPC_STATUS,
> > > + PCI_EXP_DPC_STATUS_TRIGGER);
> >
> > Don't you need to wait for the link to go down?
>
> Yes will include, pcie_wait_for_link()..
>
> Should this check be here or at the beginning of the function before we
> check pdev->dpc_rp_extensions?
I'd just use the same order as dpc_reset_link(), i.e. checking for
!pcie_wait_for_link() happens before the check for pdev->dpc_rp_extensions.
Thanks,
Lukas