[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <19D609EC-F850-4B43-A83C-0B8C70E641B5@kernel.org>
Date: Thu, 22 Jan 2026 17:59:18 +0100
From: Niklas Cassel <cassel@...nel.org>
To: Koichiro Den <den@...inux.co.jp>
CC: jingoohan1@...il.com, mani@...nel.org, lpieralisi@...nel.org,
kwilczynski@...nel.org, robh@...nel.org, bhelgaas@...gle.com,
vigneshr@...com, s-vadapalli@...com, hongxing.zhu@....com,
l.stach@...gutronix.de, shawnguo@...nel.org, s.hauer@...gutronix.de,
kernel@...gutronix.de, festevam@...il.com, minghuan.Lian@....com,
mingkai.hu@....com, roy.zang@....com, jesper.nilsson@...s.com,
heiko@...ech.de, srikanth.thokala@...el.com, marek.vasut+renesas@...il.com,
yoshihiro.shimoda.uh@...esas.com, geert+renesas@...der.be,
magnus.damm@...il.com, christian.bruel@...s.st.com,
mcoquelin.stm32@...il.com, alexandre.torgue@...s.st.com,
thierry.reding@...il.com, jonathanh@...dia.com,
hayashi.kunihiko@...ionext.com, mhiramat@...nel.org, kishon@...nel.org,
jirislaby@...nel.org, rongqianfeng@...o.com, 18255117159@....com,
shawn.lin@...k-chips.com, nicolas.frattaroli@...labora.com,
linux.amoon@...il.com, vidyas@...dia.com, Frank.Li@....com,
linux-omap@...r.kernel.org, linux-pci@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
imx@...ts.linux.dev, linuxppc-dev@...ts.ozlabs.org,
linux-arm-kernel@...s.com, linux-rockchip@...ts.infradead.org,
linux-arm-msm@...r.kernel.org, linux-renesas-soc@...r.kernel.org,
linux-stm32@...md-mailman.stormreply.com, linux-tegra@...r.kernel.org
Subject: Re: [PATCH v9 4/5] PCI: dwc: ep: Support BAR subrange inbound mapping via Address Match Mode iATU
On 22 January 2026 15:29:02 CET, Koichiro Den <den@...inux.co.jp> wrote:
>
>> To make sure that dw_pcie_ep_ib_atu_addr() cannot be called without already
>> having a BAR configured, to we perhaps want something like:
>
>Thanks for the review.
>Isn't the existing guard in dw_pcie_ep_ib_atu_addr sufficient?
>
> [...]
> base = dw_pcie_ep_read_bar_assigned(ep, func_no, bar, epf_bar->flags);
> if (!base) {
> dev_err(dev,
> "BAR%u not assigned, cannot set up sub-range mappings\n",
> bar);
> return -EINVAL;
> }
>
Well, for a driver that does not call dw_pcie_ep_reset_bar() in their .init() to disable all BARs that are enabled in the controller by default, the host side will assign an PCI address even if no EPF has called set_bar() on that BAR.
See e.g.
https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/commit/drivers/pci/controller/dwc/pcie-tegra194.c?h=controller/dwc&id=42f9c66a6d0cc45758dab77233c5460e1cf003df
There might be other EPC drivers that don't disable all BARs in their .init(), so I would say that simply checking if the BAR has an address is not sufficient to guarantee that an EPF driver has called set_bar().
I think the safest option is my second suggestion because then we know that we will only call
dw_pcie_ep_ib_atu_addr()
When:
1) If ep->epf_bar[bar] is set:
https://github.com/torvalds/linux/blob/v6.19-rc6/drivers/pci/controller/dwc/pcie-designware-ep.c#L363
2) All the other requirements to dynamically update a BAR is also met:
https://github.com/torvalds/linux/blob/v6.19-rc6/drivers/pci/controller/dwc/pcie-designware-ep.c#L368-L370
Kind regards,
Niklas
Powered by blists - more mailing lists