Skip to content

Commit f176c47

Browse files
krishnachaitanya-linuxgregkh
authored andcommitted
PCI: qcom: Advertise Hotplug Slot Capability with no Command Completion support
[ Upstream commit 33a76fc ] Qcom PCIe Root Ports advertise hotplug capability in hardware, but do not support hotplug command completion. As a result, the hotplug commands issued by the pciehp driver never gets completion notification, leading to repeated timeout warnings and multi-second delays during boot and suspend/resume. Commit a54db86 ("PCI: qcom: Do not advertise hotplug capability for IPs v2.7.0 and v1.9.0") mistakenly assumed that the Root Ports doesn't support Hotplug due to timeouts and disabled the Hotplug functionality altogether. But the Root Ports does support reporting Hotplug events like DL_Up/Down events. So to fix the command completion timeout issues, just set the No Command Completed Support (NCCS) bit and enable Hotplug in Slot Capability field back. Fixes: a54db86 ("PCI: qcom: Do not advertise hotplug capability for IPs v2.7.0 and v1.9.0") Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com> [mani: renamed function, commit log and added comment] Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> Tested-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> # Hamoa CRD, tunneled link Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Link: https://patch.msgid.link/20260314-hotplug-v1-1-96ac87d93867@oss.qualcomm.com Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent cd3938c commit f176c47

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,20 @@ static void qcom_pcie_clear_aspm_l0s(struct dw_pcie *pci)
341341
dw_pcie_dbi_ro_wr_dis(pci);
342342
}
343343

344-
static void qcom_pcie_clear_hpc(struct dw_pcie *pci)
344+
static void qcom_pcie_set_slot_nccs(struct dw_pcie *pci)
345345
{
346346
u16 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);
347347
u32 val;
348348

349349
dw_pcie_dbi_ro_wr_en(pci);
350350

351+
/*
352+
* Qcom PCIe Root Ports do not support generating command completion
353+
* notifications for the Hot-Plug commands. So set the NCCS field to
354+
* avoid waiting for the completions.
355+
*/
351356
val = readl(pci->dbi_base + offset + PCI_EXP_SLTCAP);
352-
val &= ~PCI_EXP_SLTCAP_HPC;
357+
val |= PCI_EXP_SLTCAP_NCCS;
353358
writel(val, pci->dbi_base + offset + PCI_EXP_SLTCAP);
354359

355360
dw_pcie_dbi_ro_wr_dis(pci);
@@ -549,7 +554,7 @@ static int qcom_pcie_post_init_2_1_0(struct qcom_pcie *pcie)
549554
writel(CFG_BRIDGE_SB_INIT,
550555
pci->dbi_base + AXI_MSTR_RESP_COMP_CTRL1);
551556

552-
qcom_pcie_clear_hpc(pcie->pci);
557+
qcom_pcie_set_slot_nccs(pcie->pci);
553558

554559
return 0;
555560
}
@@ -629,7 +634,7 @@ static int qcom_pcie_post_init_1_0_0(struct qcom_pcie *pcie)
629634
writel(val, pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT);
630635
}
631636

632-
qcom_pcie_clear_hpc(pcie->pci);
637+
qcom_pcie_set_slot_nccs(pcie->pci);
633638

634639
return 0;
635640
}
@@ -722,7 +727,7 @@ static int qcom_pcie_post_init_2_3_2(struct qcom_pcie *pcie)
722727
val |= EN;
723728
writel(val, pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
724729

725-
qcom_pcie_clear_hpc(pcie->pci);
730+
qcom_pcie_set_slot_nccs(pcie->pci);
726731

727732
return 0;
728733
}
@@ -1028,7 +1033,7 @@ static int qcom_pcie_post_init_2_7_0(struct qcom_pcie *pcie)
10281033
writel(WR_NO_SNOOP_OVERRIDE_EN | RD_NO_SNOOP_OVERRIDE_EN,
10291034
pcie->parf + PARF_NO_SNOOP_OVERRIDE);
10301035

1031-
qcom_pcie_clear_hpc(pcie->pci);
1036+
qcom_pcie_set_slot_nccs(pcie->pci);
10321037

10331038
return 0;
10341039
}

0 commit comments

Comments
 (0)