Skip to content

Commit c17b904

Browse files
Koichiro Denbjorn-helgaas
authored andcommitted
selftests: pci_endpoint: Add BAR subrange mapping test case
Add BAR_SUBRANGE_TEST to the pci_endpoint kselftest suite. The test uses the PCITEST_BAR_SUBRANGE ioctl and will skip when the chosen BAR is disabled (-ENODATA), when the endpoint/controller does not support subrange mapping (-EOPNOTSUPP), or when the BAR is reserved for the test register space (-EBUSY). Signed-off-by: Koichiro Den <den@valinux.co.jp> Signed-off-by: Manivannan Sadhasivam <mani@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Link: https://patch.msgid.link/20260124145012.2794108-9-den@valinux.co.jp
1 parent 8cf82bb commit c17b904

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tools/testing/selftests/pci_endpoint/pci_endpoint_test.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,23 @@ TEST_F(pci_ep_bar, BAR_TEST)
7070
EXPECT_FALSE(ret) TH_LOG("Test failed for BAR%d", variant->barno);
7171
}
7272

73+
TEST_F(pci_ep_bar, BAR_SUBRANGE_TEST)
74+
{
75+
int ret;
76+
77+
pci_ep_ioctl(PCITEST_SET_IRQTYPE, PCITEST_IRQ_TYPE_AUTO);
78+
ASSERT_EQ(0, ret) TH_LOG("Can't set AUTO IRQ type");
79+
80+
pci_ep_ioctl(PCITEST_BAR_SUBRANGE, variant->barno);
81+
if (ret == -ENODATA)
82+
SKIP(return, "BAR is disabled");
83+
if (ret == -EBUSY)
84+
SKIP(return, "BAR is test register space");
85+
if (ret == -EOPNOTSUPP)
86+
SKIP(return, "Subrange map is not supported");
87+
EXPECT_FALSE(ret) TH_LOG("Test failed for BAR%d", variant->barno);
88+
}
89+
7390
FIXTURE(pci_ep_basic)
7491
{
7592
int fd;

0 commit comments

Comments
 (0)