[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6dplmb2csjthlzbzqrca34a5px5osavj5ziij7snfyxbhpumlb@b4wupbsld7ph>
Date: Wed, 14 Jan 2026 01:07:36 +0900
From: Koichiro Den <den@...inux.co.jp>
To: Niklas Cassel <cassel@...nel.org>
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 v6 1/5] PCI: endpoint: Add BAR subrange mapping support
On Tue, Jan 13, 2026 at 11:13:59AM +0100, Niklas Cassel wrote:
> On Tue, Jan 13, 2026 at 11:37:11AM +0900, Koichiro Den wrote:
> > Extend the PCI endpoint core to support mapping subranges within a BAR.
> > Introduce a new 'submap' field and a 'use_submap' flag in struct
> > pci_epf_bar so an endpoint function driver can request inbound mappings
> > that fully cover the BAR.
> >
> > Add a subrange_mapping feature bit to struct pci_epc_features so EPC
> > drivers can explicitly advertise support. Make pci_epc_set_bar() reject
> > use_submap requests (-EINVAL) when the EPC does not advertise
> > subrange_mapping, to avoid silently accepting a configuration that the
> > controller cannot implement.
> >
> > The submap array describes the complete BAR layout (no overlaps and no
> > gaps are allowed to avoid exposing untranslated address ranges). This
> > provides the generic infrastructure needed to map multiple logical
> > regions into a single BAR at different offsets, without assuming a
> > controller-specific inbound address translation mechanism. Also, the
> > array must be sorted in ascending order by offset.
> >
> > Signed-off-by: Koichiro Den <den@...inux.co.jp>
> > ---
>
> I think this patch should be after the:
> "PCI: endpoint: Add dynamic_inbound_mapping EPC feature"
> patch...
>
>
> > drivers/pci/endpoint/pci-epc-core.c | 3 +++
> > include/linux/pci-epc.h | 3 +++
> > include/linux/pci-epf.h | 31 +++++++++++++++++++++++++++++
> > 3 files changed, 37 insertions(+)
> >
> > diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
> > index ca7f19cc973a..8d809a2c3ce9 100644
> > --- a/drivers/pci/endpoint/pci-epc-core.c
> > +++ b/drivers/pci/endpoint/pci-epc-core.c
> > @@ -596,6 +596,9 @@ int pci_epc_set_bar(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
> > if (!epc_features)
> > return -EINVAL;
> >
> > + if (epf_bar->use_submap && !epc_features->subrange_mapping)
> > + return -EINVAL;
Hi Niklas,
>
> ...then you can change this condition to:
>
> if (epf_bar->use_submap &&
> !(epc_features->dynamic_inbound_mapping &&
> epc_features->subrange_mapping))
> return -EINVAL;
Somehow this slipped my mind.. Thanks for pointing this out.
And I don't have any objections to the rest of the points you left comments
on v6 (patch ordering, splitting, and doc refinements).
I'll address them in v7.
Thank you for the detailed review.
Koichiro
>
>
> > +
> > if (epc_features->bar[bar].type == BAR_RESIZABLE &&
> > (epf_bar->size < SZ_1M || (u64)epf_bar->size > (SZ_128G * 1024)))
> > return -EINVAL;
> > diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h
> > index 4286bfdbfdfa..898a29e7d6f7 100644
> > --- a/include/linux/pci-epc.h
> > +++ b/include/linux/pci-epc.h
> > @@ -223,6 +223,8 @@ struct pci_epc_bar_desc {
> > /**
> > * struct pci_epc_features - features supported by a EPC device per function
> > * @linkup_notifier: indicate if the EPC device can notify EPF driver on link up
> > + * @subrange_mapping: indicate if the EPC device can map inbound subranges for a
> > + * BAR
>
> This text should probably also mention that this feature depends on the
> dynamic_inbound_mapping feature.
>
>
> With those comments fixed, looks good to me:
> Reviewed-by: Niklas Cassel <cassel@...nel.org>
Powered by blists - more mailing lists