Skip to content

Commit f3e1dcc

Browse files
nxpfranklibjorn-helgaas
authored andcommitted
PCI: dwc: ep: Ensure proper iteration over outbound map windows
Most systems' PCIe outbound map windows have non-zero physical addresses, but the possibility of encountering zero increased after following commit ("PCI: dwc: Use parent_bus_offset"). 'ep->outbound_addr[n]', representing 'parent_bus_address', might be 0 on some hardware, which trims high address bits through bus fabric before sending to the PCIe controller. Replace the iteration logic with 'for_each_set_bit()' to ensure only allocated map windows are iterated when determining the ATU index from a given address. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Frank Li <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent f28b3c9 commit f3e1dcc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/pci/controller/dwc/pcie-designware-ep.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static int dw_pcie_find_index(struct dw_pcie_ep *ep, phys_addr_t addr,
282282
u32 index;
283283
struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
284284

285-
for (index = 0; index < pci->num_ob_windows; index++) {
285+
for_each_set_bit(index, ep->ob_window_map, pci->num_ob_windows) {
286286
if (ep->outbound_addr[index] != addr)
287287
continue;
288288
*atu_index = index;

0 commit comments

Comments
 (0)