Skip to content

Commit 057f165

Browse files
committed
Revert "PCI: qcom: Remove custom ASPM enablement code"
This reverts commit a729c16. Prior to a729c16 ("PCI: qcom: Remove custom ASPM enablement code"), the qcom controller driver enabled ASPM, including L0s, L1, and L1 PM Substates, for all devices powered on at the time the controller driver enumerates them. ASPM was *not* enabled for devices powered on later by pwrctrl (unless the kernel was built with PCIEASPM_POWERSAVE or PCIEASPM_POWER_SUPERSAVE, or the user enabled ASPM via module parameter or sysfs). After f3ac2ff ("PCI/ASPM: Enable all ClockPM and ASPM states for devicetree platforms"), the PCI core enabled all ASPM states for all devices whether powered on initially or by pwrctrl, so a729c16 was unnecessary and reverted. But f3ac2ff was too aggressive and broke platforms that didn't support CLKREQ# or required device-specific configuration for L1 Substates, so df5192d ("PCI/ASPM: Enable only L0s and L1 for devicetree platforms") enabled only L0s and L1. On Qualcomm platforms, this left L1 Substates disabled, which was a regression. Revert a729c16 so L1 Substates will be enabled on devices that are initially powered on. Devices powered on by pwrctrl will be addressed later. Fixes: df5192d ("PCI/ASPM: Enable only L0s and L1 for devicetree platforms") Reported-by: Johan Hovold <johan@kernel.org> Closes: https://lore.kernel.org/lkml/aPuXZlaawFmmsLmX@hovoldconsulting.com/ Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Tested-by: Johan Hovold <johan@kernel.org> Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> Link: https://patch.msgid.link/20251024210514.1365996-1-helgaas@kernel.org
1 parent 3a86608 commit 057f165

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

drivers/pci/controller/dwc/pcie-qcom.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ struct qcom_pcie_ops {
262262
int (*get_resources)(struct qcom_pcie *pcie);
263263
int (*init)(struct qcom_pcie *pcie);
264264
int (*post_init)(struct qcom_pcie *pcie);
265+
void (*host_post_init)(struct qcom_pcie *pcie);
265266
void (*deinit)(struct qcom_pcie *pcie);
266267
void (*ltssm_enable)(struct qcom_pcie *pcie);
267268
int (*config_sid)(struct qcom_pcie *pcie);
@@ -1094,6 +1095,25 @@ static int qcom_pcie_post_init_2_7_0(struct qcom_pcie *pcie)
10941095
return 0;
10951096
}
10961097

1098+
static int qcom_pcie_enable_aspm(struct pci_dev *pdev, void *userdata)
1099+
{
1100+
/*
1101+
* Downstream devices need to be in D0 state before enabling PCI PM
1102+
* substates.
1103+
*/
1104+
pci_set_power_state_locked(pdev, PCI_D0);
1105+
pci_enable_link_state_locked(pdev, PCIE_LINK_STATE_ALL);
1106+
1107+
return 0;
1108+
}
1109+
1110+
static void qcom_pcie_host_post_init_2_7_0(struct qcom_pcie *pcie)
1111+
{
1112+
struct dw_pcie_rp *pp = &pcie->pci->pp;
1113+
1114+
pci_walk_bus(pp->bridge->bus, qcom_pcie_enable_aspm, NULL);
1115+
}
1116+
10971117
static void qcom_pcie_deinit_2_7_0(struct qcom_pcie *pcie)
10981118
{
10991119
struct qcom_pcie_resources_2_7_0 *res = &pcie->res.v2_7_0;
@@ -1380,9 +1400,19 @@ static void qcom_pcie_host_deinit(struct dw_pcie_rp *pp)
13801400
pcie->cfg->ops->deinit(pcie);
13811401
}
13821402

1403+
static void qcom_pcie_host_post_init(struct dw_pcie_rp *pp)
1404+
{
1405+
struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
1406+
struct qcom_pcie *pcie = to_qcom_pcie(pci);
1407+
1408+
if (pcie->cfg->ops->host_post_init)
1409+
pcie->cfg->ops->host_post_init(pcie);
1410+
}
1411+
13831412
static const struct dw_pcie_host_ops qcom_pcie_dw_ops = {
13841413
.init = qcom_pcie_host_init,
13851414
.deinit = qcom_pcie_host_deinit,
1415+
.post_init = qcom_pcie_host_post_init,
13861416
};
13871417

13881418
/* Qcom IP rev.: 2.1.0 Synopsys IP rev.: 4.01a */
@@ -1444,6 +1474,7 @@ static const struct qcom_pcie_ops ops_1_9_0 = {
14441474
.get_resources = qcom_pcie_get_resources_2_7_0,
14451475
.init = qcom_pcie_init_2_7_0,
14461476
.post_init = qcom_pcie_post_init_2_7_0,
1477+
.host_post_init = qcom_pcie_host_post_init_2_7_0,
14471478
.deinit = qcom_pcie_deinit_2_7_0,
14481479
.ltssm_enable = qcom_pcie_2_3_2_ltssm_enable,
14491480
.config_sid = qcom_pcie_config_sid_1_9_0,
@@ -1454,6 +1485,7 @@ static const struct qcom_pcie_ops ops_1_21_0 = {
14541485
.get_resources = qcom_pcie_get_resources_2_7_0,
14551486
.init = qcom_pcie_init_2_7_0,
14561487
.post_init = qcom_pcie_post_init_2_7_0,
1488+
.host_post_init = qcom_pcie_host_post_init_2_7_0,
14571489
.deinit = qcom_pcie_deinit_2_7_0,
14581490
.ltssm_enable = qcom_pcie_2_3_2_ltssm_enable,
14591491
};

0 commit comments

Comments
 (0)