Re: [PATCH v5 3/3] PCI: dwc: Fix missing iATU setup when ECAM is enabled

Damien Le Moal
2026-01-28T06:45:03Z

On 1/28/26 12:10 AM, Niklas Cassel wrote:
> From: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
>
> When ECAM is enabled, the driver skipped calling dw_pcie_iatu_setup()
> before configuring ECAM iATU entries. This left IO and MEM outbound
> windows unprogrammed, resulting in broken IO transactions. Additionally,
> dw_pcie_config_ecam_iatu() was only called during host initialization,
> so ECAM-related iATU entries were not restored after suspend/resume,
> leading to failures in configuration space access
>
> To resolve these issues, the ECAM iATU configuration is moved into
> dw_pcie_iatu_setup(), and dw_pcie_iatu_setup() is invoked when ECAM is
> enabled.
>
> Furthermore, error checks are added in dw_pcie_prog_outbound_atu() and
> dw_pcie_prog_inbound_atu() such that an error is returned if trying to
> program an iATU that is outside the number of iATUs provided by the
> controller.
>
> Fixes: f6fd357f7afb ("PCI: dwc: Prepare the driver for enabling ECAM mechanism using iATU 'CFG Shift Feature'")
> Cc: stable+noautosel@kernel.org # depends on Clean up iATU index usage in dw_pcie_iatu_setup()
> Reported-by: Maciej W. Rozycki <macro@orcam.me.uk>
> Closes: https://lore.kernel.org/all/alpine.DEB.2.21.2511280256260.36486@angie.orcam.me.uk/
> Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
> Co-developed-by: Niklas Cassel <cassel@kernel.org>
> Signed-off-by: Niklas Cassel <cassel@kernel.org>

Looks OK to me.
(one nit below)

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>

> @@ -915,8 +907,21 @@ static int dw_pcie_iatu_setup(struct dw_pcie_rp *pp)
> * NOTE: For outbound address translation, outbound iATU at index 0 is
> * reserved for CFG IOs (dw_pcie_other_conf_map_bus()), thus start at
> * index 1.
> + *
> + * If using ECAM, outbound iATU at index 0 and index 1 is reserved for

s/is/are

> + * CFG IOs.
> */
> - ob_iatu_index = 1;
> + if (pp->ecam_enabled) {
> + ob_iatu_index = 2;
> + ret = dw_pcie_config_ecam_iatu(pp);
> + if (ret) {
> + dev_err(pci->dev, "Failed to configure iATU in ECAM mode\n");
> + return ret;
> + }
> + } else {
> + ob_iatu_index = 1;
> + }
> +
> resource_list_for_each_entry(entry, &pp->bridge->windows) {
> resource_size_t res_size;

--
Damien Le Moal
Western Digital Research