Skip to contentSkip to conversation

PCI: dwc: endpoint: Clear outbound address on unmap

PATCH Applied Damien Le Moal 4 participants 4 messages Oct 4, 2024 – Oct 27, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: dwc: endpoint: Clear outbound address on unmap

In addition to clearing the atu index bit in ob_window_map, also clear the address mapped (outbound_addr array) in dw_pcie_ep_unmap_addr(), to make sure that dw_pcie_find_index() does not endup matching again an ATU index that was already unmapped.

---
 drivers/pci/controller/dwc/pcie-designware-ep.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/dwc/pcie-designware-ep.c +1 -0
index 501e527c188e..7f4c082a2d90 100644
@@ -294,6 +294,7 @@ static void dw_pcie_ep_unmap_addr(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
 	if (ret < 0)
 		return;
 
+	ep->outbound_addr[atu_index] = 0;
 	dw_pcie_disable_atu(pci, PCIE_ATU_REGION_DIR_OB, atu_index);
 	clear_bit(atu_index, ep->ob_window_map);
 }
Signature · 1 line
2.46.2
#1 lore raw
Quoted 4 lines · Damien Le Moal

In addition to clearing the atu index bit in ob_window_map, also clear the address mapped (outbound_addr array) in dw_pcie_ep_unmap_addr(), to make sure that dw_pcie_find_index() does not endup matching again an ATU index that was already unmapped.

s/atu/ATU/ to match other usage
s/endup matching again/match/

No need to repost for this, whoever applies it can tweak it.

Quoted 20 lines
---
 drivers/pci/controller/dwc/pcie-designware-ep.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/dwc/pcie-designware-ep.c +1 -0
index 501e527c188e..7f4c082a2d90 100644
@@ -294,6 +294,7 @@ static void dw_pcie_ep_unmap_addr(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
 	if (ret < 0)
 		return;
 
+	ep->outbound_addr[atu_index] = 0;
 	dw_pcie_disable_atu(pci, PCIE_ATU_REGION_DIR_OB, atu_index);
 	clear_bit(atu_index, ep->ob_window_map);
 }
Signature · 1 line
2.46.2
Reviewed-by on v1 1/1
#2 lore raw
In reply to Damien Le Moal
Quoted 6 lines · Damien Le Moal

In addition to clearing the atu index bit in ob_window_map, also clear the address mapped (outbound_addr array) in dw_pcie_ep_unmap_addr(), to make sure that dw_pcie_find_index() does not endup matching again an ATU index that was already unmapped.

- Mani

Quoted 19 lines
---
 drivers/pci/controller/dwc/pcie-designware-ep.c | 1 +
 1 file changed, 1 insertion(+)
drivers/pci/controller/dwc/pcie-designware-ep.c +1 -0
index 501e527c188e..7f4c082a2d90 100644
@@ -294,6 +294,7 @@ static void dw_pcie_ep_unmap_addr(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
 	if (ret < 0)
 		return;
 
+	ep->outbound_addr[atu_index] = 0;
 	dw_pcie_disable_atu(pci, PCIE_ATU_REGION_DIR_OB, atu_index);
 	clear_bit(atu_index, ep->ob_window_map);
 }
Signature · 1 line
2.46.2
Signature · 1 line
மணிவண்ணன் சதாசிவம்
#3 lore raw
In reply to Damien Le Moal

Hello,

Quoted 4 lines

In addition to clearing the atu index bit in ob_window_map, also clear the address mapped (outbound_addr array) in dw_pcie_ep_unmap_addr(), to make sure that dw_pcie_find_index() does not endup matching again an ATU index that was already unmapped.

Applied to controller/dwc, thank you!

[1/1] PCI: dwc: endpoint: Clear outbound address on unmap

      https://git.kernel.org/pci/pci/c/12dd12821f1e

	Krzysztof