public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Frank Li <Frank.li@nxp.com>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: "Bjorn Helgaas" <bhelgaas@google.com>,
	"Rob Herring" <robh@kernel.org>,
	"Saravana Kannan" <saravanak@google.com>,
	"Jingoo Han" <jingoohan1@gmail.com>,
	"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Richard Zhu" <hongxing.zhu@nxp.com>,
	"Lucas Stach" <l.stach@pengutronix.de>,
	"Shawn Guo" <shawnguo@kernel.org>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Pengutronix Kernel Team" <kernel@pengutronix.de>,
	"Fabio Estevam" <festevam@gmail.com>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	imx@lists.linux.dev, "Niklas Cassel" <cassel@kernel.org>
Subject: Re: [PATCH v11 10/11] PCI: dwc: Print warning message when cpu_addr_fixup() exists
Date: Thu, 12 Jun 2025 11:51:56 -0400	[thread overview]
Message-ID: <aEr3nGCqRuyIwA37@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <v77jy5tldwuasjzqirlwx45zigt6bpnaiz67e4w7r2lxqrdsek@5qzzobothf5r>

On Thu, Jun 12, 2025 at 08:16:03PM +0530, Manivannan Sadhasivam wrote:
> On Thu, Mar 13, 2025 at 11:38:46AM -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 DTB files and prepare to remove
> > cpu_addr_fixup().
> >
>
> This patch seem to have dropped, but I do see a value in printing the warning to
> encourage developers/users to fix the DTB in some way. Since we fixed the driver
> to parse the DT 'ranges' properly, the presence of cpu_addr_fixup() callback
> indicates that the translation is not properly described in DT. So DT has to be
> fixed.

This patch already in mainline with Bjorn's fine tuned at when merge.

	fixup = pci->ops ? pci->ops->cpu_addr_fixup : NULL;
        if (fixup) {
                fixup_addr = fixup(pci, cpu_phys_addr);
                if (reg_addr == fixup_addr) {
                        dev_info(dev, "%s reg[%d] %#010llx == %#010llx == fixup(cpu %#010llx); %ps is redundant with this devicetree\n",
                                 reg_name, index, reg_addr, fixup_addr,
                                 (unsigned long long) cpu_phys_addr, fixup);
                } else {
                        dev_warn(dev, "%s reg[%d] %#010llx != %#010llx == fixup(cpu %#010llx); devicetree is broken\n",
                                 reg_name, index, reg_addr, fixup_addr,
                                 (unsigned long long) cpu_phys_addr);
                        reg_addr = fixup_addr;
                }

                return cpu_phys_addr - reg_addr;
        }

I have not seen this "dev_warn(pci->dev, "cpu_addr_fixup() usage detected. Please fix your DTB!\n");"

Frank

>
> Bjorn, thoughts?
>
> - Mani
>
> > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> > ---
> > change from v10 to v11
> > - change to dev_warn()
> > - Bjorn: this is opitional patches to encourage user fix their dtb file.
> >
> > change from v9 to v10
> > - new patch
> > ---
> >  drivers/pci/controller/dwc/pcie-designware.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
> > index 8b546131b97f6..d4dc8bf06d4c1 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(pci->dev, "cpu_addr_fixup() usage detected. Please fix your DTB!\n");
> > +
> >  		fixup_addr = fixup(pci, cpu_phy_addr);
> >  		if (reg_addr == fixup_addr) {
> >  			dev_warn(dev, "%#010llx %s reg[%d] == %#010llx; %ps is redundant\n",
> >
> > --
> > 2.34.1
> >
>
> --
> மணிவண்ணன் சதாசிவம்


  reply	other threads:[~2025-06-13  0:24 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-13 15:38 [PATCH v11 00/11] PCI: Use device bus range info to cleanup RC Host/EP pci_fixup_addr() Frank Li
2025-03-13 15:38 ` [PATCH v11 01/11] PCI: dwc: Use resource start as iomap() input in dw_pcie_pme_turn_off() Frank Li
2025-03-13 15:38 ` [PATCH v11 02/11] PCI: dwc: Rename cpu_addr to parent_bus_addr for ATU configuration Frank Li
2025-03-13 15:38 ` [PATCH v11 03/11] PCI: dwc: Move cfg0 setup to dw_pcie_cfg0_setup() Frank Li
2025-03-13 15:38 ` [PATCH v11 04/11] PCI: dwc: Move devm_pci_alloc_host_bridge() to the beginning of dw_pcie_host_init() Frank Li
2025-03-13 19:22   ` Bjorn Helgaas
2025-03-13 20:45     ` Frank Li
2025-03-13 21:25       ` Bjorn Helgaas
2025-03-13 15:38 ` [PATCH v11 05/11] PCI: dwc: Add helper dw_pcie_init_parent_bus_offset() Frank Li
2025-03-13 15:38 ` [PATCH v11 06/11] PCI: dwc: Use devicetree 'ranges' property to get rid of cpu_addr_fixup() callback Frank Li
2025-03-13 22:04   ` Bjorn Helgaas
2025-03-13 22:56     ` Frank Li
2025-03-14 15:21       ` Frank Li
2025-03-14 22:10         ` Bjorn Helgaas
2025-03-14 23:21           ` Frank Li
2025-03-13 15:38 ` [PATCH v11 07/11] PCI: dwc: ep: Add parent_bus_addr for outbound window Frank Li
2025-03-13 15:38 ` [PATCH v11 08/11] PCI: dwc: ep: Ensure proper iteration over outbound map windows Frank Li
2025-03-13 15:38 ` [PATCH v11 09/11] PCI: dwc: Use parent_bus_offset Frank Li
2025-03-13 15:38 ` [PATCH v11 10/11] PCI: dwc: Print warning message when cpu_addr_fixup() exists Frank Li
2025-06-12 14:46   ` Manivannan Sadhasivam
2025-06-12 15:51     ` Frank Li [this message]
2025-06-12 16:08       ` Manivannan Sadhasivam
2025-06-12 16:19         ` Frank Li
2025-06-12 16:26           ` Manivannan Sadhasivam
2025-03-13 15:38 ` [PATCH v11 11/11] PCI: imx6: Remove cpu_addr_fixup() Frank Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aEr3nGCqRuyIwA37@lizhi-Precision-Tower-5810 \
    --to=frank.li@nxp.com \
    --cc=bhelgaas@google.com \
    --cc=cassel@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=hongxing.zhu@nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=jingoohan1@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=kw@linux.com \
    --cc=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=saravanak@google.com \
    --cc=shawnguo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox