Re: [PATCH v10 08/10] PCI: dwc: Print warning message when cpu_addr_fixup() exists

From: Bjorn Helgaas
Date: Wed Mar 12 2025 - 18:04:34 EST


On Mon, Mar 10, 2025 at 04:16:46PM -0400, Frank Li wrote:
> If the parent 'ranges' property in DT correctly describes the address
> translation, the cpu_addr_fixup() callback is not needed. Print a warning
> message to inform users to correct their DT files.

> +++ b/drivers/pci/controller/dwc/pcie-designware.c
> @@ -1125,6 +1125,8 @@ int dw_pcie_init_parent_bus_offset(struct dw_pcie *pci, const char *reg_name,
>
> fixup = pci->ops->cpu_addr_fixup;
> if (fixup) {
> + dev_warn_once(pci->dev, "cpu_addr_fixup() usage detected. Please fix DT!\n");

I don't think we need this. The mere presence of .cpu_addr_fixup()
doesn't tell us the DT is broken. When we have .cpu_addr_fixup(), the
DT is only broken if DT tells us something different than
.cpu_addr_fixup() tells us. And we already warn about that in the
"reg_addr != fixup_addr" case.

> +
> fixup_addr = fixup(pci, cpu_phy_addr);
> if (reg_addr == fixup_addr) {
> dev_info(dev, "%#010llx %s reg[%d] == %#010llx; %ps is redundant\n",

This message is really just a hint that DT is fine and
.cpu_addr_fixup() is redundant but harmless. If you want a dev_warn()
here to encourage people to remove .cpu_addr_fixup(), I'm fine with
that.

Seems like "dev_warn()" would be enough, probably no need for
"dev_warn_once()" since we should only run this once per controller
anyway, so I don't think we'll get spammed with messages.