Skip to content

Commit b351e9c

Browse files
nxpfranklibjorn-helgaas
authored andcommitted
selftests: pci_endpoint: Add doorbell test case
Add doorbell test case. Signed-off-by: Frank Li <[email protected]> [mani: Reworded the testcase description] Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Tested-by: Niklas Cassel <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent eefb837 commit b351e9c

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

Documentation/PCI/endpoint/pci-test-howto.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,3 +203,18 @@ controllers, it is advisable to skip this testcase using this
203203
command::
204204

205205
# pci_endpoint_test -f pci_ep_bar -f pci_ep_basic -v memcpy -T COPY_TEST -v dma
206+
207+
Kselftest EP Doorbell
208+
~~~~~~~~~~~~~~~~~~~~~
209+
210+
If the Endpoint MSI controller is used for the doorbell usecase, run below
211+
command for testing it:
212+
213+
# pci_endpoint_test -f pcie_ep_doorbell
214+
215+
# Starting 1 tests from 1 test cases.
216+
# RUN pcie_ep_doorbell.DOORBELL_TEST ...
217+
# OK pcie_ep_doorbell.DOORBELL_TEST
218+
ok 1 pcie_ep_doorbell.DOORBELL_TEST
219+
# PASSED: 1 / 1 tests passed.
220+
# Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0

tools/testing/selftests/pci_endpoint/pci_endpoint_test.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,32 @@ TEST_F(pci_ep_data_transfer, COPY_TEST)
229229
test_size[i]);
230230
}
231231
}
232+
233+
FIXTURE(pcie_ep_doorbell)
234+
{
235+
int fd;
236+
};
237+
238+
FIXTURE_SETUP(pcie_ep_doorbell)
239+
{
240+
self->fd = open(test_device, O_RDWR);
241+
242+
ASSERT_NE(-1, self->fd) TH_LOG("Can't open PCI Endpoint Test device");
243+
};
244+
245+
FIXTURE_TEARDOWN(pcie_ep_doorbell)
246+
{
247+
close(self->fd);
248+
};
249+
250+
TEST_F(pcie_ep_doorbell, DOORBELL_TEST)
251+
{
252+
int ret;
253+
254+
pci_ep_ioctl(PCITEST_SET_IRQTYPE, PCITEST_IRQ_TYPE_AUTO);
255+
ASSERT_EQ(0, ret) TH_LOG("Can't set AUTO IRQ type");
256+
257+
pci_ep_ioctl(PCITEST_DOORBELL, 0);
258+
EXPECT_FALSE(ret) TH_LOG("Test failed for Doorbell\n");
259+
}
232260
TEST_HARNESS_MAIN

0 commit comments

Comments
 (0)