Documentation/PCI/endpoint/pci-endpoint.rst | 24 +++ drivers/pci/controller/dwc/pci-dra7xx.c | 1 + drivers/pci/controller/dwc/pci-imx6.c | 3 + drivers/pci/controller/dwc/pci-keystone.c | 1 + drivers/pci/controller/dwc/pcie-artpec6.c | 1 + .../pci/controller/dwc/pcie-designware-ep.c | 203 +++++++++++++++++- .../pci/controller/dwc/pcie-designware-plat.c | 1 + drivers/pci/controller/dwc/pcie-designware.h | 8 + drivers/pci/controller/dwc/pcie-dw-rockchip.c | 2 + drivers/pci/controller/dwc/pcie-keembay.c | 1 + drivers/pci/controller/dwc/pcie-qcom-ep.c | 1 + drivers/pci/controller/dwc/pcie-rcar-gen4.c | 1 + drivers/pci/controller/dwc/pcie-stm32-ep.c | 1 + drivers/pci/controller/dwc/pcie-tegra194.c | 1 + drivers/pci/controller/dwc/pcie-uniphier-ep.c | 2 + drivers/pci/endpoint/pci-epc-core.c | 8 + include/linux/pci-epc.h | 9 + include/linux/pci-epf.h | 27 +++ 18 files changed, 285 insertions(+), 10 deletions(-)
This series proposes support for mapping subranges within a PCIe endpoint
BAR and enables controllers to program inbound address translation for
those subranges.
- Patch 1/5 introduces dynamic_inbound_mapping feature bit. This can be
used as a safeguard to check whether a BAR can really be reconfigured
without clearing/resetting it.
- Patch 2/5 introduces generic BAR subrange mapping support in the PCI
endpoint core.
- Patch 3/5 advertises dynamic inbound mapping support via
DWC_EPC_COMMON_FEATURES for all DWC-based glue drivers.
- Patch 4/5 adds an implementation for the DesignWare PCIe endpoint
controller using Address Match Mode IB iATU. It also advertises
subrange_mapping support via DWC_EPC_COMMON_FEATURES.
- Patch 5/5 updates a documentation for pci_epc_set_bar().
This series is originally a spin-off from a larger RFC series posted
earlier:
https://lore.kernel.org/all/20251217151609.3162665-4-den@valinux.co.jp/
The first user will likely be Remote eDMA-backed NTB transport,
demonstrated in that RFC series.
Kernel base:
- repo: git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git
- branch: controller/dwc
- commit: 68ac85fb42cf ("PCI: dwc: Use cfg0_base as iMSI-RX target address
to support 32-bit MSI devices")
Changelog:
* v7->v8 changes:
- Drop the explicit submap offset and use_submap fields. The submap
array order now defines BAR offsets (gapless decomposition). Commit
messages and source code documentations are adjusted accordingly.
- Drop the no-longer-needed dw_pcie_ib_map and add ib_atu_indexes field
to track iatu indexes used for teardown.
- Move inbound mapping teardown into dw_pcie_ep_set_bar() to cover all
BAR transition cases.
- Centralize feature bit advertisement via DWC_EPC_COMMON_FEATURES.
- Added a (epf_bar->num_submap && !epf_bar->submap) check in
pci_epc_set_bar().
- Note that some Reviewed-by tags are dropped, as the changes need to be
re-reviewed.
* v6->v7 changes:
- Added missing check of dynamic_inbound_mapping feature bit in
pci_epc_set_bar() when use_submap is set true.
- Addressed the remaining review comments from Niklas (patch reordering,
splitting, and source code comment/documentation refinements).
* v5->v6 changes:
- Added a new feature bit dynamic_inbound_mapping and set it centrally
in dw_pcie_ep_get_features() for all DWC-based glue drivers.
- Updated documentation for pci_epc_set_bar().
- Dropped a needless and harmful dw_pcie_ep_clear_bar() call on the error
path.
- Fixed "Bar Match Mode" to "BAR Match Mode" in a source code comment.
* v4->v5 changes:
- Added subrange_mapping to struct pci_epc_features and enforced a
strict capability check in pci_epc_set_bar() (reject use_submap when
unsupported).
- Changed DWC-based glue drivers to return a mutable features pointer
and set subrange_mapping centrally at the DWC midlayer.
- Split the series into 3 patches accordingly.
* v3->v4 changes:
- Drop unused includes that should have been removed in v3
* v2->v3 changes:
- Remove submap copying and sorting from dw_pcie_ep_ib_atu_addr(), and
require callers to pass a sorted submap. The related source code
comments are updated accordingly.
- Refine source code comments and commit messages, including normalizing
"Address Match Mode" wording.
- Add const qualifiers where applicable.
* v1->v2 changes:
- Introduced stricter submap validation: no holes/overlaps and the
subranges must exactly cover the whole BAR. Added
dw_pcie_ep_validate_submap() to enforce alignment and full-coverage
constraints.
- Enforced one-shot (all-or-nothing) submap programming to avoid leaving
half-programmed BAR state:
* Dropped incremental/overwrite logic that is no longer needed with the
one-shot design.
* Added dw_pcie_ep_clear_ib_maps() and used it from multiple places to
tear down BAR match / address match inbound mappings without code
duplication.
- Updated kernel source code comments and commit messages, including a
small refinement made along the way.
- Changed num_submap type to unsigned int.
v7: https://lore.kernel.org/all/20260113162719.3710268-1-den@valinux.co.jp/
v6: https://lore.kernel.org/all/20260113023715.3463724-1-den@valinux.co.jp/
v5: https://lore.kernel.org/all/20260108172403.2629671-1-den@valinux.co.jp/
v4: https://lore.kernel.org/all/20260108044148.2352800-1-den@valinux.co.jp/
v3: https://lore.kernel.org/all/20260108024829.2255501-1-den@valinux.co.jp/
v2: https://lore.kernel.org/all/20260107041358.1986701-1-den@valinux.co.jp/
v1: https://lore.kernel.org/all/20260105080214.1254325-1-den@valinux.co.jp/
Thank you for reviewing,
Koichiro Den (5):
PCI: endpoint: Add dynamic_inbound_mapping EPC feature
PCI: endpoint: Add BAR subrange mapping support
PCI: dwc: Advertise dynamic inbound mapping support
PCI: dwc: ep: Support BAR subrange inbound mapping via Address Match
Mode iATU
Documentation: PCI: endpoint: Clarify pci_epc_set_bar() usage
Documentation/PCI/endpoint/pci-endpoint.rst | 24 +++
drivers/pci/controller/dwc/pci-dra7xx.c | 1 +
drivers/pci/controller/dwc/pci-imx6.c | 3 +
drivers/pci/controller/dwc/pci-keystone.c | 1 +
drivers/pci/controller/dwc/pcie-artpec6.c | 1 +
.../pci/controller/dwc/pcie-designware-ep.c | 203 +++++++++++++++++-
.../pci/controller/dwc/pcie-designware-plat.c | 1 +
drivers/pci/controller/dwc/pcie-designware.h | 8 +
drivers/pci/controller/dwc/pcie-dw-rockchip.c | 2 +
drivers/pci/controller/dwc/pcie-keembay.c | 1 +
drivers/pci/controller/dwc/pcie-qcom-ep.c | 1 +
drivers/pci/controller/dwc/pcie-rcar-gen4.c | 1 +
drivers/pci/controller/dwc/pcie-stm32-ep.c | 1 +
drivers/pci/controller/dwc/pcie-tegra194.c | 1 +
drivers/pci/controller/dwc/pcie-uniphier-ep.c | 2 +
drivers/pci/endpoint/pci-epc-core.c | 8 +
include/linux/pci-epc.h | 9 +
include/linux/pci-epf.h | 27 +++
18 files changed, 285 insertions(+), 10 deletions(-)
--
2.51.0
On Thu, Jan 15, 2026 at 05:49:23PM +0900, Koichiro Den wrote: > This series proposes support for mapping subranges within a PCIe endpoint > BAR and enables controllers to program inbound address translation for > those subranges. > > - Patch 1/5 introduces dynamic_inbound_mapping feature bit. This can be > used as a safeguard to check whether a BAR can really be reconfigured > without clearing/resetting it. > > - Patch 2/5 introduces generic BAR subrange mapping support in the PCI > endpoint core. > > - Patch 3/5 advertises dynamic inbound mapping support via > DWC_EPC_COMMON_FEATURES for all DWC-based glue drivers. > > - Patch 4/5 adds an implementation for the DesignWare PCIe endpoint > controller using Address Match Mode IB iATU. It also advertises > subrange_mapping support via DWC_EPC_COMMON_FEATURES. > > - Patch 5/5 updates a documentation for pci_epc_set_bar(). > --(snip)-- > Koichiro Den (5): > PCI: endpoint: Add dynamic_inbound_mapping EPC feature > PCI: endpoint: Add BAR subrange mapping support > PCI: dwc: Advertise dynamic inbound mapping support > PCI: dwc: ep: Support BAR subrange inbound mapping via Address Match > Mode iATU > Documentation: PCI: endpoint: Clarify pci_epc_set_bar() usage > > Documentation/PCI/endpoint/pci-endpoint.rst | 24 +++ > drivers/pci/controller/dwc/pci-dra7xx.c | 1 + > drivers/pci/controller/dwc/pci-imx6.c | 3 + > drivers/pci/controller/dwc/pci-keystone.c | 1 + > drivers/pci/controller/dwc/pcie-artpec6.c | 1 + > .../pci/controller/dwc/pcie-designware-ep.c | 203 +++++++++++++++++- > .../pci/controller/dwc/pcie-designware-plat.c | 1 + > drivers/pci/controller/dwc/pcie-designware.h | 8 + > drivers/pci/controller/dwc/pcie-dw-rockchip.c | 2 + > drivers/pci/controller/dwc/pcie-keembay.c | 1 + > drivers/pci/controller/dwc/pcie-qcom-ep.c | 1 + > drivers/pci/controller/dwc/pcie-rcar-gen4.c | 1 + > drivers/pci/controller/dwc/pcie-stm32-ep.c | 1 + > drivers/pci/controller/dwc/pcie-tegra194.c | 1 + > drivers/pci/controller/dwc/pcie-uniphier-ep.c | 2 + > drivers/pci/endpoint/pci-epc-core.c | 8 + > include/linux/pci-epc.h | 9 + > include/linux/pci-epf.h | 27 +++ > 18 files changed, 285 insertions(+), 10 deletions(-) Hi Mani, Bjorn, Based on the feedback so far (thanks to Niklas and Frank), the design seems to be converging. At this point, I would appreciate confirmation on the following points before proceeding further. 1) Does the current (v8) approach for BAR subrange inbound mapping at the EPC/core level look reasonable? 2) From a process perspective, does it make sense to continue this as a PCI endpoint subsystem-led series, with the dwc-specific changes layered on top, or would you prefer a different split or ownership? Thanks, Koichiro > > -- > 2.51.0 >
On Mon, Jan 19, 2026 at 10:00:38PM +0900, Koichiro Den wrote: > On Thu, Jan 15, 2026 at 05:49:23PM +0900, Koichiro Den wrote: > > This series proposes support for mapping subranges within a PCIe endpoint > > BAR and enables controllers to program inbound address translation for > > those subranges. > > > > - Patch 1/5 introduces dynamic_inbound_mapping feature bit. This can be > > used as a safeguard to check whether a BAR can really be reconfigured > > without clearing/resetting it. > > > > - Patch 2/5 introduces generic BAR subrange mapping support in the PCI > > endpoint core. > > > > - Patch 3/5 advertises dynamic inbound mapping support via > > DWC_EPC_COMMON_FEATURES for all DWC-based glue drivers. > > > > - Patch 4/5 adds an implementation for the DesignWare PCIe endpoint > > controller using Address Match Mode IB iATU. It also advertises > > subrange_mapping support via DWC_EPC_COMMON_FEATURES. > > > > - Patch 5/5 updates a documentation for pci_epc_set_bar(). > > > --(snip)-- > > Koichiro Den (5): > > PCI: endpoint: Add dynamic_inbound_mapping EPC feature > > PCI: endpoint: Add BAR subrange mapping support > > PCI: dwc: Advertise dynamic inbound mapping support > > PCI: dwc: ep: Support BAR subrange inbound mapping via Address Match > > Mode iATU > > Documentation: PCI: endpoint: Clarify pci_epc_set_bar() usage > > > > Documentation/PCI/endpoint/pci-endpoint.rst | 24 +++ > > drivers/pci/controller/dwc/pci-dra7xx.c | 1 + > > drivers/pci/controller/dwc/pci-imx6.c | 3 + > > drivers/pci/controller/dwc/pci-keystone.c | 1 + > > drivers/pci/controller/dwc/pcie-artpec6.c | 1 + > > .../pci/controller/dwc/pcie-designware-ep.c | 203 +++++++++++++++++- > > .../pci/controller/dwc/pcie-designware-plat.c | 1 + > > drivers/pci/controller/dwc/pcie-designware.h | 8 + > > drivers/pci/controller/dwc/pcie-dw-rockchip.c | 2 + > > drivers/pci/controller/dwc/pcie-keembay.c | 1 + > > drivers/pci/controller/dwc/pcie-qcom-ep.c | 1 + > > drivers/pci/controller/dwc/pcie-rcar-gen4.c | 1 + > > drivers/pci/controller/dwc/pcie-stm32-ep.c | 1 + > > drivers/pci/controller/dwc/pcie-tegra194.c | 1 + > > drivers/pci/controller/dwc/pcie-uniphier-ep.c | 2 + > > drivers/pci/endpoint/pci-epc-core.c | 8 + > > include/linux/pci-epc.h | 9 + > > include/linux/pci-epf.h | 27 +++ > > 18 files changed, 285 insertions(+), 10 deletions(-) > > Hi Mani, Bjorn, > > Based on the feedback so far (thanks to Niklas and Frank), the design seems > to be converging. At this point, I would appreciate confirmation on the > following points before proceeding further. > > 1) Does the current (v8) approach for BAR subrange inbound mapping at the > EPC/core level look reasonable? > In this series you didn't add a consumer of this subrange mapping, which I believe is the epf-vntb driver [1]. Even so I don't see a justification of why the BAR needs to be split into multiple subranges. Can you explain that? > 2) From a process perspective, does it make sense to continue this as a PCI > endpoint subsystem-led series, with the dwc-specific changes layered on > top, or would you prefer a different split or ownership? > Is is OK to have both controller driver and endpoint changes in one series. - Mani [1] https://lore.kernel.org/linux-pci/20260118135440.1958279-14-den@valinux.co.jp -- மணிவண்ணன் சதாசிவம்
On Wed, Jan 21, 2026 at 09:08:34PM +0530, Manivannan Sadhasivam wrote: > On Mon, Jan 19, 2026 at 10:00:38PM +0900, Koichiro Den wrote: > > On Thu, Jan 15, 2026 at 05:49:23PM +0900, Koichiro Den wrote: > > > This series proposes support for mapping subranges within a PCIe endpoint > > > BAR and enables controllers to program inbound address translation for > > > those subranges. > > > > > > - Patch 1/5 introduces dynamic_inbound_mapping feature bit. This can be > > > used as a safeguard to check whether a BAR can really be reconfigured > > > without clearing/resetting it. > > > > > > - Patch 2/5 introduces generic BAR subrange mapping support in the PCI > > > endpoint core. > > > > > > - Patch 3/5 advertises dynamic inbound mapping support via > > > DWC_EPC_COMMON_FEATURES for all DWC-based glue drivers. > > > > > > - Patch 4/5 adds an implementation for the DesignWare PCIe endpoint > > > controller using Address Match Mode IB iATU. It also advertises > > > subrange_mapping support via DWC_EPC_COMMON_FEATURES. > > > > > > - Patch 5/5 updates a documentation for pci_epc_set_bar(). > > > > > --(snip)-- > > > Koichiro Den (5): > > > PCI: endpoint: Add dynamic_inbound_mapping EPC feature > > > PCI: endpoint: Add BAR subrange mapping support > > > PCI: dwc: Advertise dynamic inbound mapping support > > > PCI: dwc: ep: Support BAR subrange inbound mapping via Address Match > > > Mode iATU > > > Documentation: PCI: endpoint: Clarify pci_epc_set_bar() usage > > > > > > Documentation/PCI/endpoint/pci-endpoint.rst | 24 +++ > > > drivers/pci/controller/dwc/pci-dra7xx.c | 1 + > > > drivers/pci/controller/dwc/pci-imx6.c | 3 + > > > drivers/pci/controller/dwc/pci-keystone.c | 1 + > > > drivers/pci/controller/dwc/pcie-artpec6.c | 1 + > > > .../pci/controller/dwc/pcie-designware-ep.c | 203 +++++++++++++++++- > > > .../pci/controller/dwc/pcie-designware-plat.c | 1 + > > > drivers/pci/controller/dwc/pcie-designware.h | 8 + > > > drivers/pci/controller/dwc/pcie-dw-rockchip.c | 2 + > > > drivers/pci/controller/dwc/pcie-keembay.c | 1 + > > > drivers/pci/controller/dwc/pcie-qcom-ep.c | 1 + > > > drivers/pci/controller/dwc/pcie-rcar-gen4.c | 1 + > > > drivers/pci/controller/dwc/pcie-stm32-ep.c | 1 + > > > drivers/pci/controller/dwc/pcie-tegra194.c | 1 + > > > drivers/pci/controller/dwc/pcie-uniphier-ep.c | 2 + > > > drivers/pci/endpoint/pci-epc-core.c | 8 + > > > include/linux/pci-epc.h | 9 + > > > include/linux/pci-epf.h | 27 +++ > > > 18 files changed, 285 insertions(+), 10 deletions(-) > > > > Hi Mani, Bjorn, > > > > Based on the feedback so far (thanks to Niklas and Frank), the design seems > > to be converging. At this point, I would appreciate confirmation on the > > following points before proceeding further. > > > > 1) Does the current (v8) approach for BAR subrange inbound mapping at the > > EPC/core level look reasonable? > > Hi Mani, Thanks for the question. > > In this series you didn't add a consumer of this subrange mapping, which I > believe is the epf-vntb driver [1]. Even so I don't see a justification of why > the BAR needs to be split into multiple subranges. Can you explain that? Yes, the first consumer I have in mind is epf-vntb / remote eDMA-backed NTB work referenced in [1]. The motivation for BAR subrange mapping is that some EP platforms effectively have only two practically usable BARs, while needing multiple logically independent inbound mapping. For example, on Renesas R-Car Gen4 Spider, 64-bit BAR0 and BAR2 are the only practically usable BARs, since BAR4 is only 256 bytes. epf-vntb already needs two separate regions (config+spad and MW1 for the data-plane), leaving no spare BAR. Adding ntb_msi requires yet another MW, which simply does not fit unless an existing BAR is further divided. In theory, some vNTB regions (e.g. config+spad and dynamically allocated memory-backed MWs) could be tightly packed into a single physically contiguous BAR region to barely make it work. However, it immediately makes features mutually exclusive (e.g. ntb_msi / ntb_edma cannot coexist), and the layout becomes extremely fragile. Similarly, for remote eDMA-backed NTB transport, the host needs separate inbound access to the eDMA register block and the LL regions, which are distinct local address ranges. Without subrange mapping, the only choice is unnatural layout (e.g. dedicating one BAR entirely to eDMA register block, and another one to everything else that can be packed into a single locally contiguous memory region), even when this is barely possible. So while some cases might be made to work by aggressive packing, they are already at the limit on platforms such as R-Car Spider. BAR subrange mapping allows these features to be implemented in a straightforward, loosely-coupled, and extensible way on platforms with severely constrained BAR resources. > > > 2) From a process perspective, does it make sense to continue this as a PCI > > endpoint subsystem-led series, with the dwc-specific changes layered on > > top, or would you prefer a different split or ownership? > > > > Is is OK to have both controller driver and endpoint changes in one series. Understood, thank you. Koichiro > > - Mani > > [1] https://lore.kernel.org/linux-pci/20260118135440.1958279-14-den@valinux.co.jp > > -- > மணிவண்ணன் சதாசிவம்
Hello Koichiro, On Thu, Jan 22, 2026 at 10:52:31AM +0900, Koichiro Den wrote: > > > > In this series you didn't add a consumer of this subrange mapping, which I > > believe is the epf-vntb driver [1]. Even so I don't see a justification of why > > the BAR needs to be split into multiple subranges. Can you explain that? > > Yes, the first consumer I have in mind is epf-vntb / remote eDMA-backed NTB > work referenced in [1]. Another consumer in your RFC series is pci-epf-test, specifically: [RFC PATCH v4 35/38] PCI: endpoint: pci-epf-test: Add pci_epf_test_next_free_bar() helper [RFC PATCH v4 36/38] PCI: endpoint: pci-epf-test: Add remote eDMA-backed mode [RFC PATCH v4 37/38] misc: pci_endpoint_test: Add remote eDMA transfer test mode [RFC PATCH v4 38/38] selftests: pci_endpoint: Add remote eDMA transfer coverage where the pci-epf-test exports the eDMA registers (using subranges) over a BAR, and then in the host side driver, calls dw_edma_probe() on this subrange and uses the host side driver to control the eDMA residing in the endpoint. Most of your patches in [RFC PATCH v4 35/38] have NTB prefix. Would it not be possible to simply include patches 35-38 in this series, so we actually have a consumer, or do you need some other patches as well? E.g., perhaps [RFC PATCH v4 01/38] dmaengine: dw-edma: Export helper to get integrated register window Would also be required? Kind regards, Niklas
On Thu, Jan 22, 2026 at 09:45:13AM +0100, Niklas Cassel wrote:
> Hello Koichiro,
>
> On Thu, Jan 22, 2026 at 10:52:31AM +0900, Koichiro Den wrote:
> > >
> > > In this series you didn't add a consumer of this subrange mapping, which I
> > > believe is the epf-vntb driver [1]. Even so I don't see a justification of why
> > > the BAR needs to be split into multiple subranges. Can you explain that?
> >
> > Yes, the first consumer I have in mind is epf-vntb / remote eDMA-backed NTB
> > work referenced in [1].
>
> Another consumer in your RFC series is pci-epf-test, specifically:
> [RFC PATCH v4 35/38] PCI: endpoint: pci-epf-test: Add pci_epf_test_next_free_bar() helper
> [RFC PATCH v4 36/38] PCI: endpoint: pci-epf-test: Add remote eDMA-backed mode
> [RFC PATCH v4 37/38] misc: pci_endpoint_test: Add remote eDMA transfer test mode
> [RFC PATCH v4 38/38] selftests: pci_endpoint: Add remote eDMA transfer coverage
>
> where the pci-epf-test exports the eDMA registers (using subranges) over a
> BAR, and then in the host side driver, calls dw_edma_probe() on this subrange
> and uses the host side driver to control the eDMA residing in the endpoint.
>
> Most of your patches in [RFC PATCH v4 35/38] have NTB prefix.
>
> Would it not be possible to simply include patches 35-38 in this series,
> so we actually have a consumer, or do you need some other patches as well?
Sorry, I sent v9 just a few minutes after your email, without noticing it,
and then I was AFK for several hours.
>
> E.g., perhaps
> [RFC PATCH v4 01/38] dmaengine: dw-edma: Export helper to get integrated register window
>
> Would also be required?
Yes, please see the section "Patch layout" in:
https://lore.kernel.org/all/20260118135440.1958279-1-den@valinux.co.jp/
[...]
1. dw-edma / DesignWare EP helpers needed for remote embedded-DMA (export
register/LL windows, IRQ routing control, etc.)
Patch 01 : dmaengine: dw-edma: Export helper to get integrated register window
Patch 02 : dmaengine: dw-edma: Add per-channel interrupt routing control
Patch 03 : dmaengine: dw-edma: Poll completion when local IRQ handling is disabled
Patch 04 : dmaengine: dw-edma: Add notify-only channels support
Patch 05 : dmaengine: dw-edma: Add a helper to query linked-list region
Patches [RFC PATCH v4 01/38] through [RFC PATCH v4 05/38] are prerequisites
for the PCI test update, in addition to this "PCI: endpoint: BAR subrange
mapping support" series. Note that this series is described in "Kernel
base / dependencies" section of the large RFC series cover letter.
For this reason, those test cases cannot be included in this series.
Kind regards,
Koichiro
>
>
>
> Kind regards,
> Niklas
On Thu, Jan 22, 2026 at 11:02:42PM +0900, Koichiro Den wrote: > On Thu, Jan 22, 2026 at 09:45:13AM +0100, Niklas Cassel wrote: > > Hello Koichiro, > > > > On Thu, Jan 22, 2026 at 10:52:31AM +0900, Koichiro Den wrote: > > > > > > > > In this series you didn't add a consumer of this subrange mapping, which I > > > > believe is the epf-vntb driver [1]. Even so I don't see a justification of why > > > > the BAR needs to be split into multiple subranges. Can you explain that? > > > > > > Yes, the first consumer I have in mind is epf-vntb / remote eDMA-backed NTB > > > work referenced in [1]. > > > > Another consumer in your RFC series is pci-epf-test, specifically: > > [RFC PATCH v4 35/38] PCI: endpoint: pci-epf-test: Add pci_epf_test_next_free_bar() helper > > [RFC PATCH v4 36/38] PCI: endpoint: pci-epf-test: Add remote eDMA-backed mode > > [RFC PATCH v4 37/38] misc: pci_endpoint_test: Add remote eDMA transfer test mode > > [RFC PATCH v4 38/38] selftests: pci_endpoint: Add remote eDMA transfer coverage > > > > where the pci-epf-test exports the eDMA registers (using subranges) over a > > BAR, and then in the host side driver, calls dw_edma_probe() on this subrange > > and uses the host side driver to control the eDMA residing in the endpoint. > > > > Most of your patches in [RFC PATCH v4 35/38] have NTB prefix. > > > > Would it not be possible to simply include patches 35-38 in this series, > > so we actually have a consumer, or do you need some other patches as well? > > Sorry, I sent v9 just a few minutes after your email, without noticing it, > and then I was AFK for several hours. > > > > > E.g., perhaps > > [RFC PATCH v4 01/38] dmaengine: dw-edma: Export helper to get integrated register window > > > > Would also be required? > > Yes, please see the section "Patch layout" in: > https://lore.kernel.org/all/20260118135440.1958279-1-den@valinux.co.jp/ > > [...] > 1. dw-edma / DesignWare EP helpers needed for remote embedded-DMA (export > register/LL windows, IRQ routing control, etc.) > > Patch 01 : dmaengine: dw-edma: Export helper to get integrated register window > Patch 02 : dmaengine: dw-edma: Add per-channel interrupt routing control > Patch 03 : dmaengine: dw-edma: Poll completion when local IRQ handling is disabled > Patch 04 : dmaengine: dw-edma: Add notify-only channels support > Patch 05 : dmaengine: dw-edma: Add a helper to query linked-list region > > Patches [RFC PATCH v4 01/38] through [RFC PATCH v4 05/38] are prerequisites > for the PCI test update, in addition to this "PCI: endpoint: BAR subrange > mapping support" series. Note that this series is described in "Kernel > base / dependencies" section of the large RFC series cover letter. > > For this reason, those test cases cannot be included in this series. Ok, I assumed that some of those 5 patches were either eDMA optimizations or things needed for NTB. But if you need them even to just probe the eDMA driver on the host side (using registers from the remote eDMA), then perhaps it is too much. I was hoping that we could at least have a very simple test, e.g. pci-endpoint-test only supporting READ or WRITE using remote eDMA. At least then we would have a consumer part of this series. pci-endpoint-test could have been further extended in a follow up series if there were some eDMA driver patches that were needed for more complex operations than a simple READ or WRITE using remote eDMA. Kind regards, Niklas
On Thu, Jan 22, 2026 at 04:17:51PM +0100, Niklas Cassel wrote: > On Thu, Jan 22, 2026 at 11:02:42PM +0900, Koichiro Den wrote: > > On Thu, Jan 22, 2026 at 09:45:13AM +0100, Niklas Cassel wrote: > > > Hello Koichiro, > > > > > > On Thu, Jan 22, 2026 at 10:52:31AM +0900, Koichiro Den wrote: > > > > > > > > > > In this series you didn't add a consumer of this subrange mapping, which I > > > > > believe is the epf-vntb driver [1]. Even so I don't see a justification of why > > > > > the BAR needs to be split into multiple subranges. Can you explain that? > > > > > > > > Yes, the first consumer I have in mind is epf-vntb / remote eDMA-backed NTB > > > > work referenced in [1]. > > > > > > Another consumer in your RFC series is pci-epf-test, specifically: > > > [RFC PATCH v4 35/38] PCI: endpoint: pci-epf-test: Add pci_epf_test_next_free_bar() helper > > > [RFC PATCH v4 36/38] PCI: endpoint: pci-epf-test: Add remote eDMA-backed mode > > > [RFC PATCH v4 37/38] misc: pci_endpoint_test: Add remote eDMA transfer test mode > > > [RFC PATCH v4 38/38] selftests: pci_endpoint: Add remote eDMA transfer coverage > > > > > > where the pci-epf-test exports the eDMA registers (using subranges) over a > > > BAR, and then in the host side driver, calls dw_edma_probe() on this subrange > > > and uses the host side driver to control the eDMA residing in the endpoint. > > > > > > Most of your patches in [RFC PATCH v4 35/38] have NTB prefix. > > > > > > Would it not be possible to simply include patches 35-38 in this series, > > > so we actually have a consumer, or do you need some other patches as well? > > > > Sorry, I sent v9 just a few minutes after your email, without noticing it, > > and then I was AFK for several hours. > > > > > > > > E.g., perhaps > > > [RFC PATCH v4 01/38] dmaengine: dw-edma: Export helper to get integrated register window > > > > > > Would also be required? > > > > Yes, please see the section "Patch layout" in: > > https://lore.kernel.org/all/20260118135440.1958279-1-den@valinux.co.jp/ > > > > [...] > > 1. dw-edma / DesignWare EP helpers needed for remote embedded-DMA (export > > register/LL windows, IRQ routing control, etc.) > > > > Patch 01 : dmaengine: dw-edma: Export helper to get integrated register window > > Patch 02 : dmaengine: dw-edma: Add per-channel interrupt routing control > > Patch 03 : dmaengine: dw-edma: Poll completion when local IRQ handling is disabled > > Patch 04 : dmaengine: dw-edma: Add notify-only channels support > > Patch 05 : dmaengine: dw-edma: Add a helper to query linked-list region > > > > Patches [RFC PATCH v4 01/38] through [RFC PATCH v4 05/38] are prerequisites > > for the PCI test update, in addition to this "PCI: endpoint: BAR subrange > > mapping support" series. Note that this series is described in "Kernel > > base / dependencies" section of the large RFC series cover letter. > > > > For this reason, those test cases cannot be included in this series. > > Ok, I assumed that some of those 5 patches were either eDMA optimizations > or things needed for NTB. > > But if you need them even to just probe the eDMA driver on the host side > (using registers from the remote eDMA), then perhaps it is too much. > > I was hoping that we could at least have a very simple test, > e.g. pci-endpoint-test only supporting READ or WRITE using remote eDMA. If we were to add a simple test in this series, I think it would be something like BAR_SUBRANGE_TEST (beside BAR_TEST), which dynamically triggers subrange mapping on the EP side if supported, and performs read/write to those subranges. That would keep the test focused on validating the subrange mapping functionality, and would not involve remote eDMA. What do you think? Koichiro > > At least then we would have a consumer part of this series. > > pci-endpoint-test could have been further extended in a follow up series > if there were some eDMA driver patches that were needed for more complex > operations than a simple READ or WRITE using remote eDMA. > > > Kind regards, > Niklas
On Fri, Jan 23, 2026 at 09:36:27AM +0900, Koichiro Den wrote:
> On Thu, Jan 22, 2026 at 04:17:51PM +0100, Niklas Cassel wrote:
> > On Thu, Jan 22, 2026 at 11:02:42PM +0900, Koichiro Den wrote:
> > > On Thu, Jan 22, 2026 at 09:45:13AM +0100, Niklas Cassel wrote:
> > > > Hello Koichiro,
> > > >
> > > > On Thu, Jan 22, 2026 at 10:52:31AM +0900, Koichiro Den wrote:
> > > > > >
> > > > > > In this series you didn't add a consumer of this subrange mapping, which I
> > > > > > believe is the epf-vntb driver [1]. Even so I don't see a justification of why
> > > > > > the BAR needs to be split into multiple subranges. Can you explain that?
> > > > >
> > > > > Yes, the first consumer I have in mind is epf-vntb / remote eDMA-backed NTB
> > > > > work referenced in [1].
> > > >
> > > > Another consumer in your RFC series is pci-epf-test, specifically:
> > > > [RFC PATCH v4 35/38] PCI: endpoint: pci-epf-test: Add pci_epf_test_next_free_bar() helper
> > > > [RFC PATCH v4 36/38] PCI: endpoint: pci-epf-test: Add remote eDMA-backed mode
> > > > [RFC PATCH v4 37/38] misc: pci_endpoint_test: Add remote eDMA transfer test mode
> > > > [RFC PATCH v4 38/38] selftests: pci_endpoint: Add remote eDMA transfer coverage
> > > >
> > > > where the pci-epf-test exports the eDMA registers (using subranges) over a
> > > > BAR, and then in the host side driver, calls dw_edma_probe() on this subrange
> > > > and uses the host side driver to control the eDMA residing in the endpoint.
> > > >
> > > > Most of your patches in [RFC PATCH v4 35/38] have NTB prefix.
> > > >
> > > > Would it not be possible to simply include patches 35-38 in this series,
> > > > so we actually have a consumer, or do you need some other patches as well?
> > >
> > > Sorry, I sent v9 just a few minutes after your email, without noticing it,
> > > and then I was AFK for several hours.
> > >
> > > >
> > > > E.g., perhaps
> > > > [RFC PATCH v4 01/38] dmaengine: dw-edma: Export helper to get integrated register window
> > > >
> > > > Would also be required?
> > >
> > > Yes, please see the section "Patch layout" in:
> > > https://lore.kernel.org/all/20260118135440.1958279-1-den@valinux.co.jp/
> > >
> > > [...]
> > > 1. dw-edma / DesignWare EP helpers needed for remote embedded-DMA (export
> > > register/LL windows, IRQ routing control, etc.)
> > >
> > > Patch 01 : dmaengine: dw-edma: Export helper to get integrated register window
> > > Patch 02 : dmaengine: dw-edma: Add per-channel interrupt routing control
> > > Patch 03 : dmaengine: dw-edma: Poll completion when local IRQ handling is disabled
> > > Patch 04 : dmaengine: dw-edma: Add notify-only channels support
> > > Patch 05 : dmaengine: dw-edma: Add a helper to query linked-list region
> > >
> > > Patches [RFC PATCH v4 01/38] through [RFC PATCH v4 05/38] are prerequisites
> > > for the PCI test update, in addition to this "PCI: endpoint: BAR subrange
> > > mapping support" series. Note that this series is described in "Kernel
> > > base / dependencies" section of the large RFC series cover letter.
> > >
> > > For this reason, those test cases cannot be included in this series.
> >
> > Ok, I assumed that some of those 5 patches were either eDMA optimizations
> > or things needed for NTB.
> >
> > But if you need them even to just probe the eDMA driver on the host side
> > (using registers from the remote eDMA), then perhaps it is too much.
> >
> > I was hoping that we could at least have a very simple test,
> > e.g. pci-endpoint-test only supporting READ or WRITE using remote eDMA.
>
> If we were to add a simple test in this series, I think it would be
> something like BAR_SUBRANGE_TEST (beside BAR_TEST), which dynamically
> triggers subrange mapping on the EP side if supported, and performs
> read/write to those subranges. That would keep the test focused on
> validating the subrange mapping functionality, and would not involve remote
> eDMA. What do you think?
One additional concern if we were to add a subrange mapping test is that
the EP-side pci-epf-test.c currently defines bar_size as follows:
static size_t bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 };
(see https://github.com/torvalds/linux/blob/v6.19-rc6/drivers/pci/endpoint/functions/pci-epf-test.c#L105)
The values 512 (BAR0/1) and 1024 (BAR2) are even smaller than the minimam
CX_ATU_MIN_REGION_SIZE (=4KB). This means that introducing
BAR_SUBRANGE_TEST would likely require one of the following:
(a). raising these hard-coded values
(b). reserving a dedicated BAR for the subrange mapping test
(c). limiting the testing to BAR3/4/5 if available (though, for
example, no BAR would pass the test on R-Car Spider which I'm
testing on, where BAR4 is fixed 256B).
I'm wondering whether there is a clean way to add a subrange mapping test
without significantly reshaping pci-epf-test.
Regards,
Koichiro
>
> Koichiro
>
> >
> > At least then we would have a consumer part of this series.
> >
> > pci-endpoint-test could have been further extended in a follow up series
> > if there were some eDMA driver patches that were needed for more complex
> > operations than a simple READ or WRITE using remote eDMA.
> >
> >
> > Kind regards,
> > Niklas
On Fri, Jan 23, 2026 at 04:11:08PM +0900, Koichiro Den wrote:
>
> One additional concern if we were to add a subrange mapping test is that
> the EP-side pci-epf-test.c currently defines bar_size as follows:
>
> static size_t bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 };
> (see https://github.com/torvalds/linux/blob/v6.19-rc6/drivers/pci/endpoint/functions/pci-epf-test.c#L105)
>
> The values 512 (BAR0/1) and 1024 (BAR2) are even smaller than the minimam
> CX_ATU_MIN_REGION_SIZE (=4KB). This means that introducing
> BAR_SUBRANGE_TEST would likely require one of the following:
>
> (a). raising these hard-coded values
> (b). reserving a dedicated BAR for the subrange mapping test
> (c). limiting the testing to BAR3/4/5 if available (though, for
> example, no BAR would pass the test on R-Car Spider which I'm
> testing on, where BAR4 is fixed 256B).
>
> I'm wondering whether there is a clean way to add a subrange mapping test
> without significantly reshaping pci-epf-test.
If you really want to implement a test, I suggest to look at:
pci_epf_test_enable_doorbell()
Which changes the address translation of a BAR dynamically.
pci_epf_test_disable_doorbell()
Which reverts back to the original translation.
pci_epf_test_enable_doorbell() simply does:
pci_epc_get_next_free_bar() to get a BAR, then writes the BAR
number in the in the pci-epf-test command registers, offset:
PCI_ENDPOINT_TEST_DB_BAR 0x34
(Which represent the offset in struct pci_epf_test, for
struct member db_bar)
However, the doorbells are most likely very small, so the chances
that reg->doorbell_offset will have a value that is smaller than
BAR size seems likely... but not guaranteed... and there is no
if (reg->doorbell_offset > epf->bar[bar].size)
goto err_doorbell_cleanup;
So it seems that this doorbell test just ignores the problem...
Frank, could you perhaps send a patch to add something like the above?
For your case... I guess we could bump the default sizes in pci-epf-test
if we want to. pci-epf-test already does:
if (epc_features->bar[bar].type == BAR_FIXED)
test_reg_size = epc_features->bar[bar].fixed_size;
else
test_reg_size = bar_size[bar];
So if there are fixed size BARs, that size will be respected, so I don't
think there should be any problem to increase the default sizes, if we
wanted to.
E.g. RK3588 has CX_ATU_MIN_REGION_SIZE 64k
So if we wanted to, a good number would be to have at least a few BARs of size
128k or larger (so there could be two submaps), since I assume that some other
DWC controllers might also have have 64k min alignment.
Having a test for this feature in pci-epf-test sounds really nice.
You could have even add a capability for this, see
pci_epf_test_set_capabilities().
if (epf_test->epc_features->subrange_mapping)
caps |= CAP_SUBRANGE_MAPPING;
Such that the host side driver (drivers/misc/pci_endpoint_test.c) could return
a distinct error code when this feature is not supported, such that
tools/testing/selftests/pci_endpoint/pci_endpoint_test.c could return SKIP when
that distinct error code is detected.
Kind regards,
Niklas
On Fri, Jan 23, 2026 at 09:35:01AM +0100, Niklas Cassel wrote: > On Fri, Jan 23, 2026 at 04:11:08PM +0900, Koichiro Den wrote: > > pci_epf_test_enable_doorbell() simply does: > pci_epc_get_next_free_bar() to get a BAR, then writes the BAR > number in the in the pci-epf-test command registers, offset: > PCI_ENDPOINT_TEST_DB_BAR 0x34 > > (Which represent the offset in struct pci_epf_test, for > struct member db_bar) Correction: Which represents the offset in struct pci_epf_test_reg, for struct member doorbell_bar. Kind regards, Niklas
On Fri, Jan 23, 2026 at 09:35:01AM +0100, Niklas Cassel wrote:
> On Fri, Jan 23, 2026 at 04:11:08PM +0900, Koichiro Den wrote:
> >
> > One additional concern if we were to add a subrange mapping test is that
> > the EP-side pci-epf-test.c currently defines bar_size as follows:
> >
> > static size_t bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 };
> > (see https://github.com/torvalds/linux/blob/v6.19-rc6/drivers/pci/endpoint/functions/pci-epf-test.c#L105)
> >
> > The values 512 (BAR0/1) and 1024 (BAR2) are even smaller than the minimam
> > CX_ATU_MIN_REGION_SIZE (=4KB). This means that introducing
> > BAR_SUBRANGE_TEST would likely require one of the following:
> >
> > (a). raising these hard-coded values
> > (b). reserving a dedicated BAR for the subrange mapping test
> > (c). limiting the testing to BAR3/4/5 if available (though, for
> > example, no BAR would pass the test on R-Car Spider which I'm
> > testing on, where BAR4 is fixed 256B).
> >
> > I'm wondering whether there is a clean way to add a subrange mapping test
> > without significantly reshaping pci-epf-test.
>
> If you really want to implement a test, I suggest to look at:
Honestly, I hadn't thought of it until receiving your comment in this
thread, since [1] through [2] already cover the relevant testing. But on
second thought, that might be too heavy-weight, and instead adding just a
simple test for subrange mapping in this series, might suffice.
[1] https://lore.kernel.org/all/20260118135440.1958279-37-den@valinux.co.jp/
[2] https://lore.kernel.org/all/20260118135440.1958279-39-den@valinux.co.jp/
>
> pci_epf_test_enable_doorbell()
> Which changes the address translation of a BAR dynamically.
>
> pci_epf_test_disable_doorbell()
> Which reverts back to the original translation.
>
> pci_epf_test_enable_doorbell() simply does:
> pci_epc_get_next_free_bar() to get a BAR, then writes the BAR
> number in the in the pci-epf-test command registers, offset:
> PCI_ENDPOINT_TEST_DB_BAR 0x34
>
> (Which represent the offset in struct pci_epf_test, for
> struct member db_bar)
>
>
> However, the doorbells are most likely very small, so the chances
> that reg->doorbell_offset will have a value that is smaller than
> BAR size seems likely... but not guaranteed... and there is no
>
> if (reg->doorbell_offset > epf->bar[bar].size)
> goto err_doorbell_cleanup;
>
> So it seems that this doorbell test just ignores the problem...
>
> Frank, could you perhaps send a patch to add something like the above?
>
>
> For your case... I guess we could bump the default sizes in pci-epf-test
> if we want to. pci-epf-test already does:
>
> if (epc_features->bar[bar].type == BAR_FIXED)
> test_reg_size = epc_features->bar[bar].fixed_size;
> else
> test_reg_size = bar_size[bar];
>
> So if there are fixed size BARs, that size will be respected, so I don't
> think there should be any problem to increase the default sizes, if we
> wanted to.
>
> E.g. RK3588 has CX_ATU_MIN_REGION_SIZE 64k
>
> So if we wanted to, a good number would be to have at least a few BARs of size
> 128k or larger (so there could be two submaps), since I assume that some other
> DWC controllers might also have have 64k min alignment.
I'm not entirely sure whether it's really acceptable to bump the hard-coded
sizes for BAR0/1/2/3 (512, 512, 1024, 16384) to 128k, in other words,
whether there were any reasons behind choosing such small default numbers.
Let's see. I agree that 128k or larger should suffice for DWC-based
platforms (as you mentioned, testing with two submaps).
>
>
> Having a test for this feature in pci-epf-test sounds really nice.
> You could have even add a capability for this, see
> pci_epf_test_set_capabilities().
>
> if (epf_test->epc_features->subrange_mapping)
> caps |= CAP_SUBRANGE_MAPPING;
>
>
> Such that the host side driver (drivers/misc/pci_endpoint_test.c) could return
> a distinct error code when this feature is not supported, such that
> tools/testing/selftests/pci_endpoint/pci_endpoint_test.c could return SKIP when
> that distinct error code is detected.
That sounds nice.
Thanks,
Koichiro
>
>
> Kind regards,
> Niklas
On Fri, Jan 23, 2026 at 11:08:39PM +0900, Koichiro Den wrote:
> >
> > So if we wanted to, a good number would be to have at least a few BARs of size
> > 128k or larger (so there could be two submaps), since I assume that some other
> > DWC controllers might also have have 64k min alignment.
>
> I'm not entirely sure whether it's really acceptable to bump the hard-coded
> sizes for BAR0/1/2/3 (512, 512, 1024, 16384) to 128k, in other words,
> whether there were any reasons behind choosing such small default numbers.
> Let's see. I agree that 128k or larger should suffice for DWC-based
> platforms (as you mentioned, testing with two submaps).
When the PCI endpoint subsystem was created, most SoC were arm32, and many
of them had a very small PCIe aperture, like a few megabytes in total.
So if you were running two boards based on the same SoC, one as host and
one as endpoint, and perhaps you even had a PCIe switch on the host board,
you really did not want to have larger BARs than needed because it would
not fit inside the small address space dedicated to PCIe.
Additionally, the PCI endpoint subsystem allocates backing memory for
these BARs, some of these systems might have a very small amount of RAM.
However, I think that:
static size_t bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 };
512+512+1024+16384+131072+1048576 = 1 Mi + 146 Ki
Is still quite low...
When adding more and more features to the PCI endpoint subsystem,
these small BAR sizes will not be enough to evaluate new features.
E.g. for Resizable BARs, as per the PCIe specification, the minimum
possible size for a Resizable BAR is 1 MB.
I solved this by making sure that pci_epf_alloc_space() overrides
the requested size, to set it to 1MB, if BAR type is BAR_RESIZABLE:
https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/commit/?h=52132f3a63b33fd38ceef07392ed176db84d579f
If a few MB is too much for your host system, use a different host
system to test. (E.g. if you connect these arm32 boards to a PC,
and run pci_endpoint_test, larger BAR sizes would not be a problem,
assuming that the endpoint itself can allocate enough backing memory.)
So my suggestion is that we that we just bump the defaults...
I guess in worst case, if someone actually complains, I think a nice
solution would be do to like you are doing for vntb:
https://lore.kernel.org/linux-pci/20260118135440.1958279-34-den@valinux.co.jp/
i.e. pci-epf-test could have {barX_size} in configfs, one per BAR,
and then the user themselves could configure the BAR sizes that they
want to run pci-epf-test with, if the pci-epf-test default sizes are
not desirable, before starting the link. (Some tests like e.g. the
subrange mapping test should of course fail if there is not a single
BAR with BAR size larger than needed to test the feature.)
But if I were you, I would just bump the defaults, since the defaults
are currently overrided for BAR type FIXED_BAR and RESIZABLE_BAR anyway,
and just add the barX_size attributes in configfs if someone complains.
Kind regards,
Niklas
On Fri, Jan 23, 2026 at 03:57:25PM +0100, Niklas Cassel wrote:
> On Fri, Jan 23, 2026 at 11:08:39PM +0900, Koichiro Den wrote:
> > >
> > > So if we wanted to, a good number would be to have at least a few BARs of size
> > > 128k or larger (so there could be two submaps), since I assume that some other
> > > DWC controllers might also have have 64k min alignment.
> >
> > I'm not entirely sure whether it's really acceptable to bump the hard-coded
> > sizes for BAR0/1/2/3 (512, 512, 1024, 16384) to 128k, in other words,
> > whether there were any reasons behind choosing such small default numbers.
> > Let's see. I agree that 128k or larger should suffice for DWC-based
> > platforms (as you mentioned, testing with two submaps).
>
> When the PCI endpoint subsystem was created, most SoC were arm32, and many
> of them had a very small PCIe aperture, like a few megabytes in total.
>
> So if you were running two boards based on the same SoC, one as host and
> one as endpoint, and perhaps you even had a PCIe switch on the host board,
> you really did not want to have larger BARs than needed because it would
> not fit inside the small address space dedicated to PCIe.
>
> Additionally, the PCI endpoint subsystem allocates backing memory for
> these BARs, some of these systems might have a very small amount of RAM.
>
> However, I think that:
> static size_t bar_size[] = { 512, 512, 1024, 16384, 131072, 1048576 };
>
> 512+512+1024+16384+131072+1048576 = 1 Mi + 146 Ki
>
> Is still quite low...
>
> When adding more and more features to the PCI endpoint subsystem,
> these small BAR sizes will not be enough to evaluate new features.
> E.g. for Resizable BARs, as per the PCIe specification, the minimum
> possible size for a Resizable BAR is 1 MB.
>
> I solved this by making sure that pci_epf_alloc_space() overrides
> the requested size, to set it to 1MB, if BAR type is BAR_RESIZABLE:
> https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/commit/?h=52132f3a63b33fd38ceef07392ed176db84d579f
>
> If a few MB is too much for your host system, use a different host
> system to test. (E.g. if you connect these arm32 boards to a PC,
> and run pci_endpoint_test, larger BAR sizes would not be a problem,
> assuming that the endpoint itself can allocate enough backing memory.)
>
> So my suggestion is that we that we just bump the defaults...
>
>
> I guess in worst case, if someone actually complains, I think a nice
> solution would be do to like you are doing for vntb:
> https://lore.kernel.org/linux-pci/20260118135440.1958279-34-den@valinux.co.jp/
>
> i.e. pci-epf-test could have {barX_size} in configfs, one per BAR,
> and then the user themselves could configure the BAR sizes that they
> want to run pci-epf-test with, if the pci-epf-test default sizes are
> not desirable, before starting the link. (Some tests like e.g. the
> subrange mapping test should of course fail if there is not a single
> BAR with BAR size larger than needed to test the feature.)
>
> But if I were you, I would just bump the defaults, since the defaults
> are currently overrided for BAR type FIXED_BAR and RESIZABLE_BAR anyway,
> and just add the barX_size attributes in configfs if someone complains.
That makes sense. I bumped the default sizes in v10, and if this turns out
to be a concern for some setups, I'll consider sending a patch to add such
configfs knobs. Thanks for sharing your thoughts.
(For forward reference, I sent v10 at:
https://lore.kernel.org/all/20260124145012.2794108-1-den@valinux.co.jp/)
Koichiro
>
>
> Kind regards,
> Niklas
On Mon, Jan 26, 2026 at 11:26:53PM +0900, Koichiro Den wrote:
> On Fri, Jan 23, 2026 at 03:57:25PM +0100, Niklas Cassel wrote:
> >
> > I guess in worst case, if someone actually complains, I think a nice
> > solution would be do to like you are doing for vntb:
> > https://lore.kernel.org/linux-pci/20260118135440.1958279-34-den@valinux.co.jp/
> >
> > i.e. pci-epf-test could have {barX_size} in configfs, one per BAR,
> > and then the user themselves could configure the BAR sizes that they
> > want to run pci-epf-test with, if the pci-epf-test default sizes are
> > not desirable, before starting the link. (Some tests like e.g. the
> > subrange mapping test should of course fail if there is not a single
> > BAR with BAR size larger than needed to test the feature.)
> >
> > But if I were you, I would just bump the defaults, since the defaults
> > are currently overrided for BAR type FIXED_BAR and RESIZABLE_BAR anyway,
> > and just add the barX_size attributes in configfs if someone complains.
>
> That makes sense. I bumped the default sizes in v10, and if this turns out
> to be a concern for some setups, I'll consider sending a patch to add such
> configfs knobs. Thanks for sharing your thoughts.
FWIW, I think such configfs knobs are nice to have regardless of any new
features or not.
(I have personally changed the hardcoded values locally during testing many
times.)
So I decided to just send a patch that adds such configfs knobs:
https://lore.kernel.org/linux-pci/20260123180747.827357-2-cassel@kernel.org/
Kind regards,
Niklas
On Fri, Jan 23, 2026 at 09:35:01AM +0100, Niklas Cassel wrote: > > pci_epf_test_enable_doorbell() simply does: > pci_epc_get_next_free_bar() to get a BAR, then writes the BAR > number in the in the pci-epf-test command registers, offset: > PCI_ENDPOINT_TEST_DB_BAR 0x34 > > However, the doorbells are most likely very small, so the chances > that reg->doorbell_offset will have a value that is smaller than > BAR size seems likely... but not guaranteed... and there is no > > if (reg->doorbell_offset > epf->bar[bar].size) > goto err_doorbell_cleanup; > > So it seems that this doorbell test just ignores the problem... > > Frank, could you perhaps send a patch to add something like the above? Frank, I guess the check would actually have to be something like: if (reg->doorbell_offset + size of the doorbell > epf->bar[bar].size) goto err_doorbell_cleanup; Kind regards, Niklas
On Thu, Jan 22, 2026 at 10:52:31AM +0900, Koichiro Den wrote: > On Wed, Jan 21, 2026 at 09:08:34PM +0530, Manivannan Sadhasivam wrote: > > On Mon, Jan 19, 2026 at 10:00:38PM +0900, Koichiro Den wrote: > > > On Thu, Jan 15, 2026 at 05:49:23PM +0900, Koichiro Den wrote: > > > > This series proposes support for mapping subranges within a PCIe endpoint > > > > BAR and enables controllers to program inbound address translation for > > > > those subranges. > > > > > > > > - Patch 1/5 introduces dynamic_inbound_mapping feature bit. This can be > > > > used as a safeguard to check whether a BAR can really be reconfigured > > > > without clearing/resetting it. > > > > > > > > - Patch 2/5 introduces generic BAR subrange mapping support in the PCI > > > > endpoint core. > > > > > > > > - Patch 3/5 advertises dynamic inbound mapping support via > > > > DWC_EPC_COMMON_FEATURES for all DWC-based glue drivers. > > > > > > > > - Patch 4/5 adds an implementation for the DesignWare PCIe endpoint > > > > controller using Address Match Mode IB iATU. It also advertises > > > > subrange_mapping support via DWC_EPC_COMMON_FEATURES. > > > > > > > > - Patch 5/5 updates a documentation for pci_epc_set_bar(). > > > > > > > --(snip)-- > > > > Koichiro Den (5): > > > > PCI: endpoint: Add dynamic_inbound_mapping EPC feature > > > > PCI: endpoint: Add BAR subrange mapping support > > > > PCI: dwc: Advertise dynamic inbound mapping support > > > > PCI: dwc: ep: Support BAR subrange inbound mapping via Address Match > > > > Mode iATU > > > > Documentation: PCI: endpoint: Clarify pci_epc_set_bar() usage > > > > > > > > Documentation/PCI/endpoint/pci-endpoint.rst | 24 +++ > > > > drivers/pci/controller/dwc/pci-dra7xx.c | 1 + > > > > drivers/pci/controller/dwc/pci-imx6.c | 3 + > > > > drivers/pci/controller/dwc/pci-keystone.c | 1 + > > > > drivers/pci/controller/dwc/pcie-artpec6.c | 1 + > > > > .../pci/controller/dwc/pcie-designware-ep.c | 203 +++++++++++++++++- > > > > .../pci/controller/dwc/pcie-designware-plat.c | 1 + > > > > drivers/pci/controller/dwc/pcie-designware.h | 8 + > > > > drivers/pci/controller/dwc/pcie-dw-rockchip.c | 2 + > > > > drivers/pci/controller/dwc/pcie-keembay.c | 1 + > > > > drivers/pci/controller/dwc/pcie-qcom-ep.c | 1 + > > > > drivers/pci/controller/dwc/pcie-rcar-gen4.c | 1 + > > > > drivers/pci/controller/dwc/pcie-stm32-ep.c | 1 + > > > > drivers/pci/controller/dwc/pcie-tegra194.c | 1 + > > > > drivers/pci/controller/dwc/pcie-uniphier-ep.c | 2 + > > > > drivers/pci/endpoint/pci-epc-core.c | 8 + > > > > include/linux/pci-epc.h | 9 + > > > > include/linux/pci-epf.h | 27 +++ > > > > 18 files changed, 285 insertions(+), 10 deletions(-) > > > > > > Hi Mani, Bjorn, > > > > > > Based on the feedback so far (thanks to Niklas and Frank), the design seems > > > to be converging. At this point, I would appreciate confirmation on the > > > following points before proceeding further. > > > > > > 1) Does the current (v8) approach for BAR subrange inbound mapping at the > > > EPC/core level look reasonable? > > > > > Hi Mani, > > Thanks for the question. > > > > > In this series you didn't add a consumer of this subrange mapping, which I > > believe is the epf-vntb driver [1]. Even so I don't see a justification of why > > the BAR needs to be split into multiple subranges. Can you explain that? > > Yes, the first consumer I have in mind is epf-vntb / remote eDMA-backed NTB > work referenced in [1]. > > The motivation for BAR subrange mapping is that some EP platforms > effectively have only two practically usable BARs, while needing multiple > logically independent inbound mapping. > > For example, on Renesas R-Car Gen4 Spider, 64-bit BAR0 and BAR2 are the > only practically usable BARs, since BAR4 is only 256 bytes. epf-vntb > already needs two separate regions (config+spad and MW1 for the > data-plane), leaving no spare BAR. Adding ntb_msi requires yet another MW, > which simply does not fit unless an existing BAR is further divided. > > In theory, some vNTB regions (e.g. config+spad and dynamically allocated > memory-backed MWs) could be tightly packed into a single physically > contiguous BAR region to barely make it work. However, it immediately makes > features mutually exclusive (e.g. ntb_msi / ntb_edma cannot coexist), and > the layout becomes extremely fragile. > > Similarly, for remote eDMA-backed NTB transport, the host needs separate > inbound access to the eDMA register block and the LL regions, which are > distinct local address ranges. Without subrange mapping, the only choice is > unnatural layout (e.g. dedicating one BAR entirely to eDMA register block, > and another one to everything else that can be packed into a single locally > contiguous memory region), even when this is barely possible. > > So while some cases might be made to work by aggressive packing, they are > already at the limit on platforms such as R-Car Spider. BAR subrange > mapping allows these features to be implemented in a straightforward, > loosely-coupled, and extensible way on platforms with severely constrained > BAR resources. > Thanks for the explanation, makes sense. When you respin this series, please include it in cover letter and relevant commit message. - Mani -- மணிவண்ணன் சதாசிவம்
© 2016 - 2026 Red Hat, Inc.