[PATCH 2/3] misc: pci_endpoint_test: Gate doorbell test on dynamic inbound mapping

Koichiro Den posted 3 patches 1 month, 2 weeks ago
[PATCH 2/3] misc: pci_endpoint_test: Gate doorbell test on dynamic inbound mapping
Posted by Koichiro Den 1 month, 2 weeks ago
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
Re: [PATCH 2/3] misc: pci_endpoint_test: Gate doorbell test on dynamic inbound mapping
Posted by Niklas Cassel 1 month, 2 weeks ago
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>