From: Niklas Cassel <cassel@kernel.org>
To: Christian Bruel <christian.bruel@foss.st.com>
Cc: "Koichiro Den" <den@valinux.co.jp>,
"Bjorn Helgaas" <helgaas@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Frank Li" <Frank.Li@nxp.com>, "Kees Cook" <kees@kernel.org>,
"Shin'ichiro Kawasaki" <shinichiro.kawasaki@wdc.com>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Bhanu Seshu Kumar Valluri" <bhanuseshukumar@gmail.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: endpoint: pci-epf-test: Roll back BAR mapping when subrange setup fails
Date: Wed, 18 Mar 2026 09:58:08 +0100 [thread overview]
Message-ID: <abppG38Zic1Z0Kuq@ryzen> (raw)
In-Reply-To: <0df07ae2-3e01-41d6-b857-01f5a81adbf8@foss.st.com>
On Wed, Mar 18, 2026 at 09:35:10AM +0100, Christian Bruel wrote:
>
>
> > > >
> > > > I think "modify TEST_F to SKIP if ENOSPC",
> > > > since it will solve the problem for all platforms that have few
> > > > inbound iATUs.
> > >
> > > That sounds like the right direction, though I think we would first
> > > need a way
> > > to propagate -ENOSPC back to the host side, instead of just
> > > collapsing all
> > > EP-side setup failures into STATUS_BAR_SUBRANGE_SETUP_FAIL, which
> > > pci_endpoint_test currently maps to -EIO.
> > >
> >
> > I think the epf test function can return several bits in the status
> > mask, in addition of STATUS_BAR_SUBRANGE_SETUP_FAIL. e.g
> > STATUS_BAR_SUBRANGE_SETUP_SKIP, or STATUS_BAR_SUBRANGE_SETUP_NOSPC.
> > I prefer the former since we want to pass the cause, not the action and
> > let the skip decision to the host
> >
>
> Rethinking this, having a pci_epc_feature to limit the maximum number of
> simultaneously allocatable BARs might be a useful addition to the EPC
> driver. The epc driver would need to keep track of the allocated BARs and
> check it before calling set_bar() for skipping or not.
The limitation is not allocatable BARs, it is the number of inbound/outbound
iATUs/windows.
(E.g. with inbound subrange mapping one BAR could be split in 3, and require
three different iATUs, but another BAR is not split, so just requires one
iATU.)
Right now, a big limitation in the PCI endpoint framework, is that there is
currently no API to see how many inbound/outbound iATUs that are currently
in use.
So the only thing you can do is to call mem_map() and see if you get an
error. This is a bit wasteful, as in some cases, you could probably
skip/wait with a lot of processing, if you knew that there was no free
iATUs windows available.
However, I think such API would be most useful for outbound mapping.
I.e. endpoint to host transfers. Think of e.g. nvmet-pci-epf, you can
easily have a queue depth of 128, so 128 outbound mappings at the same
time.
For inbound mappings, you can only ever map BARs, so in comparison
to outbound mappings, inbound mappings are very limited.
6 BARs, and sure, with inbound subrange mapping you can have a few
windows per BAR, but this is usually something the EPF driver does a
.bind() time, even before any transfers have taken place.
If set_bar() fails with -ENOSPC or something to indicate no free window,
I would imagine that that that is good enough for most EPF drivers.
>
> Do you think this added (minor) complexity is worth it compared to simply
> returning ENOSPC in the status?
TL;DL: I think a number of free windows API would be a good addition,
but for outbound windows.
For inbound windows, it seems a bit unnecessary IMO.
Kind regards,
Niklas
next prev parent reply other threads:[~2026-03-18 8:58 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-16 14:02 [PATCH] PCI: endpoint: pci-epf-test: Roll back BAR mapping when subrange setup fails Koichiro Den
2026-03-16 14:36 ` Koichiro Den
2026-03-16 14:41 ` Koichiro Den
2026-03-16 16:19 ` Niklas Cassel
2026-03-17 2:57 ` Koichiro Den
2026-03-17 3:27 ` Manivannan Sadhasivam
2026-03-17 9:13 ` Christian Bruel
2026-03-17 9:24 ` Niklas Cassel
2026-03-17 9:55 ` Christian Bruel
2026-03-17 10:01 ` Christian Bruel
2026-03-17 10:12 ` Niklas Cassel
2026-03-17 10:29 ` Christian Bruel
2026-03-17 10:46 ` Niklas Cassel
2026-03-17 15:14 ` Koichiro Den
2026-03-18 8:02 ` Christian Bruel
2026-03-18 8:35 ` Christian Bruel
2026-03-18 8:58 ` Niklas Cassel [this message]
2026-03-18 12:58 ` Christian Bruel
2026-03-17 15:17 ` Koichiro Den
2026-03-17 9:59 ` Manivannan Sadhasivam
2026-03-17 10:02 ` Christian Bruel
2026-03-17 10:05 ` Niklas Cassel
2026-03-17 15:27 ` Bjorn Helgaas
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=abppG38Zic1Z0Kuq@ryzen \
--to=cassel@kernel.org \
--cc=Frank.Li@nxp.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=bhanuseshukumar@gmail.com \
--cc=christian.bruel@foss.st.com \
--cc=den@valinux.co.jp \
--cc=helgaas@kernel.org \
--cc=kees@kernel.org \
--cc=kishon@kernel.org \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mani@kernel.org \
--cc=shinichiro.kawasaki@wdc.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