public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Frank Li <Frank.li@nxp.com>
Cc: mani@kernel.org, bhelgaas@google.com, devicetree@vger.kernel.org,
	gustavo.pimentel@synopsys.com, imx@lists.linux.dev, kw@linux.com,
	leoyang.li@nxp.com, linux-arm-kernel@lists.infradead.org,
	linux-imx@nxp.com, linux-kernel@vger.kernel.org,
	linux-pci@vger.kernel.org, lorenzo.pieralisi@arm.com,
	lpieralisi@kernel.org, manivannan.sadhasivam@linaro.org,
	minghuan.lian@nxp.com, mingkai.hu@nxp.com, robh+dt@kernel.org,
	roy.zang@nxp.com, shawnguo@kernel.org, zhiqiang.hou@nxp.com
Subject: Re: [PATCH v7 1/2] PCI: dwc: Implement general suspend/resume functionality for L2/L3 transitions
Date: Wed, 2 Aug 2023 14:06:06 -0500	[thread overview]
Message-ID: <20230802190606.GA64564@bhelgaas> (raw)
In-Reply-To: <ZMqj/4Yc6U5YqmHJ@lizhi-Precision-Tower-5810>

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

      reply	other threads:[~2023-08-02 19:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02 15:57 [PATCH v7 1/2] PCI: dwc: Implement general suspend/resume functionality for L2/L3 transitions Frank Li
2023-08-02 15:57 ` [PATCH v7 2/2] PCI: layerscape: Add power management support for ls1028a Frank Li
2023-08-02 16:31 ` [PATCH v7 1/2] PCI: dwc: Implement general suspend/resume functionality for L2/L3 transitions Bjorn Helgaas
2023-08-02 18:44   ` Frank Li
2023-08-02 19:06     ` Bjorn Helgaas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230802190606.GA64564@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=Frank.li@nxp.com \
    --cc=bhelgaas@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gustavo.pimentel@synopsys.com \
    --cc=imx@lists.linux.dev \
    --cc=kw@linux.com \
    --cc=leoyang.li@nxp.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=minghuan.lian@nxp.com \
    --cc=mingkai.hu@nxp.com \
    --cc=robh+dt@kernel.org \
    --cc=roy.zang@nxp.com \
    --cc=shawnguo@kernel.org \
    --cc=zhiqiang.hou@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox