From: Niklas Cassel <cassel@kernel.org>
To: Koichiro Den <den@valinux.co.jp>
Cc: Manivannan Sadhasivam <mani@kernel.org>,
bhelgaas@google.com, kwilczynski@kernel.org, frank.li@nxp.com,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 0/5] PCI: endpoint: BAR subrange mapping support
Date: Fri, 23 Jan 2026 15:57:25 +0100 [thread overview]
Message-ID: <aXOMVYowDxHBL8kg@ryzen> (raw)
In-Reply-To: <t2hsk77mp3shacbehlqfnpjgc4az2phvo2cyjn5hkybqdmzrcj@hnuwporebhz2>
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
next prev parent reply other threads:[~2026-01-23 14:57 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-15 8:49 [PATCH v8 0/5] PCI: endpoint: BAR subrange mapping support Koichiro Den
2026-01-15 8:49 ` [PATCH v8 1/5] PCI: endpoint: Add dynamic_inbound_mapping EPC feature Koichiro Den
2026-01-15 8:49 ` [PATCH v8 2/5] PCI: endpoint: Add BAR subrange mapping support Koichiro Den
2026-01-15 14:52 ` Frank Li
2026-01-15 15:21 ` Niklas Cassel
2026-01-15 19:44 ` Frank Li
2026-01-19 8:42 ` Koichiro Den
2026-01-15 8:49 ` [PATCH v8 3/5] PCI: dwc: Advertise dynamic inbound " Koichiro Den
2026-01-15 14:54 ` Frank Li
2026-01-15 8:49 ` [PATCH v8 4/5] PCI: dwc: ep: Support BAR subrange inbound mapping via Address Match Mode iATU Koichiro Den
2026-01-15 15:22 ` Frank Li
2026-01-15 8:49 ` [PATCH v8 5/5] Documentation: PCI: endpoint: Clarify pci_epc_set_bar() usage Koichiro Den
2026-01-15 15:23 ` Frank Li
2026-01-19 13:00 ` [PATCH v8 0/5] PCI: endpoint: BAR subrange mapping support Koichiro Den
2026-01-21 15:38 ` Manivannan Sadhasivam
2026-01-22 1:52 ` Koichiro Den
2026-01-22 6:46 ` Manivannan Sadhasivam
2026-01-22 8:45 ` Niklas Cassel
2026-01-22 14:02 ` Koichiro Den
2026-01-22 15:17 ` Niklas Cassel
2026-01-23 0:36 ` Koichiro Den
2026-01-23 7:11 ` Koichiro Den
2026-01-23 8:35 ` Niklas Cassel
2026-01-23 10:16 ` Niklas Cassel
2026-01-23 14:08 ` Koichiro Den
2026-01-23 14:57 ` Niklas Cassel [this message]
2026-01-26 14:26 ` Koichiro Den
2026-01-26 19:08 ` Niklas Cassel
2026-01-23 15:26 ` Niklas Cassel
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=aXOMVYowDxHBL8kg@ryzen \
--to=cassel@kernel.org \
--cc=bhelgaas@google.com \
--cc=den@valinux.co.jp \
--cc=frank.li@nxp.com \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mani@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