* [PATCH v4 1/3] PCI: endpoint: pci-epf-test: Handle -ENOSPC in subrange_setup
2026-04-07 12:04 [PATCH v4 0/3] Skip subrange map tests on DWC iATU allocation failure Christian Bruel
@ 2026-04-07 12:04 ` Christian Bruel
2026-04-07 12:04 ` [PATCH v4 2/3] misc: pci_endpoint_test: Handle -ENOSPC in subrange mapping test case Christian Bruel
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Christian Bruel @ 2026-04-07 12:04 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, Frank Li
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>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Koichiro Den <den@valinux.co.jp>
---
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 14e61ebe1f116ce04789b6f4c3e965296701ec53..7eb94dffac2d193477a43decd7b952c78b99eb5f 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;
kfree(submap);
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v4 2/3] misc: pci_endpoint_test: Handle -ENOSPC in subrange mapping test case
2026-04-07 12:04 [PATCH v4 0/3] Skip subrange map tests on DWC iATU allocation failure Christian Bruel
2026-04-07 12:04 ` [PATCH v4 1/3] PCI: endpoint: pci-epf-test: Handle -ENOSPC in subrange_setup Christian Bruel
@ 2026-04-07 12:04 ` Christian Bruel
2026-04-07 12:04 ` [PATCH v4 3/3] selftests: pci_endpoint: Skip BAR subrange test on -ENOSPC Christian Bruel
2026-04-07 14:11 ` [PATCH v4 0/3] Skip subrange map tests on DWC iATU allocation failure Manivannan Sadhasivam
3 siblings, 0 replies; 6+ messages in thread
From: Christian Bruel @ 2026-04-07 12:04 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, Frank Li
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>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Koichiro Den <den@valinux.co.jp>
---
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 38679dfb1f9b67d92a2d0d90a1a58b72ea9fde6b..dbd017cabbb92394c20d07c478518f5fefe2067e 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
@@ -480,7 +481,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] 6+ messages in thread
* [PATCH v4 3/3] selftests: pci_endpoint: Skip BAR subrange test on -ENOSPC
2026-04-07 12:04 [PATCH v4 0/3] Skip subrange map tests on DWC iATU allocation failure Christian Bruel
2026-04-07 12:04 ` [PATCH v4 1/3] PCI: endpoint: pci-epf-test: Handle -ENOSPC in subrange_setup Christian Bruel
2026-04-07 12:04 ` [PATCH v4 2/3] misc: pci_endpoint_test: Handle -ENOSPC in subrange mapping test case Christian Bruel
@ 2026-04-07 12:04 ` Christian Bruel
2026-04-07 14:11 ` [PATCH v4 0/3] Skip subrange map tests on DWC iATU allocation failure Manivannan Sadhasivam
3 siblings, 0 replies; 6+ messages in thread
From: Christian Bruel @ 2026-04-07 12:04 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, Frank Li
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>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Koichiro Den <den@valinux.co.jp>
---
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..588d75c97ad181d2f8e84c9b86b865439152e20d 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 inbound windows");
EXPECT_FALSE(ret) TH_LOG("Test failed for BAR%d", variant->barno);
}
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v4 0/3] Skip subrange map tests on DWC iATU allocation failure
2026-04-07 12:04 [PATCH v4 0/3] Skip subrange map tests on DWC iATU allocation failure Christian Bruel
` (2 preceding siblings ...)
2026-04-07 12:04 ` [PATCH v4 3/3] selftests: pci_endpoint: Skip BAR subrange test on -ENOSPC Christian Bruel
@ 2026-04-07 14:11 ` Manivannan Sadhasivam
2026-04-08 19:40 ` Bjorn Helgaas
3 siblings, 1 reply; 6+ messages in thread
From: Manivannan Sadhasivam @ 2026-04-07 14:11 UTC (permalink / raw)
To: Krzysztof Wilczyński, Kishon Vijay Abraham I, Shuah Khan,
Bjorn Helgaas, Arnd Bergmann, Greg Kroah-Hartman, Koichiro Den,
Niklas Cassel, Christian Bruel
Cc: fabrice.gasnier, linux-pci, linux-kselftest, linux-kernel,
Frank Li
On Tue, 07 Apr 2026 14:04:07 +0200, Christian Bruel wrote:
> For platforms with a limited iATU inbound window entries, pci_epc_set_bar()
> might fail to allocate the ATU entries for subrange maps requiring more
> than 1 slot.
> For the dwc controller, this failure is reported with -ENOSPC in
> dw_pcie_ep_set_bar(). In this case, the epf test cannot be run and needs
> to be skipped.
>
> [...]
Applied, thanks!
[1/3] PCI: endpoint: pci-epf-test: Handle -ENOSPC in subrange_setup
commit: dfac277624c82b361dbb3e0fc57f577a270bebbb
[2/3] misc: pci_endpoint_test: Handle -ENOSPC in subrange mapping test case
commit: a51c75fc48c2a0d2ead2d7e8c521de0423ec8dec
[3/3] selftests: pci_endpoint: Skip BAR subrange test on -ENOSPC
commit: 2b729b7721bd4d0640b26790ea6c360c85a4af8c
Best regards,
--
Manivannan Sadhasivam <mani@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v4 0/3] Skip subrange map tests on DWC iATU allocation failure
2026-04-07 14:11 ` [PATCH v4 0/3] Skip subrange map tests on DWC iATU allocation failure Manivannan Sadhasivam
@ 2026-04-08 19:40 ` Bjorn Helgaas
0 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2026-04-08 19:40 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: Krzysztof Wilczyński, Kishon Vijay Abraham I, Shuah Khan,
Bjorn Helgaas, Arnd Bergmann, Greg Kroah-Hartman, Koichiro Den,
Niklas Cassel, Christian Bruel, fabrice.gasnier, linux-pci,
linux-kselftest, linux-kernel, Frank Li
On Tue, Apr 07, 2026 at 07:41:50PM +0530, Manivannan Sadhasivam wrote:
> On Tue, 07 Apr 2026 14:04:07 +0200, Christian Bruel wrote:
> > For platforms with a limited iATU inbound window entries, pci_epc_set_bar()
> > might fail to allocate the ATU entries for subrange maps requiring more
> > than 1 slot.
> > For the dwc controller, this failure is reported with -ENOSPC in
> > dw_pcie_ep_set_bar(). In this case, the epf test cannot be run and needs
> > to be skipped.
> >
> > [...]
>
> Applied, thanks!
>
> [1/3] PCI: endpoint: pci-epf-test: Handle -ENOSPC in subrange_setup
> commit: dfac277624c82b361dbb3e0fc57f577a270bebbb
> [2/3] misc: pci_endpoint_test: Handle -ENOSPC in subrange mapping test case
> commit: a51c75fc48c2a0d2ead2d7e8c521de0423ec8dec
> [3/3] selftests: pci_endpoint: Skip BAR subrange test on -ENOSPC
> commit: 2b729b7721bd4d0640b26790ea6c360c85a4af8c
I squashed these together because they need to be understood together.
I'm missing the details, but it seems unfortunate that the COMMAND_*,
STATUS_*, and CAP_* definitions have to be duplicated and presumably
kept in sync in drivers/misc/pci_endpoint_test.c and
drivers/pci/endpoint/functions/pci-epf-test.c.
^ permalink raw reply [flat|nested] 6+ messages in thread