[PATCH 2/3] PCI: endpoint: pci-epf-test: Handle -ENOSPC in subrange map test
From: Christian Bruel
Date: Wed Mar 18 2026 - 10:56:00 EST
Report pci_epc_set_bar() -ENOSPC failure with the
STATUS_BAR_SUBRANGE_SETUP_NOSPC status bit. This can be used to
skip the subrange test if there is not enough iATU resources to
allocate it.
Link: https://lore.kernel.org/linux-pci/20260317152707.GA85951@bhelgaas/T/#m87e4c24173097a0ea70195b71aab294ad8d6c283
Signed-off-by: Christian Bruel <christian.bruel@xxxxxxxxxxx>
---
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..6437f08f0cd4bd4645e380c915b7cf81e66b7c35 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_BAR_SUBRANGE_SETUP_NOSPC BIT(18)
#define FLAG_USE_DMA BIT(0)
@@ -903,6 +904,8 @@ static void pci_epf_test_bar_subrange_setup(struct pci_epf_test *epf_test,
dev_err(&epf->dev, "pci_epc_set_bar() failed: %d\n", ret);
bar->submap = old_submap;
bar->num_submap = old_nsub;
+ if (ret == -ENOSPC)
+ status |= STATUS_BAR_SUBRANGE_SETUP_NOSPC;
kfree(submap);
goto err;
}
--
2.34.1