Skip to contentSkip to conversation

PCI: qcom: configure the parf halt window size to 1GB

PATCH In review Devi Priya 3 participants 6 messages Jun 23, 2023 – Jul 10, 2023

Subsystems (4)
lore
Share & tools
lore

Devi Priya

author
#0 lore raw

PATCH 1/1 PCI: qcom: configure the parf halt window size to 1GB

Configure the ADDR_BIT_INDEX of PARF_AXI_MSTR_WR_ADDR_HALT_V2 register with 0x1E to increase the halt window size to 1GB so that, when new inbound posted write transactions whose address crosses 1G address range, the controller would halt all the incoming writes until all the previous AXI responses are received.

---
This patch depends on the below series which adds support for PCIe controllers in IPQ9574
https://lore.kernel.org/linux-arm-msm/[email protected]/

 drivers/pci/controller/dwc/pcie-qcom.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/pci/controller/dwc/pcie-qcom.c +9 -0
index c7579dfa5b1c..26c40e006120 100644
@@ -116,6 +116,8 @@
 
 /* PARF_AXI_MSTR_WR_ADDR_HALT register fields */
 #define EN					BIT(31)
+#define ADDR_BIT_INDEX				(BIT(0) | BIT(1) | BIT(2) | \
+						BIT(3) | BIT(4) | BIT(5))
 
 /* PARF_LTSSM register fields */
 #define LTSSM_EN				BIT(8)
@@ -154,6 +156,8 @@
 
 #define QCOM_PCIE_CRC8_POLYNOMIAL		(BIT(2) | BIT(1) | BIT(0))
 
+#define PARF_AXI_MSTR_WR_ADDR_HALT_WINDOW_SIZE	0x1e
+
 #define QCOM_PCIE_1_0_0_MAX_CLOCKS		4
 struct qcom_pcie_resources_1_0_0 {
 	struct clk_bulk_data clks[QCOM_PCIE_1_0_0_MAX_CLOCKS];
@@ -1126,6 +1130,11 @@ static int qcom_pcie_post_init(struct qcom_pcie *pcie)
 
 	writel(0, pcie->parf + PARF_Q2A_FLUSH);
 
+	val = readl(pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
+	val &= ~ADDR_BIT_INDEX;
+	writel(val | PARF_AXI_MSTR_WR_ADDR_HALT_WINDOW_SIZE, pcie->parf +
+			PARF_AXI_MSTR_WR_ADDR_HALT_V2);
+
 	dw_pcie_dbi_ro_wr_en(pci);
 	writel(PCIE_CAP_SLOT_VAL, pci->dbi_base + offset + PCI_EXP_SLTCAP);
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 8 lines · Devi Priya

Configure the ADDR_BIT_INDEX of PARF_AXI_MSTR_WR_ADDR_HALT_V2 register with 0x1E to increase the halt window size to 1GB so that, when new inbound posted write transactions whose address crosses 1G address range, the controller would halt all the incoming writes until all the previous AXI responses are received.

---

Has this been tested on anything except IPQ9574? Does it concern other SoCs?

Quoted 12 lines

This patch depends on the below series which adds support for PCIe controllers in IPQ9574
https://lore.kernel.org/linux-arm-msm/[email protected]/

 drivers/pci/controller/dwc/pcie-qcom.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/pci/controller/dwc/pcie-qcom.c +0 -0
index c7579dfa5b1c..26c40e006120 100644

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

Quoted 5 lines
drivers/pci/controller/dwc/pcie-qcom.c +2 -0
@@ -116,6 +116,8 @@
 
 /* PARF_AXI_MSTR_WR_ADDR_HALT register fields */
 #define EN					BIT(31)
+#define ADDR_BIT_INDEX				(BIT(0) | BIT(1) | BIT(2) | \
+						BIT(3) | BIT(4) | BIT(5))

You surely should have the names of these bitfields, mind defining them?

Quoted 13 lines
drivers/pci/controller/dwc/pcie-qcom.c +2 -0
 /* PARF_LTSSM register fields */
 #define LTSSM_EN				BIT(8)
@@ -154,6 +156,8 @@
 
 #define QCOM_PCIE_CRC8_POLYNOMIAL		(BIT(2) | BIT(1) | BIT(0))
 
+#define PARF_AXI_MSTR_WR_ADDR_HALT_WINDOW_SIZE	0x1e
+
 #define QCOM_PCIE_1_0_0_MAX_CLOCKS		4
 struct qcom_pcie_resources_1_0_0 {
 	struct clk_bulk_data clks[QCOM_PCIE_1_0_0_MAX_CLOCKS];

drivers/pci/controller/dwc/pcie-qcom.c static int qcom_pcie_post_init(struct qcom_pcie *pcie) · line 1136

Quoted 7 lines
drivers/pci/controller/dwc/pcie-qcom.c +4 -0
@@ -1126,6 +1130,11 @@ static int qcom_pcie_post_init(struct qcom_pcie *pcie)
 
 	writel(0, pcie->parf + PARF_Q2A_FLUSH);
 
+	val = readl(pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
+	val &= ~ADDR_BIT_INDEX;
+	writel(val | PARF_AXI_MSTR_WR_ADDR_HALT_WINDOW_SIZE, pcie->parf +
+			PARF_AXI_MSTR_WR_ADDR_HALT_V2);

val |= ..
writel(val, pcie..)

would be more readable

Konrad

Quoted 4 lines
drivers/pci/controller/dwc/pcie-qcom.c +1 -0
+
 	dw_pcie_dbi_ro_wr_en(pci);
 	writel(PCIE_CAP_SLOT_VAL, pci->dbi_base + offset + PCI_EXP_SLTCAP);
 
author
#2 lore raw
Quoted 11 lines · Konrad Dybcio
Quoted 8 lines · Devi Priya

Configure the ADDR_BIT_INDEX of PARF_AXI_MSTR_WR_ADDR_HALT_V2 register with 0x1E to increase the halt window size to 1GB so that, when new inbound posted write transactions whose address crosses 1G address range, the controller would halt all the incoming writes until all the previous AXI responses are received.

---

Has this been tested on anything except IPQ9574? Does it concern other SoCs?

This has been tested on IPQ6018 as well.

Quoted 15 lines
Quoted 15 lines

This patch depends on the below series which adds support for PCIe controllers in IPQ9574
https://lore.kernel.org/linux-arm-msm/[email protected]/

  drivers/pci/controller/dwc/pcie-qcom.c | 9 +++++++++
  1 file changed, 9 insertions(+)
drivers/pci/controller/dwc/pcie-qcom.c +0 -0
index c7579dfa5b1c..26c40e006120 100644
@@ -116,6 +116,8 @@
 
Quoted 5 lines

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

Quoted 4 lines
drivers/pci/controller/dwc/pcie-qcom.c +2 -0
  /* PARF_AXI_MSTR_WR_ADDR_HALT register fields */
  #define EN					BIT(31)
+#define ADDR_BIT_INDEX				(BIT(0) | BIT(1) | BIT(2) | \
+						BIT(3) | BIT(4) | BIT(5))

You surely should have the names of these bitfields, mind defining them?

Will use GENMASK(5, 0) as suggested by Mani

Quoted 17 lines
Quoted 17 lines
drivers/pci/controller/dwc/pcie-qcom.c +2 -0
  /* PARF_LTSSM register fields */
  #define LTSSM_EN				BIT(8)
@@ -154,6 +156,8 @@
 
  #define QCOM_PCIE_CRC8_POLYNOMIAL		(BIT(2) | BIT(1) | BIT(0))
 
+#define PARF_AXI_MSTR_WR_ADDR_HALT_WINDOW_SIZE	0x1e
+
  #define QCOM_PCIE_1_0_0_MAX_CLOCKS		4
  struct qcom_pcie_resources_1_0_0 {
  	struct clk_bulk_data clks[QCOM_PCIE_1_0_0_MAX_CLOCKS];
@@ -1126,6 +1130,11 @@ static int qcom_pcie_post_init(struct qcom_pcie *pcie)
 
  	writel(0, pcie->parf + PARF_Q2A_FLUSH);
 
Quoted 8 lines

drivers/pci/controller/dwc/pcie-qcom.c static int qcom_pcie_post_init(struct qcom_pcie *pcie) · line 1136

Quoted 4 lines
drivers/pci/controller/dwc/pcie-qcom.c +4 -0
+	val = readl(pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
+	val &= ~ADDR_BIT_INDEX;
+	writel(val | PARF_AXI_MSTR_WR_ADDR_HALT_WINDOW_SIZE, pcie->parf +
+			PARF_AXI_MSTR_WR_ADDR_HALT_V2);

val |= ..
writel(val, pcie..)

would be more readable

Okay

Thanks,
Devi Priya

Quoted 6 lines

Konrad

Quoted 4 lines
drivers/pci/controller/dwc/pcie-qcom.c +1 -0
+
  	dw_pcie_dbi_ro_wr_en(pci);
  	writel(PCIE_CAP_SLOT_VAL, pci->dbi_base + offset + PCI_EXP_SLTCAP);
 
#3 lore raw
In reply to Devi Priya
Quoted 6 lines · Devi Priya

Configure the ADDR_BIT_INDEX of PARF_AXI_MSTR_WR_ADDR_HALT_V2 register with 0x1E to increase the halt window size to 1GB so that, when new inbound posted write transactions whose address crosses 1G address range, the controller would halt all the incoming writes until all the previous AXI responses are received.

Can you explain how the value of 0x1e corresponds to 1GB window size?

Quoted 14 lines

---
This patch depends on the below series which adds support for PCIe controllers in IPQ9574
https://lore.kernel.org/linux-arm-msm/[email protected]/

 drivers/pci/controller/dwc/pcie-qcom.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/pci/controller/dwc/pcie-qcom.c +0 -0
index c7579dfa5b1c..26c40e006120 100644

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

Quoted 5 lines
drivers/pci/controller/dwc/pcie-qcom.c +2 -0
@@ -116,6 +116,8 @@
 
 /* PARF_AXI_MSTR_WR_ADDR_HALT register fields */
 #define EN					BIT(31)
+#define ADDR_BIT_INDEX				(BIT(0) | BIT(1) | BIT(2) | \
+						BIT(3) | BIT(4) | BIT(5))

GENMASK(5, 0)

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

Quoted 8 lines
drivers/pci/controller/dwc/pcie-qcom.c +1 -0
 /* PARF_LTSSM register fields */
 #define LTSSM_EN				BIT(8)
@@ -154,6 +156,8 @@
 
 #define QCOM_PCIE_CRC8_POLYNOMIAL		(BIT(2) | BIT(1) | BIT(0))
 
+#define PARF_AXI_MSTR_WR_ADDR_HALT_WINDOW_SIZE	0x1e

GENMASK(4, 1) as these are address bits.

- Mani

Quoted 19 lines
drivers/pci/controller/dwc/pcie-qcom.c +6 -0
+
 #define QCOM_PCIE_1_0_0_MAX_CLOCKS		4
 struct qcom_pcie_resources_1_0_0 {
 	struct clk_bulk_data clks[QCOM_PCIE_1_0_0_MAX_CLOCKS];
@@ -1126,6 +1130,11 @@ static int qcom_pcie_post_init(struct qcom_pcie *pcie)
 
 	writel(0, pcie->parf + PARF_Q2A_FLUSH);
 
+	val = readl(pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
+	val &= ~ADDR_BIT_INDEX;
+	writel(val | PARF_AXI_MSTR_WR_ADDR_HALT_WINDOW_SIZE, pcie->parf +
+			PARF_AXI_MSTR_WR_ADDR_HALT_V2);
+
 	dw_pcie_dbi_ro_wr_en(pci);
 	writel(PCIE_CAP_SLOT_VAL, pci->dbi_base + offset + PCI_EXP_SLTCAP);
 
Signature · 1 line
2.17.1
Signature · 1 line
மணிவண்ணன் சதாசிவம்
author
#4 lore raw
Quoted 9 lines · Manivannan Sadhasivam
Quoted 6 lines · Devi Priya

Configure the ADDR_BIT_INDEX of PARF_AXI_MSTR_WR_ADDR_HALT_V2 register with 0x1E to increase the halt window size to 1GB so that, when new inbound posted write transactions whose address crosses 1G address range, the controller would halt all the incoming writes until all the previous AXI responses are received.

Can you explain how the value of 0x1e corresponds to 1GB window size?

2^30 (0x1e) = 1G

Quoted 16 lines
Quoted 16 lines

---
This patch depends on the below series which adds support for PCIe controllers in IPQ9574
https://lore.kernel.org/linux-arm-msm/[email protected]/

  drivers/pci/controller/dwc/pcie-qcom.c | 9 +++++++++
  1 file changed, 9 insertions(+)
drivers/pci/controller/dwc/pcie-qcom.c +0 -0
index c7579dfa5b1c..26c40e006120 100644
@@ -116,6 +116,8 @@
 
Quoted 6 lines

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

Quoted 4 lines
drivers/pci/controller/dwc/pcie-qcom.c +2 -0
  /* PARF_AXI_MSTR_WR_ADDR_HALT register fields */
  #define EN					BIT(31)
+#define ADDR_BIT_INDEX				(BIT(0) | BIT(1) | BIT(2) | \
+						BIT(3) | BIT(4) | BIT(5))

GENMASK(5, 0)

okay

Quoted 11 lines

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

Quoted 9 lines
drivers/pci/controller/dwc/pcie-qcom.c +1 -0
  /* PARF_LTSSM register fields */
  #define LTSSM_EN				BIT(8)
@@ -154,6 +156,8 @@
 
  #define QCOM_PCIE_CRC8_POLYNOMIAL		(BIT(2) | BIT(1) | BIT(0))
 
+#define PARF_AXI_MSTR_WR_ADDR_HALT_WINDOW_SIZE	0x1e

GENMASK(4, 1) as these are address bits.

okay

Thanks,
Devi Priya

Quoted 23 lines

- Mani

Quoted 19 lines
drivers/pci/controller/dwc/pcie-qcom.c +6 -0
+
  #define QCOM_PCIE_1_0_0_MAX_CLOCKS		4
  struct qcom_pcie_resources_1_0_0 {
  	struct clk_bulk_data clks[QCOM_PCIE_1_0_0_MAX_CLOCKS];
@@ -1126,6 +1130,11 @@ static int qcom_pcie_post_init(struct qcom_pcie *pcie)
 
  	writel(0, pcie->parf + PARF_Q2A_FLUSH);
 
+	val = readl(pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
+	val &= ~ADDR_BIT_INDEX;
+	writel(val | PARF_AXI_MSTR_WR_ADDR_HALT_WINDOW_SIZE, pcie->parf +
+			PARF_AXI_MSTR_WR_ADDR_HALT_V2);
+
  	dw_pcie_dbi_ro_wr_en(pci);
  	writel(PCIE_CAP_SLOT_VAL, pci->dbi_base + offset + PCI_EXP_SLTCAP);
 
Signature · 1 line
2.17.1
#5 lore raw
Quoted 11 lines · Devi Priya
Quoted 8 lines · Manivannan Sadhasivam
Quoted 6 lines · Devi Priya

Configure the ADDR_BIT_INDEX of PARF_AXI_MSTR_WR_ADDR_HALT_V2 register with 0x1E to increase the halt window size to 1GB so that, when new inbound posted write transactions whose address crosses 1G address range, the controller would halt all the incoming writes until all the previous AXI responses are received.

Quoted 3 lines
Quoted 1 line

Can you explain how the value of 0x1e corresponds to 1GB window size?

2^30 (0x1e) = 1G

Quoted 1 line

So 0x1e selects 2^30 in the hardware? If so, please document it in the commit message.

- Mani

Quoted 53 lines
Quoted 9 lines
Quoted 9 lines

---
This patch depends on the below series which adds support for PCIe controllers in IPQ9574
https://lore.kernel.org/linux-arm-msm/[email protected]/

  drivers/pci/controller/dwc/pcie-qcom.c | 9 +++++++++
  1 file changed, 9 insertions(+)
Quoted 11 lines

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

Quoted 9 lines
drivers/pci/controller/dwc/pcie-qcom.c +2 -0
index c7579dfa5b1c..26c40e006120 100644
@@ -116,6 +116,8 @@
  /* PARF_AXI_MSTR_WR_ADDR_HALT register fields */
  #define EN					BIT(31)
+#define ADDR_BIT_INDEX				(BIT(0) | BIT(1) | BIT(2) | \
+						BIT(3) | BIT(4) | BIT(5))

GENMASK(5, 0)

okay

Quoted 8 lines

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

Quoted 6 lines
drivers/pci/controller/dwc/pcie-qcom.c +1 -0
  /* PARF_LTSSM register fields */
  #define LTSSM_EN				BIT(8)
@@ -154,6 +156,8 @@
  #define QCOM_PCIE_CRC8_POLYNOMIAL		(BIT(2) | BIT(1) | BIT(0))
+#define PARF_AXI_MSTR_WR_ADDR_HALT_WINDOW_SIZE	0x1e

GENMASK(4, 1) as these are address bits.

okay

Thanks,
Devi Priya

Quoted 20 lines

- Mani

Quoted 16 lines
drivers/pci/controller/dwc/pcie-qcom.c +6 -0
+
  #define QCOM_PCIE_1_0_0_MAX_CLOCKS		4
  struct qcom_pcie_resources_1_0_0 {
  	struct clk_bulk_data clks[QCOM_PCIE_1_0_0_MAX_CLOCKS];
@@ -1126,6 +1130,11 @@ static int qcom_pcie_post_init(struct qcom_pcie *pcie)
  	writel(0, pcie->parf + PARF_Q2A_FLUSH);
+	val = readl(pcie->parf + PARF_AXI_MSTR_WR_ADDR_HALT_V2);
+	val &= ~ADDR_BIT_INDEX;
+	writel(val | PARF_AXI_MSTR_WR_ADDR_HALT_WINDOW_SIZE, pcie->parf +
+			PARF_AXI_MSTR_WR_ADDR_HALT_V2);
+
  	dw_pcie_dbi_ro_wr_en(pci);
  	writel(PCIE_CAP_SLOT_VAL, pci->dbi_base + offset + PCI_EXP_SLTCAP);
Signature · 1 line
2.17.1
Signature · 1 line
மணிவண்ணன் சதாசிவம்