Skip to content

Commit af1451b

Browse files
floatiouskwilczynski
authored andcommitted
selftests: pci_endpoint: Skip disabled BARs
Currently BARs that have been disabled by the endpoint controller driver will result in a test FAIL. Returning FAIL for a BAR that is disabled seems overly pessimistic. There are EPC that disables one or more BARs intentionally. One reason for this is that there are certain EPCs that are hardwired to expose internal PCIe controller registers over a certain BAR, so the EPC driver disables such a BAR, such that the host will not overwrite random registers during testing. Such a BAR will be disabled by the EPC driver's init function, and the BAR will be marked as BAR_RESERVED, such that it will be unavailable to endpoint function drivers. Let's return FAIL only for BARs that are actually enabled and failed the test, and let's return skip for BARs that are not even enabled. Signed-off-by: Niklas Cassel <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Krzysztof Wilczyński <[email protected]>
1 parent 2014c95 commit af1451b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

tools/testing/selftests/pci_endpoint/pci_endpoint_test.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ TEST_F(pci_ep_bar, BAR_TEST)
6565
int ret;
6666

6767
pci_ep_ioctl(PCITEST_BAR, variant->barno);
68+
if (ret == -ENODATA)
69+
SKIP(return, "BAR is disabled");
6870
EXPECT_FALSE(ret) TH_LOG("Test failed for BAR%d", variant->barno);
6971
}
7072

0 commit comments

Comments
 (0)