linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/9] PCI: qcom: Do not advertise hotplug capability
@ 2023-06-19 15:03 Manivannan Sadhasivam
  2023-06-19 15:04 ` [PATCH v4 1/9] PCI: qcom: Disable write access to read only registers for IP v2.3.3 Manivannan Sadhasivam
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Manivannan Sadhasivam @ 2023-06-19 15:03 UTC (permalink / raw)
  To: lpieralisi, kw, bhelgaas
  Cc: robh, andersson, konrad.dybcio, linux-pci, linux-arm-msm,
	linux-kernel, steev, quic_srichara, Manivannan Sadhasivam

Hi,

The SoCs making use of Qualcomm PCIe controllers do not support the PCIe hotplug
functionality. But the hotplug capability bit is set by default in the hardware.
This causes the kernel PCI core to register hotplug service for the controller
and send hotplug commands to it. But those commands will timeout generating
messages as below during boot and suspend/resume.
    
[    5.782159] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x03c0 (issued 2020 msec ago)
[    5.810161] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x03c0 (issued 2048 msec ago)
[    7.838162] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x07c0 (issued 2020 msec ago)
[    7.870159] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x07c0 (issued 2052 msec ago)
    
This not only spams the console output but also induces a delay of a couple of
seconds. To fix this issue, this series clears the HPC bit in PCI_EXP_SLTCAP
register as a part of the post init sequence for all IP versions to not
advertise the hotplug capability for the controller.

Testing
=======

This series has been tested on DB845c (SDM845 SoC) and Lenovo Thinkpad X13s
(SC8280XP SoC).

Thanks,
Mani

Changes in v4:

* Splitted patch 1/8 into two
* Rebased on top of pci/next

Changes in v3:

* Dropped double signed-off tags
* Dropped Dmitry's gmail reviewed tag as per his request
* Mentioned the newline change in commit log of patch 2/8

Changes in v2:

* Collected tags
* Moved the HPC clearing to a separate function and reused across different
  configs

Manivannan Sadhasivam (9):
  PCI: qcom: Disable write access to read only registers for IP v2.3.3
  PCI: qcom: Use DWC helpers for modifying the read-only DBI registers
  PCI: qcom: Disable write access to read only registers for IP v2.9.0
  PCI: qcom: Do not advertise hotplug capability for IPs v2.7.0 and
    v1.9.0
  PCI: qcom: Do not advertise hotplug capability for IPs v2.3.3 and
    v2.9.0
  PCI: qcom: Do not advertise hotplug capability for IP v2.3.2
  PCI: qcom: Use post init sequence of IP v2.3.2 for v2.4.0
  PCI: qcom: Do not advertise hotplug capability for IP v1.0.0
  PCI: qcom: Do not advertise hotplug capability for IP v2.1.0

 drivers/pci/controller/dwc/pcie-qcom.c | 73 ++++++++++++++------------
 1 file changed, 38 insertions(+), 35 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v4 1/9] PCI: qcom: Disable write access to read only registers for IP v2.3.3
  2023-06-19 15:03 [PATCH v4 0/9] PCI: qcom: Do not advertise hotplug capability Manivannan Sadhasivam
@ 2023-06-19 15:04 ` Manivannan Sadhasivam
  2023-06-19 15:04 ` [PATCH v4 2/9] PCI: qcom: Use DWC helpers for modifying the read-only DBI registers Manivannan Sadhasivam
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Manivannan Sadhasivam @ 2023-06-19 15:04 UTC (permalink / raw)
  To: lpieralisi, kw, bhelgaas
  Cc: robh, andersson, konrad.dybcio, linux-pci, linux-arm-msm,
	linux-kernel, steev, quic_srichara, Manivannan Sadhasivam,
	stable

In the post init sequence of v2.9.0, write access to read only registers
are not disabled after updating the registers. Fix it by disabling the
access after register update.

Cc: <stable@vger.kernel.org>
Fixes: 5d76117f070d ("PCI: qcom: Add support for IPQ8074 PCIe controller")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-qcom.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 4ab30892f6ef..ef385d36d653 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -836,6 +836,8 @@ static int qcom_pcie_post_init_2_3_3(struct qcom_pcie *pcie)
 	writel(PCI_EXP_DEVCTL2_COMP_TMOUT_DIS, pci->dbi_base + offset +
 		PCI_EXP_DEVCTL2);
 
+	dw_pcie_dbi_ro_wr_dis(pci);
+
 	return 0;
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 2/9] PCI: qcom: Use DWC helpers for modifying the read-only DBI registers
  2023-06-19 15:03 [PATCH v4 0/9] PCI: qcom: Do not advertise hotplug capability Manivannan Sadhasivam
  2023-06-19 15:04 ` [PATCH v4 1/9] PCI: qcom: Disable write access to read only registers for IP v2.3.3 Manivannan Sadhasivam
@ 2023-06-19 15:04 ` Manivannan Sadhasivam
  2023-06-19 15:04 ` [PATCH v4 3/9] PCI: qcom: Disable write access to read only registers for IP v2.9.0 Manivannan Sadhasivam
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Manivannan Sadhasivam @ 2023-06-19 15:04 UTC (permalink / raw)
  To: lpieralisi, kw, bhelgaas
  Cc: robh, andersson, konrad.dybcio, linux-pci, linux-arm-msm,
	linux-kernel, steev, quic_srichara, Manivannan Sadhasivam,
	Dmitry Baryshkov

DWC core already exposes dw_pcie_dbi_ro_wr_{en/dis} helper APIs for
enabling and disabling the write access to read only DBI registers. So
let's use them instead of doing it manually.

Also, the existing code doesn't disable the write access when it's done.
This is also fixed now.

Fixes: 5d76117f070d ("PCI: qcom: Add support for IPQ8074 PCIe controller")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-qcom.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index ef385d36d653..01795ee7ce45 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -61,7 +61,6 @@
 /* DBI registers */
 #define AXI_MSTR_RESP_COMP_CTRL0		0x818
 #define AXI_MSTR_RESP_COMP_CTRL1		0x81c
-#define MISC_CONTROL_1_REG			0x8bc
 
 /* MHI registers */
 #define PARF_DEBUG_CNT_PM_LINKST_IN_L2		0xc04
@@ -132,9 +131,6 @@
 /* AXI_MSTR_RESP_COMP_CTRL1 register fields */
 #define CFG_BRIDGE_SB_INIT			BIT(0)
 
-/* MISC_CONTROL_1_REG register fields */
-#define DBI_RO_WR_EN				1
-
 /* PCI_EXP_SLTCAP register fields */
 #define PCIE_CAP_SLOT_POWER_LIMIT_VAL		FIELD_PREP(PCI_EXP_SLTCAP_SPLV, 250)
 #define PCIE_CAP_SLOT_POWER_LIMIT_SCALE		FIELD_PREP(PCI_EXP_SLTCAP_SPLS, 1)
@@ -826,7 +822,9 @@ static int qcom_pcie_post_init_2_3_3(struct qcom_pcie *pcie)
 	writel(0, pcie->parf + PARF_Q2A_FLUSH);
 
 	writel(PCI_COMMAND_MASTER, pci->dbi_base + PCI_COMMAND);
-	writel(DBI_RO_WR_EN, pci->dbi_base + MISC_CONTROL_1_REG);
+
+	dw_pcie_dbi_ro_wr_en(pci);
+
 	writel(PCIE_CAP_SLOT_VAL, pci->dbi_base + offset + PCI_EXP_SLTCAP);
 
 	val = readl(pci->dbi_base + offset + PCI_EXP_LNKCAP);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 3/9] PCI: qcom: Disable write access to read only registers for IP v2.9.0
  2023-06-19 15:03 [PATCH v4 0/9] PCI: qcom: Do not advertise hotplug capability Manivannan Sadhasivam
  2023-06-19 15:04 ` [PATCH v4 1/9] PCI: qcom: Disable write access to read only registers for IP v2.3.3 Manivannan Sadhasivam
  2023-06-19 15:04 ` [PATCH v4 2/9] PCI: qcom: Use DWC helpers for modifying the read-only DBI registers Manivannan Sadhasivam
@ 2023-06-19 15:04 ` Manivannan Sadhasivam
  2023-06-19 15:04 ` [PATCH v4 4/9] PCI: qcom: Do not advertise hotplug capability for IPs v2.7.0 and v1.9.0 Manivannan Sadhasivam
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Manivannan Sadhasivam @ 2023-06-19 15:04 UTC (permalink / raw)
  To: lpieralisi, kw, bhelgaas
  Cc: robh, andersson, konrad.dybcio, linux-pci, linux-arm-msm,
	linux-kernel, steev, quic_srichara, Manivannan Sadhasivam,
	Dmitry Baryshkov

In the post init sequence of v2.9.0, write access to read only registers
are not disabled after updating the registers. Fix it by disabling the
access after register update.

While at it, let's also add a newline after existing dw_pcie_dbi_ro_wr_en()
guard function to align with rest of the driver.

Fixes: 0cf7c2efe8ac ("PCI: qcom: Add IPQ60xx support")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-qcom.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 01795ee7ce45..391a45d1e70a 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -1136,6 +1136,7 @@ static int qcom_pcie_post_init_2_9_0(struct qcom_pcie *pcie)
 	writel(0, pcie->parf + PARF_Q2A_FLUSH);
 
 	dw_pcie_dbi_ro_wr_en(pci);
+
 	writel(PCIE_CAP_SLOT_VAL, pci->dbi_base + offset + PCI_EXP_SLTCAP);
 
 	val = readl(pci->dbi_base + offset + PCI_EXP_LNKCAP);
@@ -1145,6 +1146,8 @@ static int qcom_pcie_post_init_2_9_0(struct qcom_pcie *pcie)
 	writel(PCI_EXP_DEVCTL2_COMP_TMOUT_DIS, pci->dbi_base + offset +
 			PCI_EXP_DEVCTL2);
 
+	dw_pcie_dbi_ro_wr_dis(pci);
+
 	for (i = 0; i < 256; i++)
 		writel(0, pcie->parf + PARF_BDF_TO_SID_TABLE_N + (4 * i));
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 4/9] PCI: qcom: Do not advertise hotplug capability for IPs v2.7.0 and v1.9.0
  2023-06-19 15:03 [PATCH v4 0/9] PCI: qcom: Do not advertise hotplug capability Manivannan Sadhasivam
                   ` (2 preceding siblings ...)
  2023-06-19 15:04 ` [PATCH v4 3/9] PCI: qcom: Disable write access to read only registers for IP v2.9.0 Manivannan Sadhasivam
@ 2023-06-19 15:04 ` Manivannan Sadhasivam
  2023-06-19 15:04 ` [PATCH v4 5/9] PCI: qcom: Do not advertise hotplug capability for IPs v2.3.3 and v2.9.0 Manivannan Sadhasivam
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Manivannan Sadhasivam @ 2023-06-19 15:04 UTC (permalink / raw)
  To: lpieralisi, kw, bhelgaas
  Cc: robh, andersson, konrad.dybcio, linux-pci, linux-arm-msm,
	linux-kernel, steev, quic_srichara, Manivannan Sadhasivam,
	Dmitry Baryshkov

SoCs making use of Qcom PCIe controller IPs v2.7.0 and v1.9.0 do not
support hotplug functionality. But the hotplug capability bit is set by
default in the hardware. This causes the kernel PCI core to register
hotplug service for the controller and send hotplug commands to it. But
those commands will timeout generating messages as below during boot and
suspend/resume.

[    5.782159] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x03c0 (issued 2020 msec ago)
[    5.810161] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x03c0 (issued 2048 msec ago)
[    7.838162] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x07c0 (issued 2020 msec ago)
[    7.870159] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x07c0 (issued 2052 msec ago)

This not only spams the console output but also induces a delay of a
couple of seconds. To fix this issue, let's clear the HPC bit in
PCI_EXP_SLTCAP register as a part of the post init sequence to not
advertise the hotplug capability for the controller.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-qcom.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 391a45d1e70a..8f448156eccc 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -270,6 +270,20 @@ static int qcom_pcie_start_link(struct dw_pcie *pci)
 	return 0;
 }
 
+static void qcom_pcie_clear_hpc(struct dw_pcie *pci)
+{
+	u16 offset = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);
+	u32 val;
+
+	dw_pcie_dbi_ro_wr_en(pci);
+
+	val = readl(pci->dbi_base + offset + PCI_EXP_SLTCAP);
+	val &= ~PCI_EXP_SLTCAP_HPC;
+	writel(val, pci->dbi_base + offset + PCI_EXP_SLTCAP);
+
+	dw_pcie_dbi_ro_wr_dis(pci);
+}
+
 static void qcom_pcie_2_1_0_ltssm_enable(struct qcom_pcie *pcie)
 {
 	u32 val;
@@ -966,6 +980,13 @@ static int qcom_pcie_init_2_7_0(struct qcom_pcie *pcie)
 	return ret;
 }
 
+static int qcom_pcie_post_init_2_7_0(struct qcom_pcie *pcie)
+{
+	qcom_pcie_clear_hpc(pcie->pci);
+
+	return 0;
+}
+
 static void qcom_pcie_deinit_2_7_0(struct qcom_pcie *pcie)
 {
 	struct qcom_pcie_resources_2_7_0 *res = &pcie->res.v2_7_0;
@@ -1272,6 +1293,7 @@ static const struct qcom_pcie_ops ops_2_3_3 = {
 static const struct qcom_pcie_ops ops_2_7_0 = {
 	.get_resources = qcom_pcie_get_resources_2_7_0,
 	.init = qcom_pcie_init_2_7_0,
+	.post_init = qcom_pcie_post_init_2_7_0,
 	.deinit = qcom_pcie_deinit_2_7_0,
 	.ltssm_enable = qcom_pcie_2_3_2_ltssm_enable,
 };
@@ -1280,6 +1302,7 @@ static const struct qcom_pcie_ops ops_2_7_0 = {
 static const struct qcom_pcie_ops ops_1_9_0 = {
 	.get_resources = qcom_pcie_get_resources_2_7_0,
 	.init = qcom_pcie_init_2_7_0,
+	.post_init = qcom_pcie_post_init_2_7_0,
 	.deinit = qcom_pcie_deinit_2_7_0,
 	.ltssm_enable = qcom_pcie_2_3_2_ltssm_enable,
 	.config_sid = qcom_pcie_config_sid_1_9_0,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 5/9] PCI: qcom: Do not advertise hotplug capability for IPs v2.3.3 and v2.9.0
  2023-06-19 15:03 [PATCH v4 0/9] PCI: qcom: Do not advertise hotplug capability Manivannan Sadhasivam
                   ` (3 preceding siblings ...)
  2023-06-19 15:04 ` [PATCH v4 4/9] PCI: qcom: Do not advertise hotplug capability for IPs v2.7.0 and v1.9.0 Manivannan Sadhasivam
@ 2023-06-19 15:04 ` Manivannan Sadhasivam
  2023-06-19 15:04 ` [PATCH v4 6/9] PCI: qcom: Do not advertise hotplug capability for IP v2.3.2 Manivannan Sadhasivam
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Manivannan Sadhasivam @ 2023-06-19 15:04 UTC (permalink / raw)
  To: lpieralisi, kw, bhelgaas
  Cc: robh, andersson, konrad.dybcio, linux-pci, linux-arm-msm,
	linux-kernel, steev, quic_srichara, Manivannan Sadhasivam,
	Dmitry Baryshkov

SoCs making use of Qcom PCIe controller IPs v2.3.3 and v2.9.0 do not
support hotplug functionality. But the hotplug capability bit is set by
default in the hardware. This causes the kernel PCI core to register
hotplug service for the controller and send hotplug commands to it. But
those commands will timeout generating messages as below during boot
and suspend/resume.

[    5.782159] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x03c0 (issued 2020 msec ago)
[    5.810161] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x03c0 (issued 2048 msec ago)
[    7.838162] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x07c0 (issued 2020 msec ago)
[    7.870159] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x07c0 (issued 2052 msec ago)

This not only spams the console output but also induces a delay of a
couple of seconds. To fix this issue, let's not set the HPC bit in
PCI_EXP_SLTCAP register as a part of the post init sequence to not
advertise the hotplug capability for the controller.

Tested-by: Sricharan Ramabadhran <quic_srichara@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-qcom.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 8f448156eccc..64b6a8c6a99d 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -140,7 +140,6 @@
 						PCI_EXP_SLTCAP_AIP | \
 						PCI_EXP_SLTCAP_PIP | \
 						PCI_EXP_SLTCAP_HPS | \
-						PCI_EXP_SLTCAP_HPC | \
 						PCI_EXP_SLTCAP_EIP | \
 						PCIE_CAP_SLOT_POWER_LIMIT_VAL | \
 						PCIE_CAP_SLOT_POWER_LIMIT_SCALE)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 6/9] PCI: qcom: Do not advertise hotplug capability for IP v2.3.2
  2023-06-19 15:03 [PATCH v4 0/9] PCI: qcom: Do not advertise hotplug capability Manivannan Sadhasivam
                   ` (4 preceding siblings ...)
  2023-06-19 15:04 ` [PATCH v4 5/9] PCI: qcom: Do not advertise hotplug capability for IPs v2.3.3 and v2.9.0 Manivannan Sadhasivam
@ 2023-06-19 15:04 ` Manivannan Sadhasivam
  2023-06-19 15:04 ` [PATCH v4 7/9] PCI: qcom: Use post init sequence of IP v2.3.2 for v2.4.0 Manivannan Sadhasivam
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Manivannan Sadhasivam @ 2023-06-19 15:04 UTC (permalink / raw)
  To: lpieralisi, kw, bhelgaas
  Cc: robh, andersson, konrad.dybcio, linux-pci, linux-arm-msm,
	linux-kernel, steev, quic_srichara, Manivannan Sadhasivam

SoCs making use of Qcom PCIe controller IP v2.3.2 do not support hotplug
functionality. But the hotplug capability bit is set by default in the
hardware. This causes the kernel PCI core to register hotplug service for
the controller and send hotplug commands to it. But those commands will
timeout generating messages as below during boot and suspend/resume.

[    5.782159] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x03c0 (issued 2020 msec ago)
[    5.810161] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x03c0 (issued 2048 msec ago)
[    7.838162] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x07c0 (issued 2020 msec ago)
[    7.870159] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x07c0 (issued 2052 msec ago)

This not only spams the console output but also induces a delay of a
couple of seconds. To fix this issue, let's clear the HPC bit in
PCI_EXP_SLTCAP register as a part of the post init sequence to not
advertise the hotplug capability for the controller.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-qcom.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 64b6a8c6a99d..9c8dfd224e6e 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -616,6 +616,8 @@ static int qcom_pcie_post_init_2_3_2(struct qcom_pcie *pcie)
 	val |= EN;
 	writel(val, pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
 
+	qcom_pcie_clear_hpc(pcie->pci);
+
 	return 0;
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 7/9] PCI: qcom: Use post init sequence of IP v2.3.2 for v2.4.0
  2023-06-19 15:03 [PATCH v4 0/9] PCI: qcom: Do not advertise hotplug capability Manivannan Sadhasivam
                   ` (5 preceding siblings ...)
  2023-06-19 15:04 ` [PATCH v4 6/9] PCI: qcom: Do not advertise hotplug capability for IP v2.3.2 Manivannan Sadhasivam
@ 2023-06-19 15:04 ` Manivannan Sadhasivam
  2023-06-19 15:04 ` [PATCH v4 8/9] PCI: qcom: Do not advertise hotplug capability for IP v1.0.0 Manivannan Sadhasivam
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Manivannan Sadhasivam @ 2023-06-19 15:04 UTC (permalink / raw)
  To: lpieralisi, kw, bhelgaas
  Cc: robh, andersson, konrad.dybcio, linux-pci, linux-arm-msm,
	linux-kernel, steev, quic_srichara, Manivannan Sadhasivam,
	Dmitry Baryshkov

The post init sequence of IP v2.4.0 is same as v2.3.2. So let's reuse the
v2.3.2 sequence which now also disables hotplug capability of the
controller as it is not at all supported on any SoCs making use of this IP.

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-qcom.c | 30 +-------------------------
 1 file changed, 1 insertion(+), 29 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 9c8dfd224e6e..e6db9e551752 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -703,34 +703,6 @@ static int qcom_pcie_init_2_4_0(struct qcom_pcie *pcie)
 	return 0;
 }
 
-static int qcom_pcie_post_init_2_4_0(struct qcom_pcie *pcie)
-{
-	u32 val;
-
-	/* enable PCIe clocks and resets */
-	val = readl(pcie->parf + PARF_PHY_CTRL);
-	val &= ~PHY_TEST_PWR_DOWN;
-	writel(val, pcie->parf + PARF_PHY_CTRL);
-
-	/* change DBI base address */
-	writel(0, pcie->parf + PARF_DBI_BASE_ADDR);
-
-	/* MAC PHY_POWERDOWN MUX DISABLE  */
-	val = readl(pcie->parf + PARF_SYS_CTRL);
-	val &= ~MAC_PHY_POWERDOWN_IN_P2_D_MUX_EN;
-	writel(val, pcie->parf + PARF_SYS_CTRL);
-
-	val = readl(pcie->parf + PARF_MHI_CLOCK_RESET_CTRL);
-	val |= BYPASS;
-	writel(val, pcie->parf + PARF_MHI_CLOCK_RESET_CTRL);
-
-	val = readl(pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
-	val |= EN;
-	writel(val, pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
-
-	return 0;
-}
-
 static int qcom_pcie_get_resources_2_3_3(struct qcom_pcie *pcie)
 {
 	struct qcom_pcie_resources_2_3_3 *res = &pcie->res.v2_3_3;
@@ -1276,7 +1248,7 @@ static const struct qcom_pcie_ops ops_2_3_2 = {
 static const struct qcom_pcie_ops ops_2_4_0 = {
 	.get_resources = qcom_pcie_get_resources_2_4_0,
 	.init = qcom_pcie_init_2_4_0,
-	.post_init = qcom_pcie_post_init_2_4_0,
+	.post_init = qcom_pcie_post_init_2_3_2,
 	.deinit = qcom_pcie_deinit_2_4_0,
 	.ltssm_enable = qcom_pcie_2_3_2_ltssm_enable,
 };
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 8/9] PCI: qcom: Do not advertise hotplug capability for IP v1.0.0
  2023-06-19 15:03 [PATCH v4 0/9] PCI: qcom: Do not advertise hotplug capability Manivannan Sadhasivam
                   ` (6 preceding siblings ...)
  2023-06-19 15:04 ` [PATCH v4 7/9] PCI: qcom: Use post init sequence of IP v2.3.2 for v2.4.0 Manivannan Sadhasivam
@ 2023-06-19 15:04 ` Manivannan Sadhasivam
  2023-06-19 15:04 ` [PATCH v4 9/9] PCI: qcom: Do not advertise hotplug capability for IP v2.1.0 Manivannan Sadhasivam
  2023-06-20 10:13 ` [PATCH v4 0/9] PCI: qcom: Do not advertise hotplug capability Lorenzo Pieralisi
  9 siblings, 0 replies; 11+ messages in thread
From: Manivannan Sadhasivam @ 2023-06-19 15:04 UTC (permalink / raw)
  To: lpieralisi, kw, bhelgaas
  Cc: robh, andersson, konrad.dybcio, linux-pci, linux-arm-msm,
	linux-kernel, steev, quic_srichara, Manivannan Sadhasivam

SoCs making use of Qcom PCIe controller IP v1.0.0 do not support hotplug
functionality. But the hotplug capability bit is set by default in the
hardware. This causes the kernel PCI core to register hotplug service for
the controller and send hotplug commands to it. But those commands will
timeout generating messages as below during boot and suspend/resume.

[    5.782159] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x03c0 (issued 2020 msec ago)
[    5.810161] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x03c0 (issued 2048 msec ago)
[    7.838162] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x07c0 (issued 2020 msec ago)
[    7.870159] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x07c0 (issued 2052 msec ago)

This not only spams the console output but also induces a delay of a
couple of seconds. To fix this issue, let's clear the HPC bit in
PCI_EXP_SLTCAP register as a part of the post init sequence to not
advertise the hotplug capability for the controller.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-qcom.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index e6db9e551752..612266fb849a 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -521,6 +521,8 @@ static int qcom_pcie_post_init_1_0_0(struct qcom_pcie *pcie)
 		writel(val, pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT);
 	}
 
+	qcom_pcie_clear_hpc(pcie->pci);
+
 	return 0;
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 9/9] PCI: qcom: Do not advertise hotplug capability for IP v2.1.0
  2023-06-19 15:03 [PATCH v4 0/9] PCI: qcom: Do not advertise hotplug capability Manivannan Sadhasivam
                   ` (7 preceding siblings ...)
  2023-06-19 15:04 ` [PATCH v4 8/9] PCI: qcom: Do not advertise hotplug capability for IP v1.0.0 Manivannan Sadhasivam
@ 2023-06-19 15:04 ` Manivannan Sadhasivam
  2023-06-20 10:13 ` [PATCH v4 0/9] PCI: qcom: Do not advertise hotplug capability Lorenzo Pieralisi
  9 siblings, 0 replies; 11+ messages in thread
From: Manivannan Sadhasivam @ 2023-06-19 15:04 UTC (permalink / raw)
  To: lpieralisi, kw, bhelgaas
  Cc: robh, andersson, konrad.dybcio, linux-pci, linux-arm-msm,
	linux-kernel, steev, quic_srichara, Manivannan Sadhasivam

SoCs making use of Qcom PCIe controller IP v2.1.0 do not support hotplug
functionality. But the hotplug capability bit is set by default in the
hardware. This causes the kernel PCI core to register hotplug service for
the controller and send hotplug commands to it. But those commands will
timeout generating messages as below during boot and suspend/resume.

[    5.782159] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x03c0 (issued 2020 msec ago)
[    5.810161] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x03c0 (issued 2048 msec ago)
[    7.838162] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x07c0 (issued 2020 msec ago)
[    7.870159] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x07c0 (issued 2052 msec ago)

This not only spams the console output but also induces a delay of a
couple of seconds. To fix this issue, let's clear the HPC bit in
PCI_EXP_SLTCAP register as a part of the post init sequence to not
advertise the hotplug capability for the controller.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
---
 drivers/pci/controller/dwc/pcie-qcom.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 612266fb849a..7a87a47eb7ed 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -438,6 +438,8 @@ static int qcom_pcie_post_init_2_1_0(struct qcom_pcie *pcie)
 	writel(CFG_BRIDGE_SB_INIT,
 	       pci->dbi_base + AXI_MSTR_RESP_COMP_CTRL1);
 
+	qcom_pcie_clear_hpc(pcie->pci);
+
 	return 0;
 }
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v4 0/9] PCI: qcom: Do not advertise hotplug capability
  2023-06-19 15:03 [PATCH v4 0/9] PCI: qcom: Do not advertise hotplug capability Manivannan Sadhasivam
                   ` (8 preceding siblings ...)
  2023-06-19 15:04 ` [PATCH v4 9/9] PCI: qcom: Do not advertise hotplug capability for IP v2.1.0 Manivannan Sadhasivam
@ 2023-06-20 10:13 ` Lorenzo Pieralisi
  9 siblings, 0 replies; 11+ messages in thread
From: Lorenzo Pieralisi @ 2023-06-20 10:13 UTC (permalink / raw)
  To: kw, bhelgaas, Manivannan Sadhasivam
  Cc: Lorenzo Pieralisi, robh, andersson, konrad.dybcio, linux-pci,
	linux-arm-msm, linux-kernel, steev, quic_srichara

On Mon, 19 Jun 2023 20:33:59 +0530, Manivannan Sadhasivam wrote:
> The SoCs making use of Qualcomm PCIe controllers do not support the PCIe hotplug
> functionality. But the hotplug capability bit is set by default in the hardware.
> This causes the kernel PCI core to register hotplug service for the controller
> and send hotplug commands to it. But those commands will timeout generating
> messages as below during boot and suspend/resume.
> 
> [    5.782159] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x03c0 (issued 2020 msec ago)
> [    5.810161] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x03c0 (issued 2048 msec ago)
> [    7.838162] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x07c0 (issued 2020 msec ago)
> [    7.870159] pcieport 0001:00:00.0: pciehp: Timeout on hotplug command 0x07c0 (issued 2052 msec ago)
> 
> [...]

Applied to controller/qcom, thanks!

[1/9] PCI: qcom: Disable write access to read only registers for IP v2.3.3
      https://git.kernel.org/pci/pci/c/a33d700e8eea
[2/9] PCI: qcom: Use DWC helpers for modifying the read-only DBI registers
      https://git.kernel.org/pci/pci/c/60f0072d7fb7
[3/9] PCI: qcom: Disable write access to read only registers for IP v2.9.0
      https://git.kernel.org/pci/pci/c/200b8f85f202
[4/9] PCI: qcom: Do not advertise hotplug capability for IPs v2.7.0 and v1.9.0
      https://git.kernel.org/pci/pci/c/a54db86ddc15
[5/9] PCI: qcom: Do not advertise hotplug capability for IPs v2.3.3 and v2.9.0
      https://git.kernel.org/pci/pci/c/11bce06b21a0
[6/9] PCI: qcom: Do not advertise hotplug capability for IP v2.3.2
      https://git.kernel.org/pci/pci/c/25966e78d303
[7/9] PCI: qcom: Use post init sequence of IP v2.3.2 for v2.4.0
      https://git.kernel.org/pci/pci/c/e35d13a5ff37
[8/9] PCI: qcom: Do not advertise hotplug capability for IP v1.0.0
      https://git.kernel.org/pci/pci/c/fa2dc2528684
[9/9] PCI: qcom: Do not advertise hotplug capability for IP v2.1.0
      https://git.kernel.org/pci/pci/c/1fdecc5bc8e8

Thanks,
Lorenzo

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-06-20 10:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-19 15:03 [PATCH v4 0/9] PCI: qcom: Do not advertise hotplug capability Manivannan Sadhasivam
2023-06-19 15:04 ` [PATCH v4 1/9] PCI: qcom: Disable write access to read only registers for IP v2.3.3 Manivannan Sadhasivam
2023-06-19 15:04 ` [PATCH v4 2/9] PCI: qcom: Use DWC helpers for modifying the read-only DBI registers Manivannan Sadhasivam
2023-06-19 15:04 ` [PATCH v4 3/9] PCI: qcom: Disable write access to read only registers for IP v2.9.0 Manivannan Sadhasivam
2023-06-19 15:04 ` [PATCH v4 4/9] PCI: qcom: Do not advertise hotplug capability for IPs v2.7.0 and v1.9.0 Manivannan Sadhasivam
2023-06-19 15:04 ` [PATCH v4 5/9] PCI: qcom: Do not advertise hotplug capability for IPs v2.3.3 and v2.9.0 Manivannan Sadhasivam
2023-06-19 15:04 ` [PATCH v4 6/9] PCI: qcom: Do not advertise hotplug capability for IP v2.3.2 Manivannan Sadhasivam
2023-06-19 15:04 ` [PATCH v4 7/9] PCI: qcom: Use post init sequence of IP v2.3.2 for v2.4.0 Manivannan Sadhasivam
2023-06-19 15:04 ` [PATCH v4 8/9] PCI: qcom: Do not advertise hotplug capability for IP v1.0.0 Manivannan Sadhasivam
2023-06-19 15:04 ` [PATCH v4 9/9] PCI: qcom: Do not advertise hotplug capability for IP v2.1.0 Manivannan Sadhasivam
2023-06-20 10:13 ` [PATCH v4 0/9] PCI: qcom: Do not advertise hotplug capability Lorenzo Pieralisi

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).