* [PATCH v2 1/3] PCI: endpoint: pci-epf-test: Handle -ENOSPC in subrange_setup
2026-03-23 8:15 [PATCH v2 0/3] Skip subrange map tests on DWC iATU allocation failure Christian Bruel
@ 2026-03-23 8:15 ` Christian Bruel
2026-03-23 10:21 ` Niklas Cassel
2026-03-23 8:15 ` [PATCH v2 2/3] misc: pci_endpoint_test: Handle -ENOSPC in subrange mapping test case Christian Bruel
2026-03-23 8:15 ` [PATCH v2 3/3] selftests: pci_endpoint: Skip BAR subrange test on -ENOSPC Christian Bruel
2 siblings, 1 reply; 7+ messages in thread
From: Christian Bruel @ 2026-03-23 8:15 UTC (permalink / raw)
To: Manivannan Sadhasivam, Krzysztof Wilczyński,
Kishon Vijay Abraham I, Shuah Khan, Bjorn Helgaas, Arnd Bergmann,
Greg Kroah-Hartman, Koichiro Den, Niklas Cassel
Cc: fabrice.gasnier, linux-pci, linux-kselftest, linux-kernel,
Christian Bruel
Set the STATUS_NO_RESOURCE status bit on pci_epc_set_bar() -ENOSPC.
Here this is used to indicate there are not enough inbound window resources
to allocate the subrange.
Signed-off-by: Christian Bruel <christian.bruel@foss.st.com>
---
drivers/pci/endpoint/functions/pci-epf-test.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index 06bf53b28fb7ae2244a6d82bd5fe76d40db830b7..591d301fa89d89addf5df16e775e80460b689589 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -54,6 +54,7 @@
#define STATUS_BAR_SUBRANGE_SETUP_FAIL BIT(15)
#define STATUS_BAR_SUBRANGE_CLEAR_SUCCESS BIT(16)
#define STATUS_BAR_SUBRANGE_CLEAR_FAIL BIT(17)
+#define STATUS_NO_RESOURCE BIT(18)
#define FLAG_USE_DMA BIT(0)
@@ -901,6 +902,8 @@ static void pci_epf_test_bar_subrange_setup(struct pci_epf_test *epf_test,
ret = pci_epc_set_bar(epc, epf->func_no, epf->vfunc_no, bar);
if (ret) {
dev_err(&epf->dev, "pci_epc_set_bar() failed: %d\n", ret);
+ if (ret == -ENOSPC)
+ status |= STATUS_NO_RESOURCE;
bar->submap = old_submap;
bar->num_submap = old_nsub;
ret = pci_epc_set_bar(epc, epf->func_no, epf->vfunc_no, bar);
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v2 1/3] PCI: endpoint: pci-epf-test: Handle -ENOSPC in subrange_setup
2026-03-23 8:15 ` [PATCH v2 1/3] PCI: endpoint: pci-epf-test: Handle -ENOSPC in subrange_setup Christian Bruel
@ 2026-03-23 10:21 ` Niklas Cassel
0 siblings, 0 replies; 7+ messages in thread
From: Niklas Cassel @ 2026-03-23 10:21 UTC (permalink / raw)
To: Christian Bruel
Cc: Manivannan Sadhasivam, Krzysztof Wilczyński,
Kishon Vijay Abraham I, Shuah Khan, Bjorn Helgaas, Arnd Bergmann,
Greg Kroah-Hartman, Koichiro Den, fabrice.gasnier, linux-pci,
linux-kselftest, linux-kernel
On Mon, Mar 23, 2026 at 09:15:23AM +0100, Christian Bruel wrote:
> Set the STATUS_NO_RESOURCE status bit on pci_epc_set_bar() -ENOSPC.
> Here this is used to indicate there are not enough inbound window resources
> to allocate the subrange.
>
> Signed-off-by: Christian Bruel <christian.bruel@foss.st.com>
> ---
Reviewed-by: Niklas Cassel <cassel@kernel.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/3] misc: pci_endpoint_test: Handle -ENOSPC in subrange mapping test case
2026-03-23 8:15 [PATCH v2 0/3] Skip subrange map tests on DWC iATU allocation failure Christian Bruel
2026-03-23 8:15 ` [PATCH v2 1/3] PCI: endpoint: pci-epf-test: Handle -ENOSPC in subrange_setup Christian Bruel
@ 2026-03-23 8:15 ` Christian Bruel
2026-03-23 10:22 ` Niklas Cassel
2026-03-23 8:15 ` [PATCH v2 3/3] selftests: pci_endpoint: Skip BAR subrange test on -ENOSPC Christian Bruel
2 siblings, 1 reply; 7+ messages in thread
From: Christian Bruel @ 2026-03-23 8:15 UTC (permalink / raw)
To: Manivannan Sadhasivam, Krzysztof Wilczyński,
Kishon Vijay Abraham I, Shuah Khan, Bjorn Helgaas, Arnd Bergmann,
Greg Kroah-Hartman, Koichiro Den, Niklas Cassel
Cc: fabrice.gasnier, linux-pci, linux-kselftest, linux-kernel,
Christian Bruel
Return -ENOSPC when the status reports the STATUS_NO_RESOURCE bit.
This signifies to the pci_endpoint test to skip this test.
Signed-off-by: Christian Bruel <christian.bruel@foss.st.com>
---
drivers/misc/pci_endpoint_test.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index 55e128ed82f00ae13b6fe9768cdbe56adbe8f9da..202196adf8ad84106ab3cf72016fa791a74697ee 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -61,6 +61,7 @@
#define STATUS_BAR_SUBRANGE_SETUP_FAIL BIT(15)
#define STATUS_BAR_SUBRANGE_CLEAR_SUCCESS BIT(16)
#define STATUS_BAR_SUBRANGE_CLEAR_FAIL BIT(17)
+#define STATUS_NO_RESOURCE BIT(18)
#define PCI_ENDPOINT_TEST_LOWER_SRC_ADDR 0x0c
#define PCI_ENDPOINT_TEST_UPPER_SRC_ADDR 0x10
@@ -477,7 +478,7 @@ static int pci_endpoint_test_bar_subrange_cmd(struct pci_endpoint_test *test,
status = pci_endpoint_test_readl(test, PCI_ENDPOINT_TEST_STATUS);
if (status & fail_bit)
- return -EIO;
+ return (status & STATUS_NO_RESOURCE) ? -ENOSPC : -EIO;
if (!(status & ok_bit))
return -EIO;
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/3] misc: pci_endpoint_test: Handle -ENOSPC in subrange mapping test case
2026-03-23 8:15 ` [PATCH v2 2/3] misc: pci_endpoint_test: Handle -ENOSPC in subrange mapping test case Christian Bruel
@ 2026-03-23 10:22 ` Niklas Cassel
0 siblings, 0 replies; 7+ messages in thread
From: Niklas Cassel @ 2026-03-23 10:22 UTC (permalink / raw)
To: Christian Bruel
Cc: Manivannan Sadhasivam, Krzysztof Wilczyński,
Kishon Vijay Abraham I, Shuah Khan, Bjorn Helgaas, Arnd Bergmann,
Greg Kroah-Hartman, Koichiro Den, fabrice.gasnier, linux-pci,
linux-kselftest, linux-kernel
On Mon, Mar 23, 2026 at 09:15:24AM +0100, Christian Bruel wrote:
> Return -ENOSPC when the status reports the STATUS_NO_RESOURCE bit.
> This signifies to the pci_endpoint test to skip this test.
>
> Signed-off-by: Christian Bruel <christian.bruel@foss.st.com>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 3/3] selftests: pci_endpoint: Skip BAR subrange test on -ENOSPC
2026-03-23 8:15 [PATCH v2 0/3] Skip subrange map tests on DWC iATU allocation failure Christian Bruel
2026-03-23 8:15 ` [PATCH v2 1/3] PCI: endpoint: pci-epf-test: Handle -ENOSPC in subrange_setup Christian Bruel
2026-03-23 8:15 ` [PATCH v2 2/3] misc: pci_endpoint_test: Handle -ENOSPC in subrange mapping test case Christian Bruel
@ 2026-03-23 8:15 ` Christian Bruel
2026-03-23 10:22 ` Niklas Cassel
2 siblings, 1 reply; 7+ messages in thread
From: Christian Bruel @ 2026-03-23 8:15 UTC (permalink / raw)
To: Manivannan Sadhasivam, Krzysztof Wilczyński,
Kishon Vijay Abraham I, Shuah Khan, Bjorn Helgaas, Arnd Bergmann,
Greg Kroah-Hartman, Koichiro Den, Niklas Cassel
Cc: fabrice.gasnier, linux-pci, linux-kselftest, linux-kernel,
Christian Bruel
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
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v2 3/3] selftests: pci_endpoint: Skip BAR subrange test on -ENOSPC
2026-03-23 8:15 ` [PATCH v2 3/3] selftests: pci_endpoint: Skip BAR subrange test on -ENOSPC Christian Bruel
@ 2026-03-23 10:22 ` Niklas Cassel
0 siblings, 0 replies; 7+ messages in thread
From: Niklas Cassel @ 2026-03-23 10:22 UTC (permalink / raw)
To: Christian Bruel
Cc: Manivannan Sadhasivam, Krzysztof Wilczyński,
Kishon Vijay Abraham I, Shuah Khan, Bjorn Helgaas, Arnd Bergmann,
Greg Kroah-Hartman, Koichiro Den, fabrice.gasnier, linux-pci,
linux-kselftest, linux-kernel
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>
^ permalink raw reply [flat|nested] 7+ messages in thread