Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- BSA PCIe test 843 covers the BSA recommended
  rule PCI_PP_06 and SBSA FR mandatory rule GPU_03.
- Since it is mandatory in SBSA spec, the test is
  moved to SBSA repo and maps to SBSA rule GPU_03
  with the corresponding BSA rule mentioned.

Signed-off-by: Sujana M <[email protected]>
  • Loading branch information
Sujana-M authored Feb 10, 2025
1 parent cc9b940 commit b010def
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docs/arm_sbsa_testcase_checklist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ The below table provides the following details
+-------+--------------------------------------------+-----+----------------------------------------------------+----------------+----+----------+-----+-------------------+
|867 |Check Supported Link Speed for iEPs |L6 |IE_REG_6, IE_REG_7, IE_REG_8, IE_REG_9 |Yes |Yes |Yes |Yes |No |
+-------+--------------------------------------------+-----+----------------------------------------------------+----------------+----+----------+-----+-------------------+
|868 |Switches must support ACS if P2P |FR |GPU_03, PCI_PP_06 |Yes |Yes |Yes |Yes |No |
+-------+--------------------------------------------+-----+----------------------------------------------------+----------------+----+----------+-----+-------------------+
|901 |Enhanced ECAM Memory access check |L3 |PCI_IN_01, PCI_IN_02 |No |Yes |Yes |No |Yes |
+-------+--------------------------------------------+-----+----------------------------------------------------+----------------+----+----------+-----+-------------------+
|902 |PCIe Address translation check |L6 |RE_SMU_2 |No |Yes |Yes |No |Yes |
Expand Down
168 changes: 168 additions & 0 deletions test_pool/pcie/operating_system/test_p068.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
/** @file
* Copyright (c) 2025, Arm Limited or its affiliates. All rights reserved.
* SPDX-License-Identifier : Apache-2.0
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
#include "val/common/include/acs_val.h"
#include "val/common/include/acs_pe.h"
#include "val/common/include/acs_pcie.h"
#include "val/common/include/acs_memory.h"

#define TEST_NUM (ACS_PCIE_TEST_NUM_BASE + 68)
#define TEST_RULE "GPU_03,PCI_PP_06"
#define TEST_DESC "Switches must support ACS if P2P "

/* PCI_PP_06 is BSA recommended Rule ID */
static
void
payload(void)
{

uint32_t bdf;
uint32_t func;
uint32_t pe_index;
uint32_t tbl_index;
uint32_t dp_type;
uint32_t cap_base = 0;
uint32_t test_fails;
uint32_t test_skip = 1;
uint32_t acs_data;
uint32_t data;
uint32_t curr_bdf_failed = 0;
pcie_device_bdf_table *bdf_tbl_ptr;

pe_index = val_pe_get_index_mpid(val_pe_get_mpid());

/* Check If PCIe Hierarchy supports P2P */
if (val_pcie_p2p_support() == NOT_IMPLEMENTED) {
val_print(ACS_PRINT_DEBUG, "\n The test is applicable only if the system supports", 0);
val_print(ACS_PRINT_DEBUG, "\n P2P traffic. If the system supports P2P, pass the", 0);
val_print(ACS_PRINT_DEBUG, "\n command line option '-p2p' while running the binary", 0);
val_set_status(pe_index, RESULT_SKIP(TEST_NUM, 1));
return;
}

bdf_tbl_ptr = val_pcie_bdf_table_ptr();
test_fails = 0;

/* Check for all the function present in bdf table */
for (tbl_index = 0; tbl_index < bdf_tbl_ptr->num_entries; tbl_index++)
{
bdf = bdf_tbl_ptr->device[tbl_index].bdf;
func = PCIE_EXTRACT_BDF_FUNC(bdf);
dp_type = val_pcie_device_port_type(bdf);

/* Check entry is DP port of a switch
* If the device is an UP port of a switch then,
* acc. to PCIe spec the UP port of switch should
* be a function of a multi-function device */
if ((dp_type == DP) || ((dp_type == UP) && (func > 0)))
{
/* Test runs for atleast one device */
test_skip = 0;
val_print(ACS_PRINT_DEBUG, "\n BDF - 0x%x", bdf);

/* Read the ACS Capability */
if (val_pcie_find_capability(bdf, PCIE_ECAP, ECID_ACS, &cap_base) != PCIE_SUCCESS) {
val_print(ACS_PRINT_ERR,
"\n ACS Capability not supported, Bdf : 0x%x", bdf);
test_fails++;
continue;
}

val_pcie_read_cfg(bdf, cap_base + ACSCR_OFFSET, &acs_data);

/* Extract ACS source validation bit */
data = VAL_EXTRACT_BITS(acs_data, 0, 0);
if (data == 0) {
val_print(ACS_PRINT_DEBUG,
"\n Source validation not supported, Bdf : 0x%x", bdf);
curr_bdf_failed++;
}
/* Extract ACS translation blocking bit */
data = VAL_EXTRACT_BITS(acs_data, 1, 1);
if (data == 0) {
val_print(ACS_PRINT_DEBUG,
"\n Translation blocking not supported, Bdf : 0x%x", bdf);
curr_bdf_failed++;
}
/* Extract ACS P2P request redirect bit */
data = VAL_EXTRACT_BITS(acs_data, 2, 2);
if (data == 0) {
val_print(ACS_PRINT_DEBUG,
"\n P2P request redirect not supported, Bdf : 0x%x", bdf);
curr_bdf_failed++;
}
/* Extract ACS P2P completion redirect bit */
data = VAL_EXTRACT_BITS(acs_data, 3, 3);
if (data == 0) {
val_print(ACS_PRINT_DEBUG,
"\n P2P completion redirect not supported, Bdf : 0x%x", bdf);
curr_bdf_failed++;
}
/* Extract ACS upstream forwarding bit */
data = VAL_EXTRACT_BITS(acs_data, 4, 4);
if (data == 0) {
val_print(ACS_PRINT_DEBUG,
"\n Upstream forwarding not supported, Bdf : 0x%x", bdf);
curr_bdf_failed++;
}

/* Extract ACS Direct Translated P2P bit */
data = VAL_EXTRACT_BITS(acs_data, 6, 6);
if (data == 0) {
val_print(ACS_PRINT_DEBUG,
"\n Direct Translated P2P not supported, Bdf : 0x%x", bdf);
curr_bdf_failed++;
}

if (curr_bdf_failed > 0) {
val_print(ACS_PRINT_ERR,
"\n ACS Capability Check Failed, Bdf : 0x%x", bdf);
curr_bdf_failed = 0;
test_fails++;
}
}
}

if (test_skip == 1) {
val_print(ACS_PRINT_DEBUG, "\n No Downstream Port of Switch found. Skipping device", 0);
val_set_status(pe_index, RESULT_SKIP(TEST_NUM, 2));
}
else if (test_fails)
val_set_status(pe_index, RESULT_FAIL(TEST_NUM, test_fails));
else
val_set_status(pe_index, RESULT_PASS(TEST_NUM, 1));
}

uint32_t
p068_entry(uint32_t num_pe)
{

uint32_t status = ACS_STATUS_FAIL;

num_pe = 1; //This test is run on single processor

status = val_initialize_test(TEST_NUM, TEST_DESC, num_pe);
if (status != ACS_STATUS_SKIP)
val_run_test_payload(TEST_NUM, num_pe, payload, 0);

/* get the result from all PE and check for failure */
status = val_check_for_error(TEST_NUM, num_pe, TEST_RULE);

val_report_status(0, ACS_END(TEST_NUM), NULL);

return status;
}

4 changes: 2 additions & 2 deletions uefi_app/SbsaAvs.inf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## @file
# Copyright (c) 2016-2024, Arm Limited or its affiliates. All rights reserved.
# Copyright (c) 2016-2025, Arm Limited or its affiliates. All rights reserved.
# SPDX-License-Identifier : Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -122,7 +122,7 @@
../test_pool/pcie/operating_system/test_p064.c
../test_pool/pcie/operating_system/test_p065.c
../test_pool/pcie/operating_system/test_p067.c

../test_pool/pcie/operating_system/test_p068.c

../test_pool/smmu/operating_system/test_i001.c
../test_pool/smmu/operating_system/test_i002.c
Expand Down
3 changes: 2 additions & 1 deletion uefi_app/SbsaAvsNist.inf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## @file
# Copyright (c) 2020-2024, Arm Limited or its affiliates. All rights reserved.
# Copyright (c) 2020-2025, Arm Limited or its affiliates. All rights reserved.
# SPDX-License-Identifier : Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -124,6 +124,7 @@
../test_pool/pcie/operating_system/test_p064.c
../test_pool/pcie/operating_system/test_p065.c
../test_pool/pcie/operating_system/test_p067.c
../test_pool/pcie/operating_system/test_p068.c

../test_pool/smmu/operating_system/test_i001.c
../test_pool/smmu/operating_system/test_i002.c
Expand Down

0 comments on commit b010def

Please sign in to comment.