* [PATCH 0/3] PCI: endpoint tests: Make doorbell test capability-aware
@ 2026-02-15 15:03 Koichiro Den
2026-02-15 15:03 ` [PATCH 1/3] PCI: endpoint: pci-epf-test: Advertise dynamic inbound mapping support Koichiro Den
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Koichiro Den @ 2026-02-15 15:03 UTC (permalink / raw)
To: mani, kwilczynski, kishon, bhelgaas, shuah, cassel, Frank.Li
Cc: linux-pci, linux-kernel, linux-kselftest
Hi,
The pci-epf-test / pci_endpoint_test doorbell path requires the endpoint
controller (EPC) driver to support dynamic inbound mapping. Without it, the
host-side test can run anyway and fail in vain.
This series makes the doorbell test capability-aware by:
- Advertising dynamic inbound mapping support from pci-epf-test via a
new CAP_DYNAMIC_INBOUND_MAPPING bit.
- Returning -EOPNOTSUPP for PCITEST_DOORBELL when the endpoint does not
advertise this capability.
- Skipping the kselftest doorbell case when -EOPNOTSUPP is returned.
This small series is derived from Niklas's suggestion:
https://lore.kernel.org/linux-pci/aYte-7hTxb7kXNlQ@ryzen/
Thanks,
Koichiro Den (3):
PCI: endpoint: pci-epf-test: Advertise dynamic inbound mapping support
misc: pci_endpoint_test: Gate doorbell test on dynamic inbound mapping
selftests: pci_endpoint: Skip doorbell test when unsupported
drivers/misc/pci_endpoint_test.c | 4 ++++
drivers/pci/endpoint/functions/pci-epf-test.c | 4 ++++
tools/testing/selftests/pci_endpoint/pci_endpoint_test.c | 2 ++
3 files changed, 10 insertions(+)
--
2.51.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] PCI: endpoint: pci-epf-test: Advertise dynamic inbound mapping support
2026-02-15 15:03 [PATCH 0/3] PCI: endpoint tests: Make doorbell test capability-aware Koichiro Den
@ 2026-02-15 15:03 ` Koichiro Den
2026-02-16 10:38 ` Niklas Cassel
2026-02-15 15:03 ` [PATCH 2/3] misc: pci_endpoint_test: Gate doorbell test on dynamic inbound mapping Koichiro Den
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Koichiro Den @ 2026-02-15 15:03 UTC (permalink / raw)
To: mani, kwilczynski, kishon, bhelgaas, shuah, cassel, Frank.Li
Cc: linux-pci, linux-kernel, linux-kselftest
The doorbell test requires the EPC driver to support dynamic inbound
mapping so the host can map the doorbell target address into a BAR
aperture.
Expose epc_features->dynamic_inbound_mapping via a new
CAP_DYNAMIC_INBOUND_MAPPING bit in the pci-epf-test capability register,
so the host-side pci_endpoint_test driver can detect missing support and
return -EOPNOTSUPP instead of running the test fruitlessly.
Suggested-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Koichiro Den <den@valinux.co.jp>
---
drivers/pci/endpoint/functions/pci-epf-test.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index 0cb7af0919dc..c0db207ff143 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -64,6 +64,7 @@
#define CAP_MSIX BIT(2)
#define CAP_INTX BIT(3)
#define CAP_SUBRANGE_MAPPING BIT(4)
+#define CAP_DYNAMIC_INBOUND_MAPPING BIT(5)
#define PCI_EPF_TEST_BAR_SUBRANGE_NSUB 2
@@ -1102,6 +1103,9 @@ static void pci_epf_test_set_capabilities(struct pci_epf *epf)
if (epf_test->epc_features->intx_capable)
caps |= CAP_INTX;
+ if (epf_test->epc_features->dynamic_inbound_mapping)
+ caps |= CAP_DYNAMIC_INBOUND_MAPPING;
+
if (epf_test->epc_features->dynamic_inbound_mapping &&
epf_test->epc_features->subrange_mapping)
caps |= CAP_SUBRANGE_MAPPING;
--
2.51.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] misc: pci_endpoint_test: Gate doorbell test on dynamic inbound mapping
2026-02-15 15:03 [PATCH 0/3] PCI: endpoint tests: Make doorbell test capability-aware Koichiro Den
2026-02-15 15:03 ` [PATCH 1/3] PCI: endpoint: pci-epf-test: Advertise dynamic inbound mapping support Koichiro Den
@ 2026-02-15 15:03 ` Koichiro Den
2026-02-16 10:38 ` Niklas Cassel
2026-02-15 15:03 ` [PATCH 3/3] selftests: pci_endpoint: Skip doorbell test when unsupported Koichiro Den
2026-02-24 10:32 ` [PATCH 0/3] PCI: endpoint tests: Make doorbell test capability-aware Manivannan Sadhasivam
3 siblings, 1 reply; 8+ messages in thread
From: Koichiro Den @ 2026-02-15 15:03 UTC (permalink / raw)
To: mani, kwilczynski, kishon, bhelgaas, shuah, cassel, Frank.Li
Cc: linux-pci, linux-kernel, linux-kselftest
The doorbell test relies on the endpoint being able to update inbound
translations at runtime so the host can reach the doorbell target
through a BAR mapping.
If the endpoint does not advertise CAP_DYNAMIC_INBOUND_MAPPING, return
-EOPNOTSUPP from PCITEST_DOORBELL.
This avoids confusing failures in user space and kselftests when the
required capability is not available.
Suggested-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Koichiro Den <den@valinux.co.jp>
---
drivers/misc/pci_endpoint_test.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index 74ab5b5b9011..93cd57d20881 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -84,6 +84,7 @@
#define CAP_MSIX BIT(2)
#define CAP_INTX BIT(3)
#define CAP_SUBRANGE_MAPPING BIT(4)
+#define CAP_DYNAMIC_INBOUND_MAPPING BIT(5)
#define PCI_ENDPOINT_TEST_DB_BAR 0x34
#define PCI_ENDPOINT_TEST_DB_OFFSET 0x38
@@ -1060,6 +1061,9 @@ static int pci_endpoint_test_doorbell(struct pci_endpoint_test *test)
u32 addr;
int left;
+ if (!(test->ep_caps & CAP_DYNAMIC_INBOUND_MAPPING))
+ return -EOPNOTSUPP;
+
if (irq_type < PCITEST_IRQ_TYPE_INTX ||
irq_type > PCITEST_IRQ_TYPE_MSIX) {
dev_err(dev, "Invalid IRQ type\n");
--
2.51.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] selftests: pci_endpoint: Skip doorbell test when unsupported
2026-02-15 15:03 [PATCH 0/3] PCI: endpoint tests: Make doorbell test capability-aware Koichiro Den
2026-02-15 15:03 ` [PATCH 1/3] PCI: endpoint: pci-epf-test: Advertise dynamic inbound mapping support Koichiro Den
2026-02-15 15:03 ` [PATCH 2/3] misc: pci_endpoint_test: Gate doorbell test on dynamic inbound mapping Koichiro Den
@ 2026-02-15 15:03 ` Koichiro Den
2026-02-16 10:39 ` Niklas Cassel
2026-02-24 10:32 ` [PATCH 0/3] PCI: endpoint tests: Make doorbell test capability-aware Manivannan Sadhasivam
3 siblings, 1 reply; 8+ messages in thread
From: Koichiro Den @ 2026-02-15 15:03 UTC (permalink / raw)
To: mani, kwilczynski, kishon, bhelgaas, shuah, cassel, Frank.Li
Cc: linux-pci, linux-kernel, linux-kselftest
PCITEST_DOORBELL may return -EOPNOTSUPP when the endpoint does not
advertise CAP_DYNAMIC_INBOUND_MAPPING.
Treat this like other optional capabilities and skip the doorbell test
instead of reporting a failure.
Suggested-by: Niklas Cassel <cassel@kernel.org>
Signed-off-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 eecb776c33af..e0dbbb2af8c7 100644
--- a/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
+++ b/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
@@ -276,6 +276,8 @@ TEST_F(pcie_ep_doorbell, DOORBELL_TEST)
ASSERT_EQ(0, ret) TH_LOG("Can't set AUTO IRQ type");
pci_ep_ioctl(PCITEST_DOORBELL, 0);
+ if (ret == -EOPNOTSUPP)
+ SKIP(return, "Doorbell test is not supported");
EXPECT_FALSE(ret) TH_LOG("Test failed for Doorbell\n");
}
TEST_HARNESS_MAIN
--
2.51.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] PCI: endpoint: pci-epf-test: Advertise dynamic inbound mapping support
2026-02-15 15:03 ` [PATCH 1/3] PCI: endpoint: pci-epf-test: Advertise dynamic inbound mapping support Koichiro Den
@ 2026-02-16 10:38 ` Niklas Cassel
0 siblings, 0 replies; 8+ messages in thread
From: Niklas Cassel @ 2026-02-16 10:38 UTC (permalink / raw)
To: Koichiro Den
Cc: mani, kwilczynski, kishon, bhelgaas, shuah, Frank.Li, linux-pci,
linux-kernel, linux-kselftest
On Mon, Feb 16, 2026 at 12:03:32AM +0900, Koichiro Den wrote:
> The doorbell test requires the EPC driver to support dynamic inbound
> mapping so the host can map the doorbell target address into a BAR
> aperture.
>
> Expose epc_features->dynamic_inbound_mapping via a new
> CAP_DYNAMIC_INBOUND_MAPPING bit in the pci-epf-test capability register,
> so the host-side pci_endpoint_test driver can detect missing support and
> return -EOPNOTSUPP instead of running the test fruitlessly.
>
> Suggested-by: Niklas Cassel <cassel@kernel.org>
> Signed-off-by: Koichiro Den <den@valinux.co.jp>
> ---
Reviewed-by: Niklas Cassel <cassel@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] misc: pci_endpoint_test: Gate doorbell test on dynamic inbound mapping
2026-02-15 15:03 ` [PATCH 2/3] misc: pci_endpoint_test: Gate doorbell test on dynamic inbound mapping Koichiro Den
@ 2026-02-16 10:38 ` Niklas Cassel
0 siblings, 0 replies; 8+ messages in thread
From: Niklas Cassel @ 2026-02-16 10:38 UTC (permalink / raw)
To: Koichiro Den
Cc: mani, kwilczynski, kishon, bhelgaas, shuah, Frank.Li, linux-pci,
linux-kernel, linux-kselftest
On Mon, Feb 16, 2026 at 12:03:33AM +0900, Koichiro Den wrote:
> The doorbell test relies on the endpoint being able to update inbound
> translations at runtime so the host can reach the doorbell target
> through a BAR mapping.
>
> If the endpoint does not advertise CAP_DYNAMIC_INBOUND_MAPPING, return
> -EOPNOTSUPP from PCITEST_DOORBELL.
>
> This avoids confusing failures in user space and kselftests when the
> required capability is not available.
>
> Suggested-by: Niklas Cassel <cassel@kernel.org>
> Signed-off-by: Koichiro Den <den@valinux.co.jp>
> ---
Reviewed-by: Niklas Cassel <cassel@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] selftests: pci_endpoint: Skip doorbell test when unsupported
2026-02-15 15:03 ` [PATCH 3/3] selftests: pci_endpoint: Skip doorbell test when unsupported Koichiro Den
@ 2026-02-16 10:39 ` Niklas Cassel
0 siblings, 0 replies; 8+ messages in thread
From: Niklas Cassel @ 2026-02-16 10:39 UTC (permalink / raw)
To: Koichiro Den
Cc: mani, kwilczynski, kishon, bhelgaas, shuah, Frank.Li, linux-pci,
linux-kernel, linux-kselftest
On Mon, Feb 16, 2026 at 12:03:34AM +0900, Koichiro Den wrote:
> PCITEST_DOORBELL may return -EOPNOTSUPP when the endpoint does not
> advertise CAP_DYNAMIC_INBOUND_MAPPING.
>
> Treat this like other optional capabilities and skip the doorbell test
> instead of reporting a failure.
>
> Suggested-by: Niklas Cassel <cassel@kernel.org>
> Signed-off-by: Koichiro Den <den@valinux.co.jp>
> ---
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Thank you for doing this work!
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/3] PCI: endpoint tests: Make doorbell test capability-aware
2026-02-15 15:03 [PATCH 0/3] PCI: endpoint tests: Make doorbell test capability-aware Koichiro Den
` (2 preceding siblings ...)
2026-02-15 15:03 ` [PATCH 3/3] selftests: pci_endpoint: Skip doorbell test when unsupported Koichiro Den
@ 2026-02-24 10:32 ` Manivannan Sadhasivam
3 siblings, 0 replies; 8+ messages in thread
From: Manivannan Sadhasivam @ 2026-02-24 10:32 UTC (permalink / raw)
To: kwilczynski, kishon, bhelgaas, shuah, cassel, Frank.Li,
Koichiro Den
Cc: linux-pci, linux-kernel, linux-kselftest
On Mon, 16 Feb 2026 00:03:31 +0900, Koichiro Den wrote:
> The pci-epf-test / pci_endpoint_test doorbell path requires the endpoint
> controller (EPC) driver to support dynamic inbound mapping. Without it, the
> host-side test can run anyway and fail in vain.
>
> This series makes the doorbell test capability-aware by:
> - Advertising dynamic inbound mapping support from pci-epf-test via a
> new CAP_DYNAMIC_INBOUND_MAPPING bit.
> - Returning -EOPNOTSUPP for PCITEST_DOORBELL when the endpoint does not
> advertise this capability.
> - Skipping the kselftest doorbell case when -EOPNOTSUPP is returned.
>
> [...]
Applied, thanks!
[1/3] PCI: endpoint: pci-epf-test: Advertise dynamic inbound mapping support
commit: 9a940a3d08b25cf8e864785ee06b65756d6e4573
[2/3] misc: pci_endpoint_test: Gate doorbell test on dynamic inbound mapping
commit: 51fba4aa66192fa65a31f213218167d9af326f1e
[3/3] selftests: pci_endpoint: Skip doorbell test when unsupported
commit: b4a31737679576dc8aa6de43d3c10bfad7d3f57e
Best regards,
--
Manivannan Sadhasivam <mani@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-02-24 10:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-15 15:03 [PATCH 0/3] PCI: endpoint tests: Make doorbell test capability-aware Koichiro Den
2026-02-15 15:03 ` [PATCH 1/3] PCI: endpoint: pci-epf-test: Advertise dynamic inbound mapping support Koichiro Den
2026-02-16 10:38 ` Niklas Cassel
2026-02-15 15:03 ` [PATCH 2/3] misc: pci_endpoint_test: Gate doorbell test on dynamic inbound mapping Koichiro Den
2026-02-16 10:38 ` Niklas Cassel
2026-02-15 15:03 ` [PATCH 3/3] selftests: pci_endpoint: Skip doorbell test when unsupported Koichiro Den
2026-02-16 10:39 ` Niklas Cassel
2026-02-24 10:32 ` [PATCH 0/3] PCI: endpoint tests: Make doorbell test capability-aware Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox