[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230802190606.GA64564@bhelgaas>
Date: Wed, 2 Aug 2023 14:06:06 -0500
From: Bjorn Helgaas <helgaas@...nel.org>
To: Frank Li <Frank.li@....com>
Cc: mani@...nel.org, bhelgaas@...gle.com, devicetree@...r.kernel.org,
gustavo.pimentel@...opsys.com, imx@...ts.linux.dev, kw@...ux.com,
leoyang.li@....com, linux-arm-kernel@...ts.infradead.org,
linux-imx@....com, linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org, lorenzo.pieralisi@....com,
lpieralisi@...nel.org, manivannan.sadhasivam@...aro.org,
minghuan.lian@....com, mingkai.hu@....com, robh+dt@...nel.org,
roy.zang@....com, shawnguo@...nel.org, zhiqiang.hou@....com
Subject: Re: [PATCH v7 1/2] PCI: dwc: Implement general suspend/resume
functionality for L2/L3 transitions
On Wed, Aug 02, 2023 at 02:44:52PM -0400, Frank Li wrote:
> On Wed, Aug 02, 2023 at 11:31:38AM -0500, Bjorn Helgaas wrote:
> > On Wed, Aug 02, 2023 at 11:57:47AM -0400, Frank Li wrote:
> > > Introduce helper function dw_pcie_get_ltssm to retrieve SMLH_LTSS_STATE.
> > > Add callback .pme_turn_off and .exit_from_l2 for platform specific PME
> > > handling.
> > > + * PCI Express Base Specification Rev 4.0 Section 5.3.3.2.1 PME
> > > + * Synchronization Recommends 1ms to 10ms timeout to check L2 ready.
> > > + */
> > > + ret = read_poll_timeout(dw_pcie_get_ltssm, val, val == DW_PCIE_LTSSM_L2_IDLE,
> > > + 1000, 10000, false, pci);
> > It would really be great to have a #define for this since the bare
> > numbers are not very meaningful and they're not specific to DWC so a
> > #define would let us find similar situations in other drivers.
>
> how about define as
>
> #define PCI_PME_TO_L2_TIMEOUT 10000
>
> ret = read_poll_timeout(dw_pcie_get_ltssm, val, val == DW_PCIE_LTSSM_L2_IDLE,
> PCI_PME_TO_L2_TIMEOUT/10, PCI_PME_TO_L2_TIMEOUT, false, pci);
>
> where is good place PCI_PME_TO_L2_TIMEOUT in?
>
> pcie-designware.h or pci.h?
I think drivers/pci/pci.h since it's only useful inside drivers/pci,
and it's not specific to dwc.
Maybe "PCIE_" (not "PCI_") since this is a PCIe-specific thing.
You could put it next to PCIE_LINK_RETRAIN_TIMEOUT_MS and add a "_US"
suffix so we know what the units are.
Bjorn
Powered by blists - more mailing lists