linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Puranjay Mohan <puranjay12@gmail.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [Linux-kernel-mentees] [PATCH v6 2/2] PCI/ASPM: Add support for LTR _DSM
Date: Thu, 1 Oct 2020 17:17:41 -0500	[thread overview]
Message-ID: <20201001221741.GA2737641@bjorn-Precision-5520> (raw)
In-Reply-To: <20201001214436.2735412-3-helgaas@kernel.org>

On Thu, Oct 01, 2020 at 04:44:36PM -0500, Bjorn Helgaas wrote:
> From: Puranjay Mohan <puranjay12@gmail.com>
> 
> Latency Tolerance Reporting (LTR) is required for the ASPM L1.2 PM
> substate.  Devices with Upstream Ports (Endpoints and Switches) may support
> the optional LTR Capability.  When LTR is enabled, devices transmit LTR
> messages containing Snoop and No-Snoop Latencies upstream.  The L1.2
> substate may be entered if the most recent LTR values are greater than or
> equal to the LTR_L1.2_THRESHOLD from the L1 PM Substates Control 1
> register.
> 
> Add a new function pci_ltr_init() which will be called from
> pci_init_capabilities() to initialize every PCIe device's LTR values.
> Add code in probe.c to evaluate LTR _DSM and save the latencies in pci_dev.

> --- a/drivers/pci/probe.c
> +++ b/drivers/pci/probe.c
> @@ -2106,6 +2106,9 @@ static void pci_configure_ltr(struct pci_dev *dev)
>  	if (!pci_is_pcie(dev))
>  		return;
>  
> +	/* Read latency values (if any) from platform */
> +	pci_acpi_evaluate_ltr_latency(dev);
> +
>  	pcie_capability_read_dword(dev, PCI_EXP_DEVCAP2, &cap);
>  	if (!(cap & PCI_EXP_DEVCAP2_LTR))
>  		return;
> @@ -2400,6 +2403,7 @@ static void pci_init_capabilities(struct pci_dev *dev)
>  	pci_ptm_init(dev);		/* Precision Time Measurement */
>  	pci_aer_init(dev);		/* Advanced Error Reporting */
>  	pci_dpc_init(dev);		/* Downstream Port Containment */
> +	pci_ltr_init(dev);		/* Latency Tolerance Reporting */

I don't think we're doing this in quite the right order.  If I
understand correctly, we have this:

  pci_device_add
    pci_configure_device
      pci_configure_ltr
        pci_acpi_evaluate_ltr_latency
          acpi_evaluate_dsm(DSM_PCI_LTR_MAX_LATENCY)
        pcie_capability_set_word(PCI_EXP_DEVCTL2_LTR_EN)  <-- enable LTR
    pci_init_capabilities
      pci_ltr_init
        pci_write_config_word(PCI_LTR_MAX_SNOOP_LAT)  <-- set LTR msg content

So we enable LTR messages before we set the latency values in the LTR
capability.  I think we need to set the values *first*.

>  	pcie_report_downtraining(dev);
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

      reply	other threads:[~2020-10-01 22:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-01 21:44 [Linux-kernel-mentees] [PATCH v6 0/2] PCI/ASPM: Add support for LTR _DSM Bjorn Helgaas
2020-10-01 21:44 ` [Linux-kernel-mentees] [PATCH v6 1/2] PCI/ASPM: Rename encode_l12_threshold(), convert arg to ns Bjorn Helgaas
2020-10-01 21:44 ` [Linux-kernel-mentees] [PATCH v6 2/2] PCI/ASPM: Add support for LTR _DSM Bjorn Helgaas
2020-10-01 22:17   ` 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=20201001221741.GA2737641@bjorn-Precision-5520 \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=puranjay12@gmail.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;
as well as URLs for NNTP newsgroup(s).