public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: Christian Bruel <christian.bruel@foss.st.com>
Cc: "Manivannan Sadhasivam" <mani@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Shuah Khan" <shuah@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Koichiro Den" <den@valinux.co.jp>,
	fabrice.gasnier@foss.st.com, linux-pci@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] misc: pci_endpoint_test: Handle -ENOSPC in subrange mapping test case
Date: Fri, 20 Mar 2026 14:43:40 +0100	[thread overview]
Message-ID: <ab1PDA1QBMXF_50E@ryzen> (raw)
In-Reply-To: <e6b385b5-f61c-4b0d-82ed-4018db76538f@foss.st.com>

On Fri, Mar 20, 2026 at 02:25:10PM +0100, Christian Bruel wrote:
> On 3/20/26 12:16, Niklas Cassel wrote:
> > 
> > FWIW, I think an even better solution is to introduce a new register,
> > named e.g. errno in struct pci_epf_test_reg;
> > 
> > That way, we don't need to take a new bit, e.g.:
> > +#define STATUS_BAR_SUBRANGE_SETUP_NOSPC          BIT(18)
> > 
> > For every unique error code a command can return.
> > 
> > We would simply return STATUS_BAR_SUBRANGE_CLEAR_FAIL, and then the host
> > side driver looks at the errno register to see the specific error code.
> > 
> > This way, all other _FAIL commands could also return a more specific error
> > in case of failure.

(snip)

> But it is not consistent with other tests that use the status field to carry
> error information. For example, pci_epf_test_read/write/copy, set the
> STATUS_SRC/DTS_ADDR_INVALID bit to distinguish these errors from other
> -EINVAL.
> 
> Introducing a new errno field would result in having two different APIs for
> returning failure status.
> 
> In light of the STATUS_SRC/DST_ADDR_INVALID usage, I wonder if my initial
> proposal to set a status bit along with the FAIL bit might actually be
> simpler and more consistent what is already done here.

You are right that the read/write/copy tests actually set two bits in the
status register.

With:
#define STATUS_SRC_ADDR_INVALID         BIT(7)
#define STATUS_DST_ADDR_INVALID         BIT(8)

Potentially being reused by the write/copy/read tests.

At least these bits are reuse for more than one test case.

So, perhaps to keep things in line with the existing design
perhaps just name the new bit something like:

#define STATUS_SKIP_INSUFFICIENT_RESOURCES	BIT(18)

or something like that.

At least then, other test cases will be able to reuse this status bit,
just like multiple test cases can use the STATUS_SRC_ADDR_INVALID status
bits.


And yes, I agree that, like you do in your initial proposal, having this
new STATUS_SKIP_INSUFFICIENT_RESOURCES bit set in addition to the
STATUS_BAR_SUBRANGE_CLEAR_FAIL bit, is probably the best way forward that
is in line with the current design.


Kind regards,
Niklas

      reply	other threads:[~2026-03-20 13:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18 14:46 [PATCH 0/3] Skip subrange map tests on DWC iATU allocation failure Christian Bruel
2026-03-18 14:46 ` [PATCH 1/3] selftests: pci_endpoint: Skip subrange map test if iATU allocation fails Christian Bruel
2026-03-18 15:32   ` Niklas Cassel
2026-03-19  1:28   ` Koichiro Den
2026-03-19  8:47     ` Niklas Cassel
2026-03-20 13:41       ` Koichiro Den
2026-03-20 10:04     ` Christian Bruel
2026-03-20 14:05       ` Koichiro Den
2026-03-20 14:19         ` Christian Bruel
2026-03-20 15:33           ` Koichiro Den
2026-03-18 14:46 ` [PATCH 2/3] PCI: endpoint: pci-epf-test: Handle -ENOSPC in subrange map test Christian Bruel
2026-03-18 15:50   ` Niklas Cassel
2026-03-18 14:46 ` [PATCH 3/3] misc: pci_endpoint_test: Handle -ENOSPC in subrange mapping test case Christian Bruel
2026-03-18 16:03   ` Niklas Cassel
2026-03-20  9:35     ` Christian Bruel
2026-03-20 11:16       ` Niklas Cassel
2026-03-20 13:25         ` Christian Bruel
2026-03-20 13:43           ` Niklas Cassel [this message]

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=ab1PDA1QBMXF_50E@ryzen \
    --to=cassel@kernel.org \
    --cc=arnd@arndb.de \
    --cc=bhelgaas@google.com \
    --cc=christian.bruel@foss.st.com \
    --cc=den@valinux.co.jp \
    --cc=fabrice.gasnier@foss.st.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kishon@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=shuah@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