From: Bjorn Helgaas <helgaas@kernel.org>
To: Niklas Cassel <cassel@kernel.org>
Cc: "Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Heiko Stuebner" <heiko@sntech.de>,
"Shawn Lin" <shawn.lin@rock-chips.com>,
"Kever Yang" <kever.yang@rock-chips.com>,
"Simon Xue" <xxm@rock-chips.com>,
"Damien Le Moal" <dlemoal@kernel.org>,
"Dragan Simic" <dsimic@manjaro.org>,
"FUKAUMI Naoki" <naoki@radxa.com>,
"Diederik de Haas" <diederik@cknow-tech.com>,
stable@vger.kernel.org,
"Manivannan Sadhasivam" <manivannan.sadhasivam@oss.qualcomm.com>,
"Daire McNamara" <daire.mcnamara@microchip.com>,
"Karthikeyan Mitran" <m.karthikeyan@mobiveil.co.in>,
"Hou Zhiqiang" <Zhiqiang.Hou@nxp.com>,
linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org
Subject: Re: [PATCH v3] PCI: dw-rockchip: Prevent advertising L1 Substates support
Date: Mon, 3 Nov 2025 15:32:06 -0600 [thread overview]
Message-ID: <20251103213206.GA1818418@bhelgaas> (raw)
In-Reply-To: <20251028190218.GA1525614@bhelgaas>
On Tue, Oct 28, 2025 at 02:02:18PM -0500, Bjorn Helgaas wrote:
> On Fri, Oct 17, 2025 at 06:32:53PM +0200, Niklas Cassel wrote:
> > The L1 substates support requires additional steps to work, namely:
> > -Proper handling of the CLKREQ# sideband signal. (It is mostly handled by
> > hardware, but software still needs to set the clkreq fields in the
> > PCIE_CLIENT_POWER_CON register to match the hardware implementation.)
> > -Program the frequency of the aux clock into the
> > DSP_PCIE_PL_AUX_CLK_FREQ_OFF register. (During L1 substates the core_clk
> > is turned off and the aux_clk is used instead.)
> ...
> > +static void rockchip_pcie_disable_l1sub(struct dw_pcie *pci)
> > +{
> > + u32 cap, l1subcap;
> > +
> > + cap = dw_pcie_find_ext_capability(pci, PCI_EXT_CAP_ID_L1SS);
> > + if (cap) {
> > + l1subcap = dw_pcie_readl_dbi(pci, cap + PCI_L1SS_CAP);
> > + l1subcap &= ~(PCI_L1SS_CAP_L1_PM_SS | PCI_L1SS_CAP_ASPM_L1_1 |
> > + PCI_L1SS_CAP_ASPM_L1_2 | PCI_L1SS_CAP_PCIPM_L1_1 |
> > + PCI_L1SS_CAP_PCIPM_L1_2);
> > + dw_pcie_writel_dbi(pci, cap + PCI_L1SS_CAP, l1subcap);
> > + }
> > +}
>
> I like this. But why should we do it just for dw-rockchip? Is there
> something special about dw-rockchip that makes this a problem? Maybe
> we should consider doing this in the dwc, cadence, mobiveil, and plda
> cores instead of trying to do it for every driver individually?
>
> Advertising L1SS support via PCI_EXT_CAP_ID_L1SS means users can
> enable L1SS via CONFIG_PCIEASPM_POWER_SUPERSAVE=y or sysfs, and that
> seems likely to cause problems unless CLKREQ# is supported.
Any thoughts on this? There's nothing rockchip-specific in this
patch. What I'm proposing is something like this:
PCI: dwc: Prevent advertising L1 PM Substates
L1 PM Substates require the CLKREF# signal and driver-specific support. If
CLKREF# is not supported or the driver support is lacking, enabling L1.1 or
L1.2 may cause errors when accessing devices, e.g.,
nvme nvme0: controller is down; will reset: CSTS=0xffffffff, PCI_STATUS=0x10
If both ends of a link advertise support for L1 PM Substates, and the
kernel is built with CONFIG_PCIEASPM_POWER_SUPERSAVE=y or users enable L1.x
via sysfs, Linux tries to enable them.
To prevent errors when L1.x may not work, disable advertising the L1 PM
Substates. Drivers can enable advertising them if they know CLKREF# is
present and the Root Port is configured correctly.
Based on Niklas's patch from
https://patch.msgid.link/20251017163252.598812-2-cassel@kernel.org
diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index 20c9333bcb1c..83b5330c9e45 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -950,6 +950,27 @@ static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp)
return 0;
}
+static void dw_pcie_clear_l1ss_advert(struct dw_pcie_rp *pp)
+{
+ struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+ u16 l1ss;
+ u32 l1ss_cap;
+
+ l1ss = dw_pcie_find_ext_capability(pci, PCI_EXT_CAP_ID_L1SS);
+ if (!l1ss)
+ return;
+
+ /*
+ * By default, don't advertise L1 PM Substates because they require
+ * CLKREF# and other driver-specific support.
+ */
+ l1ss_cap = dw_pcie_readl_dbi(pci, l1ss + PCI_L1SS_CAP);
+ l1ss_cap &= ~(PCI_L1SS_CAP_PCIPM_L1_1 | PCI_L1SS_CAP_ASPM_L1_1 |
+ PCI_L1SS_CAP_PCIPM_L1_2 | PCI_L1SS_CAP_ASPM_L1_2 |
+ PCI_L1SS_CAP_L1_PM_SS);
+ dw_pcie_writel_dbi(pci, l1ss + PCI_L1SS_CAP, l1ss_cap);
+}
+
static void dw_pcie_program_presets(struct dw_pcie_rp *pp, enum pci_bus_speed speed)
{
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
@@ -1060,6 +1081,7 @@ int dw_pcie_setup_rc(struct dw_pcie_rp *pp)
PCI_COMMAND_MASTER | PCI_COMMAND_SERR;
dw_pcie_writel_dbi(pci, PCI_COMMAND, val);
+ dw_pcie_clear_l1ss_advert(pp);
dw_pcie_config_presets(pp);
/*
* If the platform provides its own child bus config accesses, it means
next prev parent reply other threads:[~2025-11-03 21:32 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-17 16:32 [PATCH v3] PCI: dw-rockchip: Prevent advertising L1 Substates support Niklas Cassel
2025-10-17 16:45 ` Bjorn Helgaas
2025-10-18 5:07 ` Niklas Cassel
2025-10-21 2:32 ` Manivannan Sadhasivam
2025-11-04 12:30 ` Niklas Cassel
2025-10-20 5:53 ` FUKAUMI Naoki
2025-10-21 2:35 ` Manivannan Sadhasivam
2025-11-11 13:08 ` Niklas Cassel
2025-11-11 13:28 ` Shawn Lin
2025-11-11 21:43 ` Bjorn Helgaas
2025-11-12 8:40 ` Niklas Cassel
2025-10-28 19:02 ` Bjorn Helgaas
2025-11-03 21:32 ` Bjorn Helgaas [this message]
2025-11-04 0:58 ` Shawn Lin
2025-11-04 22:17 ` Bjorn Helgaas
2025-11-06 7:06 ` Manivannan Sadhasivam
2025-11-04 12:53 ` Niklas Cassel
2025-11-04 22:24 ` Bjorn Helgaas
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=20251103213206.GA1818418@bhelgaas \
--to=helgaas@kernel.org \
--cc=Zhiqiang.Hou@nxp.com \
--cc=bhelgaas@google.com \
--cc=cassel@kernel.org \
--cc=daire.mcnamara@microchip.com \
--cc=diederik@cknow-tech.com \
--cc=dlemoal@kernel.org \
--cc=dsimic@manjaro.org \
--cc=heiko@sntech.de \
--cc=kever.yang@rock-chips.com \
--cc=kwilczynski@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=lpieralisi@kernel.org \
--cc=m.karthikeyan@mobiveil.co.in \
--cc=mani@kernel.org \
--cc=manivannan.sadhasivam@oss.qualcomm.com \
--cc=naoki@radxa.com \
--cc=robh@kernel.org \
--cc=shawn.lin@rock-chips.com \
--cc=stable@vger.kernel.org \
--cc=xxm@rock-chips.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