Skip to contentSkip to conversation

drivers: pci: pcie_dw_common: add upper-limit to iATU

PATCH In review Ben Dooks 3 participants 4 messages Oct 20, 2022 – Dec 12, 2022 PCI

lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 drivers: pci: pcie_dw_common: add upper-limit to iATU

The 4.6 spec added an upper 32bits to the ATU limit, and since this driver is already assuming the unrolled feature added in the 4.8 specification this really should be set.

This is causing a bug with testing against the QEMU model as it defaults the viewports to fully open and not setting this causes the config viewport to become most of memory (obviously stopping the emulated system working correctly)

---
 drivers/pci/pcie_dw_common.c | 2 ++
 drivers/pci/pcie_dw_common.h | 1 +
 2 files changed, 3 insertions(+)
drivers/pci/pcie_dw_common.c +2 -0
index e66fb1490a..9f8b016d11 100644
@@ -73,6 +73,8 @@ int pcie_dw_prog_outbound_atu_unroll(struct pcie_dw *pci, int index,
 				 upper_32_bits(cpu_addr));
 	dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_LIMIT,
 				 lower_32_bits(cpu_addr + size - 1));
+	dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_UPPER_LIMIT,
+				 upper_32_bits(cpu_addr + size - 1));
 	dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_LOWER_TARGET,
 				 lower_32_bits(pci_addr));
 	dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_UPPER_TARGET,
drivers/pci/pcie_dw_common.h +1 -0
index 60bf966d5e..8ec6834fa1 100644
@@ -32,6 +32,7 @@
 #define PCIE_ATU_UNR_LIMIT		0x10
 #define PCIE_ATU_UNR_LOWER_TARGET	0x14
 #define PCIE_ATU_UNR_UPPER_TARGET	0x18
+#define PCIE_ATU_UNR_UPPER_LIMIT	0x20
 
 #define PCIE_ATU_REGION_INDEX2		(0x2 << 0)
 #define PCIE_ATU_REGION_INDEX1		(0x1 << 0)
Signature · 1 line
2.35.1
#1 lore raw

Hi Ben,

Quoted 6 lines · Ben Dooks

The 4.6 spec added an upper 32bits to the ATU limit, and since this driver is already assuming the unrolled feature added in the 4.8 specification this really should be set.

This is causing a bug with testing against the QEMU model as it

I guess you are testing QEMU sifive_u machine with some mods to add a DW PCIe controller, with U-Boot sifive_unmatched defconfig?

Could you please document the QEMU command line in the commit message?

Quoted 28 lines

defaults the viewports to fully open and not setting this causes the config viewport to become most of memory (obviously stopping the emulated system working correctly)

---
 drivers/pci/pcie_dw_common.c | 2 ++
 drivers/pci/pcie_dw_common.h | 1 +
 2 files changed, 3 insertions(+)
drivers/pci/pcie_dw_common.c +2 -0
index e66fb1490a..9f8b016d11 100644
@@ -73,6 +73,8 @@ int pcie_dw_prog_outbound_atu_unroll(struct pcie_dw *pci, int index,
                                 upper_32_bits(cpu_addr));
        dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_LIMIT,
                                 lower_32_bits(cpu_addr + size - 1));
+       dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_UPPER_LIMIT,
+                                upper_32_bits(cpu_addr + size - 1));
        dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_LOWER_TARGET,
                                 lower_32_bits(pci_addr));
        dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_UPPER_TARGET,
drivers/pci/pcie_dw_common.h +0 -0
index 60bf966d5e..8ec6834fa1 100644

drivers/pci/pcie_dw_common.h

Quoted 8 lines
drivers/pci/pcie_dw_common.h +1 -1
@@ -32,6 +32,7 @@
 #define PCIE_ATU_UNR_LIMIT             0x10
 #define PCIE_ATU_UNR_LOWER_TARGET      0x14
 #define PCIE_ATU_UNR_UPPER_TARGET      0x18
+#define PCIE_ATU_UNR_UPPER_LIMIT       0x20
 
 #define PCIE_ATU_REGION_INDEX2         (0x2 << 0)
 #define PCIE_ATU_REGION_INDEX1         (0x1 << 0)
--

Regards,
Bin

author
#2 lore raw
Quoted 8 lines · Bin Meng

Hi Ben,

Quoted 5 lines · Ben Dooks

The 4.6 spec added an upper 32bits to the ATU limit, and since this driver is already assuming the unrolled feature added in the 4.8 specification this really should be set.

Quoted 6 lines
Quoted 1 line

This is causing a bug with testing against the QEMU model as it

I guess you are testing QEMU sifive_u machine with some mods to add a DW PCIe controller, with U-Boot sifive_unmatched defconfig?

Could you please document the QEMU command line in the commit message?

Your guess is wrong, I'm not currently using the sifive_u. This is a test projec to test some of the work we've been doing updating the dw-pcie code for future work.

I'll try and sort out adding this to the sifive_u as an option but I expect that won't be until next week.

I am wondering whether to add a flag to say use viewport 2 for the config, as logging from the dw-pcie model is showing a lot of updates to windows setting, then restoring the IO view and I am guessing people aren't configuring minimal settings on the Synopsys designs...

Quoted 39 lines
Quoted 28 lines

defaults the viewports to fully open and not setting this causes the config viewport to become most of memory (obviously stopping the emulated system working correctly)

---
  drivers/pci/pcie_dw_common.c | 2 ++
  drivers/pci/pcie_dw_common.h | 1 +
  2 files changed, 3 insertions(+)
drivers/pci/pcie_dw_common.c +2 -0
index e66fb1490a..9f8b016d11 100644
@@ -73,6 +73,8 @@ int pcie_dw_prog_outbound_atu_unroll(struct pcie_dw *pci, int index,
                                  upper_32_bits(cpu_addr));
         dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_LIMIT,
                                  lower_32_bits(cpu_addr + size - 1));
+       dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_UPPER_LIMIT,
+                                upper_32_bits(cpu_addr + size - 1));
         dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_LOWER_TARGET,
                                  lower_32_bits(pci_addr));
         dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_UPPER_TARGET,
drivers/pci/pcie_dw_common.h +0 -0
index 60bf966d5e..8ec6834fa1 100644

drivers/pci/pcie_dw_common.h

Quoted 8 lines
drivers/pci/pcie_dw_common.h +1 -1
@@ -32,6 +32,7 @@
  #define PCIE_ATU_UNR_LIMIT             0x10
  #define PCIE_ATU_UNR_LOWER_TARGET      0x14
  #define PCIE_ATU_UNR_UPPER_TARGET      0x18
+#define PCIE_ATU_UNR_UPPER_LIMIT       0x20
 
  #define PCIE_ATU_REGION_INDEX2         (0x2 << 0)
  #define PCIE_ATU_REGION_INDEX1         (0x1 << 0)
--

Regards,
Bin

#3 lore raw
In reply to Ben Dooks
Quoted 10 lines · Ben Dooks

The 4.6 spec added an upper 32bits to the ATU limit, and since this driver is already assuming the unrolled feature added in the 4.8 specification this really should be set.

This is causing a bug with testing against the QEMU model as it defaults the viewports to fully open and not setting this causes the config viewport to become most of memory (obviously stopping the emulated system working correctly)

Applied to u-boot/next, thanks!

Signature · 1 line
Tom