[PATCH v2 3/3] selftests: pci_endpoint: Skip BAR subrange test on -ENOSPC

Christian Bruel posted 3 patches 1 week, 4 days ago
There is a newer version of this series
[PATCH v2 3/3] selftests: pci_endpoint: Skip BAR subrange test on -ENOSPC
Posted by Christian Bruel 1 week, 4 days ago
Handle -ENOSPC error. Skip the test if the number of available inbound
windows is insufficient to map the subrange.

Signed-off-by: Christian Bruel <christian.bruel@foss.st.com>
---
 tools/testing/selftests/pci_endpoint/pci_endpoint_test.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c b/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
index c417fb3a198b2d92c3060938c23807cc8bea5573..97212a0b41c930f981687086b588b056cf44ee62 100644
--- a/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
+++ b/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
@@ -88,6 +88,8 @@ TEST_F(pci_ep_bar, BAR_SUBRANGE_TEST)
 		SKIP(return, "Subrange map is not supported");
 	if (ret == -ENOBUFS)
 		SKIP(return, "BAR is reserved");
+	if (ret == -ENOSPC)
+		SKIP(return, "Not enough BAR inbound windows");
 	EXPECT_FALSE(ret) TH_LOG("Test failed for BAR%d", variant->barno);
 }
 

-- 
2.34.1
Re: [PATCH v2 3/3] selftests: pci_endpoint: Skip BAR subrange test on -ENOSPC
Posted by Niklas Cassel 1 week, 4 days ago
On Mon, Mar 23, 2026 at 09:15:25AM +0100, Christian Bruel wrote:
> Handle -ENOSPC error. Skip the test if the number of available inbound
> windows is insufficient to map the subrange.
> 
> Signed-off-by: Christian Bruel <christian.bruel@foss.st.com>
> ---
>  tools/testing/selftests/pci_endpoint/pci_endpoint_test.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c b/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
> index c417fb3a198b2d92c3060938c23807cc8bea5573..97212a0b41c930f981687086b588b056cf44ee62 100644
> --- a/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
> +++ b/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
> @@ -88,6 +88,8 @@ TEST_F(pci_ep_bar, BAR_SUBRANGE_TEST)
>  		SKIP(return, "Subrange map is not supported");
>  	if (ret == -ENOBUFS)
>  		SKIP(return, "BAR is reserved");
> +	if (ret == -ENOSPC)
> +		SKIP(return, "Not enough BAR inbound windows");

Nit: I would probably just print:
"Not enough PCI inbound windows"
or
"Not enough inbound windows"

E.g. DWC inbound iATU supports both BAR match mode and address match mode,
so from a pure hardware perspective, I guess the inbound translation just
matches based on the PCI TLP address (with some extra logic for this to
automatically use the correct PCI address when using BAR match mode).

Thus, I slightly prefer to not include 'BAR' in the print.

Regardless:
Reviewed-by: Niklas Cassel <cassel@kernel.org>