Extend the pci_endpoint_test kselftest with a 'remote_edma' variant for
READ/WRITE tests. The variant sets PCITEST_FLAGS_USE_REMOTE_EDMA and
skips the test when the feature is not supported.
Also treat -EOPNOTSUPP from BAR tests as "BAR is reserved" and skip,
since the host driver may reserve a BAR for remote-eDMA metadata.
Signed-off-by: Koichiro Den <den@valinux.co.jp>
---
.../selftests/pci_endpoint/pci_endpoint_test.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c b/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
index 23aac6f97061..39593da3b40d 100644
--- a/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
+++ b/tools/testing/selftests/pci_endpoint/pci_endpoint_test.c
@@ -67,6 +67,8 @@ TEST_F(pci_ep_bar, BAR_TEST)
pci_ep_ioctl(PCITEST_BAR, variant->barno);
if (ret == -ENODATA)
SKIP(return, "BAR is disabled");
+ if (ret == -EOPNOTSUPP)
+ SKIP(return, "BAR is reserved");
EXPECT_FALSE(ret) TH_LOG("Test failed for BAR%d", variant->barno);
}
@@ -165,16 +167,25 @@ FIXTURE_TEARDOWN(pci_ep_data_transfer)
FIXTURE_VARIANT(pci_ep_data_transfer)
{
bool use_dma;
+ bool use_remote_edma;
};
FIXTURE_VARIANT_ADD(pci_ep_data_transfer, memcpy)
{
.use_dma = false,
+ .use_remote_edma = false,
};
FIXTURE_VARIANT_ADD(pci_ep_data_transfer, dma)
{
.use_dma = true,
+ .use_remote_edma = false,
+};
+
+FIXTURE_VARIANT_ADD(pci_ep_data_transfer, remote_edma)
+{
+ .use_dma = false,
+ .use_remote_edma = true,
};
TEST_F(pci_ep_data_transfer, READ_TEST)
@@ -184,6 +195,8 @@ TEST_F(pci_ep_data_transfer, READ_TEST)
if (variant->use_dma)
param.flags = PCITEST_FLAGS_USE_DMA;
+ if (variant->use_remote_edma)
+ param.flags = PCITEST_FLAGS_USE_REMOTE_EDMA;
pci_ep_ioctl(PCITEST_SET_IRQTYPE, PCITEST_IRQ_TYPE_AUTO);
ASSERT_EQ(0, ret) TH_LOG("Can't set AUTO IRQ type");
@@ -203,6 +216,8 @@ TEST_F(pci_ep_data_transfer, WRITE_TEST)
if (variant->use_dma)
param.flags = PCITEST_FLAGS_USE_DMA;
+ if (variant->use_remote_edma)
+ param.flags = PCITEST_FLAGS_USE_REMOTE_EDMA;
pci_ep_ioctl(PCITEST_SET_IRQTYPE, PCITEST_IRQ_TYPE_AUTO);
ASSERT_EQ(0, ret) TH_LOG("Can't set AUTO IRQ type");
@@ -222,6 +237,8 @@ TEST_F(pci_ep_data_transfer, COPY_TEST)
if (variant->use_dma)
param.flags = PCITEST_FLAGS_USE_DMA;
+ if (variant->use_remote_edma)
+ SKIP(return, "Remote eDMA is not supported");
pci_ep_ioctl(PCITEST_SET_IRQTYPE, PCITEST_IRQ_TYPE_AUTO);
ASSERT_EQ(0, ret) TH_LOG("Can't set AUTO IRQ type");
--
2.51.0