From: Jian-Hong Pan <jhp@endlessos.org>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: "Johan Hovold" <johan@kernel.org>,
"David Box" <david.e.box@linux.intel.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Kuppuswamy Sathyanarayanan"
<sathyanarayanan.kuppuswamy@linux.intel.com>,
"Mika Westerberg" <mika.westerberg@linux.intel.com>,
"Damien Le Moal" <dlemoal@kernel.org>,
"Nirmal Patel" <nirmal.patel@linux.intel.com>,
"Jonathan Derrick" <jonathan.derrick@linux.dev>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
linux@endlessos.org, "Jian-Hong Pan" <jhp@endlessos.org>
Subject: [PATCH v8 3/4] PCI/ASPM: Introduce aspm_get_l1ss_cap()
Date: Fri, 19 Jul 2024 15:59:35 +0800 [thread overview]
Message-ID: <20240719075934.10950-2-jhp@endlessos.org> (raw)
In-Reply-To: <20240719075200.10717-2-jhp@endlessos.org>
Introduce aspm_get_l1ss_cap() which is extracted from aspm_l1ss_init() to
get the PCIe's L1SS capability. This does not change any behavior, but
aspm_get_l1ss_cap() can be reused later.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=218394
Signed-off-by: Jian-Hong Pan <jhp@endlessos.org>
Reviewed-by: David E. Box <david.e.box@linux.intel.com>
---
v6:
- Skipped
v7:
- Pick back
v8:
- The same
drivers/pci/pcie/aspm.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index bd0a8a05647e..5db1044c9895 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -611,6 +611,18 @@ static void pcie_aspm_check_latency(struct pci_dev *endpoint)
}
}
+static u32 aspm_get_l1ss_cap(struct pci_dev *pdev)
+{
+ u32 l1ss_cap;
+
+ pci_read_config_dword(pdev, pdev->l1ss + PCI_L1SS_CAP, &l1ss_cap);
+
+ if (!(l1ss_cap & PCI_L1SS_CAP_L1_PM_SS))
+ l1ss_cap = 0;
+
+ return l1ss_cap;
+}
+
/* Calculate L1.2 PM substate timing parameters */
static void aspm_calc_l12_info(struct pcie_link_state *link,
u32 parent_l1ss_cap, u32 child_l1ss_cap)
@@ -721,15 +733,8 @@ static void aspm_l1ss_init(struct pcie_link_state *link)
return;
/* Setup L1 substate */
- pci_read_config_dword(parent, parent->l1ss + PCI_L1SS_CAP,
- &parent_l1ss_cap);
- pci_read_config_dword(child, child->l1ss + PCI_L1SS_CAP,
- &child_l1ss_cap);
-
- if (!(parent_l1ss_cap & PCI_L1SS_CAP_L1_PM_SS))
- parent_l1ss_cap = 0;
- if (!(child_l1ss_cap & PCI_L1SS_CAP_L1_PM_SS))
- child_l1ss_cap = 0;
+ parent_l1ss_cap = aspm_get_l1ss_cap(parent);
+ child_l1ss_cap = aspm_get_l1ss_cap(child);
/*
* If we don't have LTR for the entire path from the Root Complex
--
2.45.2
next prev parent reply other threads:[~2024-07-19 8:00 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-19 7:52 [PATCH v8 0/4] PCI: vmd: Enable PCI PM's L1 substates of remapped PCIe Root Port and NVMe Jian-Hong Pan
2024-07-19 7:55 ` [PATCH v8 1/4] PCI: vmd: Set PCI devices to D0 before enable PCI PM's L1 substates Jian-Hong Pan
2024-07-19 7:57 ` [PATCH v8 2/4] PCI/ASPM: Add notes about enabling PCI-PM L1SS to pci_enable_link_state(_locked) Jian-Hong Pan
2024-07-19 7:59 ` Jian-Hong Pan [this message]
2024-07-19 8:02 ` [PATCH v8 4/4] PCI/ASPM: Fix L1.2 parameters when enable link state Jian-Hong Pan
2024-08-02 8:24 ` Jian-Hong Pan
2024-08-05 18:24 ` Nirmal Patel
2024-08-07 4:23 ` Jian-Hong Pan
2024-08-05 20:26 ` David E. Box
2024-08-07 10:05 ` Jian-Hong Pan
2024-08-07 11:18 ` Ilpo Järvinen
2024-08-07 23:27 ` David E. Box
2024-08-08 9:48 ` Ilpo Järvinen
2024-08-12 8:18 ` Jian-Hong Pan
2024-09-02 15:43 ` Ilpo Järvinen
2024-09-03 10:31 ` Jian-Hong Pan
2024-09-23 8:41 ` Jian-Hong Pan
2024-09-23 13:44 ` Ilpo Järvinen
2024-09-03 15:17 ` Nirmal Patel
2024-09-04 3:56 ` Jian-Hong Pan
2024-09-20 16:03 ` Nirmal Patel
2024-09-23 10:57 ` Jian-Hong Pan
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=20240719075934.10950-2-jhp@endlessos.org \
--to=jhp@endlessos.org \
--cc=david.e.box@linux.intel.com \
--cc=dlemoal@kernel.org \
--cc=helgaas@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=johan@kernel.org \
--cc=jonathan.derrick@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux@endlessos.org \
--cc=mika.westerberg@linux.intel.com \
--cc=nirmal.patel@linux.intel.com \
--cc=sathyanarayanan.kuppuswamy@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.