Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] PCI: dwc: Split iATU windows at region limit boundaries
@ 2026-11-23 19:29 Han Gao via B4 Relay
  2026-11-23 19:35 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Han Gao via B4 Relay @ 2026-11-23 19:29 UTC (permalink / raw)
  To: Jingoo Han, Manivannan Sadhasivam, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Rob Herring, Bjorn Helgaas,
	Charles Mirabile, Randolph Lin, Frank Li, Samuel Holland,
	Niklas Cassel
  Cc: linux-pci, Han Gao, Han Gao

From: Han Gao <gaohan@iscas.ac.cn>

dw_pcie_iatu_setup() splits a large window into region_limit + 1 sized
chunks starting at the window base. If the window doesn't start on a
region_limit boundary, the first chunk crosses one, the iATU programming
helpers reject it and the host fails to probe.

Stop each chunk at the next boundary instead. Inbound windows have the
same problem.

Fixes: e9a5415adb20 ("PCI: dwc: Use multiple iATU windows for mapping large bridge windows and DMA ranges")
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
---
I hit this on a Zhihe A210, where the config and I/O windows sit at the
start of a 4 GiB aligned aperture and the memory window follows them.
---
 drivers/pci/controller/dwc/pcie-designware-host.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pci/controller/dwc/pcie-designware-host.c
index bbb02458af58..37f7a48bf4f6 100644
--- a/drivers/pci/controller/dwc/pcie-designware-host.c
+++ b/drivers/pci/controller/dwc/pcie-designware-host.c
@@ -952,7 +952,10 @@ static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp)
 			}
 
 			atu.index = ob_iatu_index;
-			atu.size = MIN(pci->region_limit + 1, res_size);
+			/* Don't cross a region_limit boundary */
+			atu.size = MIN(pci->region_limit + 1 -
+				       (atu.parent_bus_addr & pci->region_limit),
+				       res_size);
 
 			ret = dw_pcie_prog_outbound_atu(pci, &atu);
 			if (ret) {
@@ -1030,7 +1033,11 @@ static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp)
 				return -ENOMEM;
 			}
 
-			window_size = MIN(pci->region_limit + 1, res_size);
+			/* Don't cross a region_limit boundary */
+			window_size = MIN(pci->region_limit + 1 -
+					  ((res_start - entry->offset) &
+					   pci->region_limit),
+					  res_size);
 			ret = dw_pcie_prog_inbound_atu(pci, ib_iatu_index,
 						       PCIE_TLP_TYPE_MEM_RDWR, res_start,
 						       res_start - entry->offset, window_size);

---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
change-id: 20261124-dwc-iatu-boundary-c2e677c8a8c1

Best regards,
--  
Han Gao <gaohan@iscas.ac.cn>



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

* Re: [PATCH] PCI: dwc: Split iATU windows at region limit boundaries
  2026-11-23 19:29 [PATCH] PCI: dwc: Split iATU windows at region limit boundaries Han Gao via B4 Relay
@ 2026-11-23 19:35 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-23 19:35 UTC (permalink / raw)
  To: Han Gao; +Cc: linux-pci

> From: Han Gao <gaohan@iscas.ac.cn>
> 
> dw_pcie_iatu_setup() splits a large window into region_limit + 1 sized
> chunks starting at the window base. If the window doesn't start on a
> region_limit boundary, the first chunk crosses one, the iATU programming
> helpers reject it and the host fails to probe.
> 
> Stop each chunk at the next boundary instead. Inbound windows have the
> same problem.
> 
> Fixes: e9a5415adb20 ("PCI: dwc: Use multiple iATU windows for mapping large bridge windows and DMA ranges")
> Signed-off-by: Han Gao <gaohan@iscas.ac.cn>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-dwc-iatu-boundary-v1-1-03c8e58514e1@iscas.ac.cn?part=1

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

end of thread, other threads:[~2026-11-23 19:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-23 19:29 [PATCH] PCI: dwc: Split iATU windows at region limit boundaries Han Gao via B4 Relay
2026-11-23 19:35 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox