Re: [PATCH v9 2/7] PCI: dwc: Rename cpu_addr to parent_bus_addr for ATU configuration

Bjorn Helgaas
2025-01-29T23:23:52Z

On Tue, Jan 28, 2025 at 05:07:35PM -0500, Frank Li wrote:
> Rename `cpu_addr` to `parent_bus_addr` in the DesignWare ATU configuration.
> The ATU translates parent bus addresses to PCI addresses, which are often
> the same as CPU addresses but can differ in systems where the bus fabric
> translates addresses before passing them to the PCIe controller. This
> renaming clarifies the purpose and avoids confusion.

Based on dw_pcie_ep_inbound_atu() below, I guess the ATU can also
translate PCI addresses from incoming DMA to parent bus addresses?

It's worth noting here that this patch only renames the member, and
IIUC, parent_bus_addr still incorrectly contains CPU physical
addresses.

> +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c
> @@ -128,7 +128,7 @@ static int dw_pcie_ep_write_header(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
> }
>
> static int dw_pcie_ep_inbound_atu(struct dw_pcie_ep *ep, u8 func_no, int type,
> - dma_addr_t cpu_addr, enum pci_barno bar,
> + dma_addr_t parent_bus_addr, enum pci_barno bar,
> size_t size)