From: Frank Li <Frank.li@nxp.com>
To: Koichiro Den <den@valinux.co.jp>
Cc: jingoohan1@gmail.com, mani@kernel.org, lpieralisi@kernel.org,
kwilczynski@kernel.org, robh@kernel.org, bhelgaas@google.com,
cassel@kernel.org, vigneshr@ti.com, s-vadapalli@ti.com,
hongxing.zhu@nxp.com, l.stach@pengutronix.de,
shawnguo@kernel.org, s.hauer@pengutronix.de,
kernel@pengutronix.de, festevam@gmail.com, minghuan.Lian@nxp.com,
mingkai.hu@nxp.com, roy.zang@nxp.com, jesper.nilsson@axis.com,
heiko@sntech.de, srikanth.thokala@intel.com,
marek.vasut+renesas@gmail.com, yoshihiro.shimoda.uh@renesas.com,
geert+renesas@glider.be, magnus.damm@gmail.com,
christian.bruel@foss.st.com, mcoquelin.stm32@gmail.com,
alexandre.torgue@foss.st.com, thierry.reding@gmail.com,
jonathanh@nvidia.com, hayashi.kunihiko@socionext.com,
mhiramat@kernel.org, kishon@kernel.org, jirislaby@kernel.org,
rongqianfeng@vivo.com, 18255117159@163.com,
shawn.lin@rock-chips.com, nicolas.frattaroli@collabora.com,
linux.amoon@gmail.com, vidyas@nvidia.com,
linux-omap@vger.kernel.org, linux-pci@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, imx@lists.linux.dev,
linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@axis.com,
linux-rockchip@lists.infradead.org,
linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-tegra@vger.kernel.org
Subject: Re: [PATCH v7 2/6] PCI: endpoint: Add BAR subrange mapping support
Date: Tue, 13 Jan 2026 15:26:17 -0500 [thread overview]
Message-ID: <aWaqablKcUnHx/mp@lizhi-Precision-Tower-5810> (raw)
In-Reply-To: <20260113162719.3710268-3-den@valinux.co.jp>
On Wed, Jan 14, 2026 at 01:27:15AM +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.
>
> Reviewed-by: Niklas Cassel <cassel@kernel.org>
> Signed-off-by: Koichiro Den <den@valinux.co.jp>
> ---
...
>
> #define to_pci_epf_driver(drv) container_of_const((drv), struct pci_epf_driver, driver)
>
> +/**
> + * struct pci_epf_bar_submap - BAR subrange for inbound mapping
> + * @phys_addr: target physical/DMA address for this subrange
> + * @size: the size of the subrange to be mapped
> + * @offset: byte offset within the BAR base
> + *
> + * When pci_epf_bar.use_submap is set, pci_epf_bar.submap describes the
> + * complete BAR layout. This allows an EPC driver to program multiple
> + * inbound translation windows for a single BAR when supported by the
> + * controller.
> + *
> + * Note that the subranges:
> + * - must be non-overlapping
> + * - must exactly cover the BAR (i.e. no holes)
> + * - must be sorted (in ascending order by offset)
> + */
> +struct pci_epf_bar_submap {
> + dma_addr_t phys_addr;
> + size_t size;
> + size_t offset;
> +};
I suppose offset is sum of previous all submap's size? If yes, needn't
offset.
> +
> /**
> * struct pci_epf_bar - represents the BAR of EPF device
> * @phys_addr: physical address that should be mapped to the BAR
> @@ -119,6 +141,10 @@ struct pci_epf_driver {
> * requirement
> * @barno: BAR number
> * @flags: flags that are set for the BAR
> + * @use_submap: set true to request subrange mappings within this BAR
> + * @num_submap: number of entries in @submap
> + * @submap: array of subrange descriptors allocated by the caller. See
> + * struct pci_epf_bar_submap for the restrictions in detail.
> */
> struct pci_epf_bar {
> dma_addr_t phys_addr;
> @@ -127,6 +153,11 @@ struct pci_epf_bar {
> size_t mem_size;
> enum pci_barno barno;
> int flags;
> +
> + /* Optional sub-range mapping */
> + bool use_submap;
> + unsigned int num_submap;
can we use num_submap != 0 as use_submap?
Frank
> + struct pci_epf_bar_submap *submap;
> };
>
> /**
> --
> 2.51.0
>
next prev parent reply other threads:[~2026-01-13 20:27 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-13 16:27 [PATCH v7 0/6] PCI: endpoint: BAR subrange mapping support Koichiro Den
2026-01-13 16:27 ` [PATCH v7 1/6] PCI: endpoint: Add dynamic_inbound_mapping EPC feature Koichiro Den
2026-01-13 20:19 ` Frank Li
2026-01-13 16:27 ` [PATCH v7 2/6] PCI: endpoint: Add BAR subrange mapping support Koichiro Den
2026-01-13 20:26 ` Frank Li [this message]
2026-01-14 3:22 ` Koichiro Den
2026-01-13 16:27 ` [PATCH v7 3/6] PCI: dwc: Allow glue drivers to return mutable EPC features Koichiro Den
2026-01-13 20:38 ` Frank Li
2026-01-14 3:29 ` Koichiro Den
2026-01-14 15:20 ` Frank Li
2026-01-14 17:17 ` Koichiro Den
2026-01-14 19:44 ` Frank Li
2026-01-14 20:13 ` Niklas Cassel
2026-01-13 16:27 ` [PATCH v7 4/6] PCI: dwc: Advertise dynamic inbound mapping support Koichiro Den
2026-01-13 18:44 ` Niklas Cassel
2026-01-13 16:27 ` [PATCH v7 5/6] PCI: dwc: ep: Support BAR subrange inbound mapping via Address Match Mode iATU Koichiro Den
2026-01-13 20:53 ` Frank Li
2026-01-15 8:48 ` Koichiro Den
2026-01-14 3:54 ` Koichiro Den
2026-01-14 10:39 ` Niklas Cassel
2026-01-14 17:29 ` Koichiro Den
2026-01-13 16:27 ` [PATCH v7 6/6] Documentation: PCI: endpoint: Clarify pci_epc_set_bar() usage Koichiro Den
2026-01-13 20:56 ` 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=aWaqablKcUnHx/mp@lizhi-Precision-Tower-5810 \
--to=frank.li@nxp.com \
--cc=18255117159@163.com \
--cc=alexandre.torgue@foss.st.com \
--cc=bhelgaas@google.com \
--cc=cassel@kernel.org \
--cc=christian.bruel@foss.st.com \
--cc=den@valinux.co.jp \
--cc=festevam@gmail.com \
--cc=geert+renesas@glider.be \
--cc=hayashi.kunihiko@socionext.com \
--cc=heiko@sntech.de \
--cc=hongxing.zhu@nxp.com \
--cc=imx@lists.linux.dev \
--cc=jesper.nilsson@axis.com \
--cc=jingoohan1@gmail.com \
--cc=jirislaby@kernel.org \
--cc=jonathanh@nvidia.com \
--cc=kernel@pengutronix.de \
--cc=kishon@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=l.stach@pengutronix.de \
--cc=linux-arm-kernel@axis.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=linux-tegra@vger.kernel.org \
--cc=linux.amoon@gmail.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lpieralisi@kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mani@kernel.org \
--cc=marek.vasut+renesas@gmail.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=mhiramat@kernel.org \
--cc=minghuan.Lian@nxp.com \
--cc=mingkai.hu@nxp.com \
--cc=nicolas.frattaroli@collabora.com \
--cc=robh@kernel.org \
--cc=rongqianfeng@vivo.com \
--cc=roy.zang@nxp.com \
--cc=s-vadapalli@ti.com \
--cc=s.hauer@pengutronix.de \
--cc=shawn.lin@rock-chips.com \
--cc=shawnguo@kernel.org \
--cc=srikanth.thokala@intel.com \
--cc=thierry.reding@gmail.com \
--cc=vidyas@nvidia.com \
--cc=vigneshr@ti.com \
--cc=yoshihiro.shimoda.uh@renesas.com \
/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