From: Bjorn Helgaas <helgaas@kernel.org>
To: Frank Li <Frank.Li@nxp.com>
Cc: "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>,
"Bjorn Helgaas" <bhelgaas@google.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 v10 05/10] PCI: dwc: Use devicetree 'ranges' property to get rid of cpu_addr_fixup() callback
Date: Wed, 12 Mar 2025 16:37:57 -0500 [thread overview]
Message-ID: <20250312213757.GA709739@bhelgaas> (raw)
In-Reply-To: <20250310-pci_fixup_addr-v10-5-409dafc950d1@nxp.com>
On Mon, Mar 10, 2025 at 04:16:43PM -0400, Frank Li wrote:
> parent_bus_offset in resource_entry can indicate address information just
> ahead of PCIe controller. Most system's bus fabric use 1:1 map between
> input and output address. but some hardware like i.MX8QXP doesn't use 1:1
> map. See below diagram:
> +++ b/drivers/pci/controller/dwc/pcie-designware-host.c
> @@ -478,6 +478,15 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
> bridge->ops = &dw_pcie_ops;
> bridge->child_ops = &dw_child_pcie_ops;
>
> + /*
> + * visconti_pcie_cpu_addr_fixup() use pp->io_base,
> + * so have to call dw_pcie_init_parent_bus_offset() after init
> + * pp->io_base.
> + */
> + ret = dw_pcie_init_parent_bus_offset(pci, "config", pp->cfg0_base);
> + if (ret)
> + return ret;
The ordering in dw_pcie_host_init() doesn't look right to me. We have
this:
dw_pcie_host_init
dw_pcie_get_resources
dw_pcie_cfg0_setup
devm_pci_alloc_host_bridge
win = resource_list_first_type(&bridge->windows, IORESOURCE_IO)
pp->io_base = pci_pio_to_address(win->res->start)
bridge->ops = ...
bridge->child_ops = ...
dw_pcie_init_parent_bus_offset
pp->ops->init
devm_pci_alloc_host_bridge() is generic, so it obviously can't depend
on any dwc-specific things. I think the ordering should be more like
this:
dw_pcie_host_init
devm_pci_alloc_host_bridge # generic
dw_pcie_get_resources # dwc RP and EP
dw_pcie_cfg0_setup
win = resource_list_first_type(&bridge->windows, IORESOURCE_IO)
pp->io_base = pci_pio_to_address(win->res->start)
dw_pcie_init_parent_bus_offset
bridge->ops = ...
bridge->child_ops = ...
pp->ops->init
and everything in the second block (dw_pcie_cfg0_setup() through
dw_pcie_init_parent_bus_offset()) is strictly DT-related resource
setup and could all go in a dw_pcie_host_get_resources() or similar.
> if (pp->ops->init) {
> ret = pp->ops->init(pp);
> if (ret)
>
> --
> 2.34.1
>
next prev parent reply other threads:[~2025-03-12 21:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-10 20:16 [PATCH v10 00/10] PCI: Use device bus range info to cleanup RC Host/EP pci_fixup_addr() Frank Li
2025-03-10 20:16 ` [PATCH v10 01/10] PCI: dwc: Use resource start as iomap() input in dw_pcie_pme_turn_off() Frank Li
2025-03-10 20:16 ` [PATCH v10 02/10] PCI: dwc: Rename cpu_addr to parent_bus_addr for ATU configuration Frank Li
2025-03-10 20:16 ` [PATCH v10 03/10] PCI: dwc: Move cfg0 setup to dw_pcie_cfg0_setup() Frank Li
2025-03-10 20:16 ` [PATCH v10 04/10] PCI: dwc: Add helper dw_pcie_init_parent_bus_offset() Frank Li
2025-03-12 22:16 ` Bjorn Helgaas
2025-03-10 20:16 ` [PATCH v10 05/10] PCI: dwc: Use devicetree 'ranges' property to get rid of cpu_addr_fixup() callback Frank Li
2025-03-12 21:37 ` Bjorn Helgaas [this message]
2025-03-13 14:17 ` Frank Li
2025-03-10 20:16 ` [PATCH v10 06/10] PCI: dwc: ep: Add parent_bus_addr for outbound window Frank Li
2025-03-10 20:16 ` [PATCH v10 07/10] PCI: dwc: Use parent_bus_offset Frank Li
2025-03-10 20:16 ` [PATCH v10 08/10] PCI: dwc: Print warning message when cpu_addr_fixup() exists Frank Li
2025-03-12 22:04 ` Bjorn Helgaas
2025-03-13 14:32 ` Frank Li
2025-03-10 20:16 ` [PATCH v10 09/10] PCI: dwc: ep: Ensure proper iteration over outbound map windows Frank Li
2025-03-12 21:47 ` Bjorn Helgaas
2025-03-13 14:27 ` Frank Li
2025-03-10 20:16 ` [PATCH v10 10/10] 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=20250312213757.GA709739@bhelgaas \
--to=helgaas@kernel.org \
--cc=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=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;
as well as URLs for NNTP newsgroup(s).