Re: [PATCH v7 1/2] PCI: dwc: Implement general suspend/resume functionality for L2/L3 transitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux