Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions test_pool/memory_map/m004.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ void
check_peripheral_dma_capability (void)
{
uint32_t i, fail_cnt = 0;
uint32_t bdf;
uint32_t smmu_index;
uint32_t index = val_pe_get_index_mpid (val_pe_get_mpid());
pcie_bdf_list_t *pcie_peripherals_bdf_list = val_pcie_get_pcie_peripheral_bdf_list();

Expand All @@ -54,10 +56,13 @@ check_peripheral_dma_capability (void)
/* Check if a device is capable of accessing non secure address */
for (i = 0; i < pcie_peripherals_bdf_list->count; i++) {
/* Fail the test if device isn't capable of DMA access */
if (!(val_pcie_is_devicedma_64bit(pcie_peripherals_bdf_list->dev_bdfs[i]) ||
val_pcie_is_device_behind_smmu(pcie_peripherals_bdf_list->dev_bdfs[i]))) {
bdf = pcie_peripherals_bdf_list->dev_bdfs[i];
smmu_index = val_iovirt_get_rc_smmu_index(PCIE_EXTRACT_BDF_SEG(bdf),
PCIE_CREATE_BDF_PACKED(bdf));

if (!(val_pcie_is_devicedma_64bit(bdf) || smmu_index != ACS_INVALID_INDEX)) {
val_print(DEBUG, "\n Failed for BDF = 0x%x",
pcie_peripherals_bdf_list->dev_bdfs[i]);
bdf);
fail_cnt++;
}
/* test can't be skipped as it's required by all devices irrespective
Expand All @@ -82,6 +87,8 @@ payload_check_dev_dma_if_behind_smmu (void)
{
uint32_t i, fail_cnt = 0;
bool test_run = 0;
uint32_t bdf;
uint32_t smmu_index;
uint32_t index = val_pe_get_index_mpid (val_pe_get_mpid());
pcie_bdf_list_t *pcie_peripherals_bdf_list = val_pcie_get_pcie_peripheral_bdf_list();

Expand All @@ -90,18 +97,22 @@ payload_check_dev_dma_if_behind_smmu (void)
val_print(WARN, "\n if the system has peripherals devices, "
"manually review the rule.");
val_set_status(index, RESULT_WARNING(1));
return;
}

/* Check if a device is capable of accessing non secure address */
for (i = 0; i < pcie_peripherals_bdf_list->count; i++) {
/* Fail the test if device isn't capable of 64 bit DMA access without SMMU's help */
if (val_pcie_is_device_behind_smmu(pcie_peripherals_bdf_list->dev_bdfs[i])) {
bdf = pcie_peripherals_bdf_list->dev_bdfs[i];
smmu_index = val_iovirt_get_rc_smmu_index(PCIE_EXTRACT_BDF_SEG(bdf),
PCIE_CREATE_BDF_PACKED(bdf));
if (smmu_index != ACS_INVALID_INDEX) {
/* Flag if test is run, since check is conditional on availability of
device behind a SMMU */
test_run = 1;
if (!(val_pcie_is_devicedma_64bit(pcie_peripherals_bdf_list->dev_bdfs[i]))) {
if (!(val_pcie_is_devicedma_64bit(bdf))) {
val_print(DEBUG, "\n Failed for BDF = 0x%x",
pcie_peripherals_bdf_list->dev_bdfs[i]);
bdf);
fail_cnt++;
}
}
Expand Down
6 changes: 4 additions & 2 deletions val/src/rule_metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,15 +865,15 @@ rule_test_map_t rule_test_map[RULE_ID_SENTINEL] = {
.test_entry_id = M004_ENTRY,
.module_id = MEM_MAP,
.rule_desc = "Check Addressability",
.platform_bitmask = PLATFORM_BAREMETAL | PLATFORM_LINUX,
.platform_bitmask = PLATFORM_BAREMETAL | PLATFORM_UEFI | PLATFORM_LINUX,
.flag = BASE_RULE,
.test_num = ACS_MEMORY_MAP_TEST_NUM_BASE + 4,
},
[B_MEM_04] = {
.test_entry_id = M006_ENTRY,
.module_id = MEM_MAP,
.rule_desc = "Check dev DMA behind SMMU",
.platform_bitmask = PLATFORM_BAREMETAL | PLATFORM_LINUX,
.platform_bitmask = PLATFORM_BAREMETAL | PLATFORM_UEFI | PLATFORM_LINUX,
.flag = BASE_RULE,
.test_num = ACS_MEMORY_MAP_TEST_NUM_BASE + 6,
},
Expand Down Expand Up @@ -3655,7 +3655,9 @@ test_entry_fn_t test_entry_func_table[TEST_ENTRY_SENTINEL] = {
[M001_ENTRY] = m001_entry,
[M002_ENTRY] = m002_entry,
[M003_ENTRY] = m003_entry,
[M004_ENTRY] = m004_entry,
[M005_ENTRY] = m005_entry,
[M006_ENTRY] = m006_entry,
[M008_ENTRY] = m008_entry,
[MPAM001_ENTRY] = mpam001_entry,
[MPAM002_ENTRY] = mpam002_entry, // used in wrapper.
Expand Down
Loading