Message ID | 20250310-pci_fixup_addr-v10-8-409dafc950d1@nxp.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | PCI: Use device bus range info to cleanup RC Host/EP pci_fixup_addr() | expand |
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.
On Wed, Mar 12, 2025 at 05:04:24PM -0500, Bjorn Helgaas wrote: > 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. It is encourage people to fix dts first and remove .cpu_addr_fixup(). Most case below "...redundant" is not printed at all at most case, even there are .cpu_addr_fixup(). > > > + > > 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. It is encourage people remove .cpu_addr_fixup() because dts already fixed. > > 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.
diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index 7061a7ec08cb2..3ab85dde22ce4 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ 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"); + fixup_addr = fixup(pci, cpu_phy_addr); if (reg_addr == fixup_addr) { dev_info(dev, "%#010llx %s reg[%d] == %#010llx; %ps is redundant\n",
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. Signed-off-by: Frank Li <Frank.Li@nxp.com> --- change from v9 to v10 - new patch --- drivers/pci/controller/dwc/pcie-designware.c | 2 ++ 1 file changed, 2 insertions(+)