Skip to content

Commit 1405680

Browse files
committed
fix(test): Skip P2P checks when ECAM is absent.
- PCIe P2P-related tests queried platform P2P capability before checking whether any ECAM region was present. On platforms without ECAM, this could report WARNING from PAL-not-implemented paths instead of treating the test as not applicable. - Treat platforms without P2P support as not skip. - Correct test status flow so skip and fail outcomes are not overwritten by later status updates. Add explicit control flow for skip/fail paths and make final pass reporting conditional on no prior terminal result. - This prevents tests from incorrectly reporting PASS/SKIP after an earlier failure or skip condition was detected. Signed-off-by: Sujana M <sujana.murali@arm.com> Change-Id: Ie62b130b03aecb31d6725566e51b04696b0951a9
1 parent c987a67 commit 1405680

23 files changed

Lines changed: 195 additions & 55 deletions

test_pool/cxl/cxl003.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ payload(void)
4949

5050
if (test_fails)
5151
val_set_status(pe_index, RESULT_FAIL(1));
52-
53-
val_set_status(pe_index, RESULT_PASS);
52+
else
53+
val_set_status(pe_index, RESULT_PASS);
5454
}
5555

5656
uint32_t

test_pool/drtm/interface004.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ payload(uint32_t num_pe)
4747
} else {
4848
val_print(ERROR, "\n TCB hash feature value not available in return value");
4949
val_set_status(index, RESULT_FAIL(3));
50+
return;
5051
}
5152

5253
val_set_status(index, RESULT_PASS);

test_pool/drtm/interface006.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ payload(uint32_t num_pe)
4949
val_print(ERROR,
5050
"\n TPM feature value not available in return value");
5151
val_set_status(index, RESULT_FAIL(3));
52+
return;
5253
}
5354

5455
val_set_status(index, RESULT_PASS);

test_pool/drtm/interface007.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ payload(uint32_t num_pe)
4747
val_print(ERROR,
4848
"\n Min memory requirement feature value not available in return value");
4949
val_set_status(index, RESULT_FAIL(2));
50+
return;
5051
}
5152
val_set_status(index, RESULT_PASS);
5253
}

test_pool/drtm/interface013.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ payload(uint32_t num_pe)
7979
if (!num_hashes) {
8080
val_print(ERROR, "\n Max Hashes can be recorded with DRTM_SET_TCB_HASH is 0");
8181
val_set_status(index, RESULT_SKIP(2));
82+
return;
8283
}
8384

8485
/* Max number of hashes can be recorded plus one */

test_pool/drtm/interface014.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ payload(uint32_t num_pe)
7676
if (!num_hashes) {
7777
val_print(ERROR, "\n Max Hashes can be recorded with DRTM_SET_TCB_HASH is 0");
7878
val_set_status(index, RESULT_SKIP(2));
79+
return;
7980
}
8081

8182
drtm_hash_table = (DRTM_TCB_HASH_TABLE *)val_memory_alloc(sizeof(DRTM_TCB_HASH_TABLE_HDR) +

test_pool/drtm/interface015.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ payload(uint32_t num_pe)
4949
val_print(ERROR,
5050
"\n DLME Image Authentication feature value not available in return value");
5151
val_set_status(index, RESULT_FAIL(2));
52+
return;
5253
}
5354

5455
val_set_status(index, RESULT_PASS);

test_pool/exerciser/e001.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,22 +223,35 @@ payload(void)
223223
uint32_t test_skip;
224224
uint64_t bar_base;
225225
uint32_t curr_bdf_failed = 0;
226+
uint32_t p2p_status;
226227
pcie_device_bdf_table *bdf_tbl_ptr;
227-
bdf_tbl_ptr = val_pcie_bdf_table_ptr();
228-
229228
fail_cnt = 0;
230229
test_skip = 1;
231230
pe_index = val_pe_get_index_mpid(val_pe_get_mpid());
232231
instance = val_exerciser_get_info(EXERCISER_NUM_CARDS);
233232

234-
uint32_t acsctrl_default[bdf_tbl_ptr->num_entries][1];
233+
if (val_pcie_get_info(PCIE_INFO_NUM_ECAM, 0) == 0) {
234+
val_print(DEBUG, "\n No ECAM region found. Skipping test");
235+
val_set_status(pe_index, RESULT_SKIP(1));
236+
return;
237+
}
235238

236239
/* Check If PCIe Hierarchy supports P2P. */
237-
if (val_pcie_p2p_support() == ACS_STATUS_PAL_NOT_IMPLEMENTED) {
238-
val_set_status(pe_index, RESULT_WARNING(2));
240+
p2p_status = val_pcie_p2p_support();
241+
if (p2p_status == ACS_STATUS_PAL_NOT_IMPLEMENTED) {
242+
val_set_status(pe_index, RESULT_WARNING(1));
239243
return;
240244
}
241245

246+
if (p2p_status != 0) {
247+
val_print(DEBUG, "\n P2P not supported. Skipping test");
248+
val_set_status(pe_index, RESULT_SKIP(2));
249+
return;
250+
}
251+
252+
bdf_tbl_ptr = val_pcie_bdf_table_ptr();
253+
uint32_t acsctrl_default[bdf_tbl_ptr->num_entries][1];
254+
242255
/* Store ACS Control reg bits in an array for every Exerciser and reset them
243256
to default at the end. */
244257
val_pcie_read_acsctrl(acsctrl_default);
@@ -314,7 +327,7 @@ payload(void)
314327
val_pcie_write_acsctrl(acsctrl_default);
315328

316329
if (test_skip == 1)
317-
val_set_status(pe_index, RESULT_SKIP(1));
330+
val_set_status(pe_index, RESULT_SKIP(3));
318331
else if (fail_cnt)
319332
val_set_status(pe_index, RESULT_FAIL(fail_cnt));
320333
else

test_pool/exerciser/e002.c

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ payload(void)
345345
uint32_t tgt_e_bus_num;
346346
uint32_t tgt_e_dev_num;
347347
uint32_t tgt_e_func_num;
348+
uint32_t p2p_status;
348349

349350
fail_cnt = 0;
350351
test_skip = 1;
@@ -353,15 +354,29 @@ payload(void)
353354
pcie_device_bdf_table *bdf_tbl_ptr;
354355

355356
tbl_index = 0;
356-
bdf_tbl_ptr = val_pcie_bdf_table_ptr();
357-
uint32_t acsctrl_default[bdf_tbl_ptr->num_entries][1];
357+
358+
if (val_pcie_get_info(PCIE_INFO_NUM_ECAM, 0) == 0) {
359+
val_print(DEBUG, "\n No ECAM region found. Skipping test");
360+
val_set_status(pe_index, RESULT_SKIP(1));
361+
return;
362+
}
358363

359364
/* Check If PCIe Hierarchy supports P2P. */
360-
if (val_pcie_p2p_support() == ACS_STATUS_PAL_NOT_IMPLEMENTED) {
361-
val_set_status(pe_index, RESULT_WARNING(2));
365+
p2p_status = val_pcie_p2p_support();
366+
if (p2p_status == ACS_STATUS_PAL_NOT_IMPLEMENTED) {
367+
val_set_status(pe_index, RESULT_WARNING(1));
362368
return;
363369
}
364370

371+
if (p2p_status != 0) {
372+
val_print(DEBUG, "\n P2P not supported. Skipping test");
373+
val_set_status(pe_index, RESULT_SKIP(2));
374+
return;
375+
}
376+
377+
bdf_tbl_ptr = val_pcie_bdf_table_ptr();
378+
uint32_t acsctrl_default[bdf_tbl_ptr->num_entries][1];
379+
365380
/* Store ACS Control reg bits in an array for every BDF and reset them to default at the end. */
366381
val_pcie_read_acsctrl(acsctrl_default);
367382

@@ -470,7 +485,7 @@ payload(void)
470485
val_pcie_write_acsctrl(acsctrl_default);
471486

472487
if (test_skip == 1)
473-
val_set_status(pe_index, RESULT_SKIP(1));
488+
val_set_status(pe_index, RESULT_SKIP(3));
474489
else if (fail_cnt)
475490
val_set_status(pe_index, RESULT_FAIL(fail_cnt));
476491
else

test_pool/exerciser/e014.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,30 @@ payload(void)
119119
uint32_t tgt_rp_bdf;
120120
uint32_t instance;
121121
uint32_t test_skip;
122+
uint32_t p2p_status;
122123
uint64_t bar_base;
123124

124125
test_skip = 1;
125126
index = val_pe_get_index_mpid(val_pe_get_mpid());
126127
instance = val_exerciser_get_info(EXERCISER_NUM_CARDS);
127128

129+
if (val_pcie_get_info(PCIE_INFO_NUM_ECAM, 0) == 0) {
130+
val_print(DEBUG, "\n No ECAM region found. Skipping test");
131+
val_set_status(index, RESULT_SKIP(1));
132+
return;
133+
}
134+
128135
/* Check If PCIe Hierarchy supports P2P. */
129-
if (!val_pcie_p2p_support())
136+
p2p_status = val_pcie_p2p_support();
137+
if (p2p_status == ACS_STATUS_PAL_NOT_IMPLEMENTED) {
138+
val_set_status(index, RESULT_WARNING(1));
139+
return;
140+
}
141+
142+
if (p2p_status == ACS_STATUS_PASS)
130143
{
131144
val_print(DEBUG, "\n P2P is supported, Skipping Test");
132-
val_set_status(index, RESULT_SKIP(1));
145+
val_set_status(index, RESULT_SKIP(2));
133146
return;
134147
}
135148

@@ -169,7 +182,7 @@ payload(void)
169182
}
170183

171184
if (test_skip) {
172-
val_set_status(index, RESULT_SKIP(2));
185+
val_set_status(index, RESULT_SKIP(3));
173186
return;
174187
}
175188

0 commit comments

Comments
 (0)