[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKF3qh3gVoSfCg+83Kgrq4Pu4f6pSd2TUo+5XwTRZW4qTrkN2A@mail.gmail.com>
Date: Tue, 29 Sep 2020 10:32:34 +0800
From: Ethan Zhao <xerces.zhao@...il.com>
To: Christoph Hellwig <hch@...radead.org>
Cc: Ethan Zhao <haifeng.zhao@...el.com>,
Bjorn Helgaas <bhelgaas@...gle.com>, Oliver <oohall@...il.com>,
ruscur@...sell.cc, Lukas Wunner <lukas@...ner.de>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Stuart Hayes <stuart.w.hayes@...il.com>,
Alexandru Gagniuc <mr.nuke.me@...il.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
linux-pci <linux-pci@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"Jia, Pei P" <pei.p.jia@...el.com>, ashok.raj@...ux.intel.com,
Sathyanarayanan Kuppuswamy <sathyanarayanan.kuppuswamy@...el.com>
Subject: Re: [PATCH 1/5 V2] PCI: define a function to check and wait till port
finish DPC handling
Fixed this concern by moving the function to DPC driver and its
declaration to pci.h. see v5
Thanks,
Ethan
On Sun, Sep 27, 2020 at 2:27 PM Christoph Hellwig <hch@...radead.org> wrote:
>
> > +#ifdef CONFIG_PCIE_DPC
> > +static inline bool pci_wait_port_outdpc(struct pci_dev *pdev)
> > +{
> > + u16 cap = pdev->dpc_cap, status;
> > + u16 loop = 0;
> > +
> > + if (!cap) {
> > + pci_WARN_ONCE(pdev, !cap, "No DPC capability initiated\n");
> > + return false;
> > + }
> > + pci_read_config_word(pdev, cap + PCI_EXP_DPC_STATUS, &status);
> > + pci_dbg(pdev, "DPC status %x, cap %x\n", status, cap);
> > + while (status & PCI_EXP_DPC_STATUS_TRIGGER && loop < 100) {
> > + msleep(10);
> > + loop++;
> > + pci_read_config_word(pdev, cap + PCI_EXP_DPC_STATUS, &status);
> > + }
> > + if (!(status & PCI_EXP_DPC_STATUS_TRIGGER)) {
> > + pci_dbg(pdev, "Out of DPC %x, cost %d ms\n", status, loop*10);
> > + return true;
> > + }
> > + pci_dbg(pdev, "Timeout to wait port out of DPC status\n");
> > + return false;
> > +}
>
> I don't think that there is any good reason to have this as an
> inline function.
Powered by blists - more mailing lists