Skip to content

Commit

Permalink
BSA 1.0 Rel changes
Browse files Browse the repository at this point in the history
 1. Added test for PCIe Rules PCI_PP_02, PCI_PP_08 and RE_ORD_4.
 2. Added test for ITS Rules ITS_DEV_2,ITS_DEV_7 and ITS_DEV_8 for systems presenting firmware which is SBBR complaint.
 3. Added test for Peripherals Rules PER_01,PER_02 and PER_03 for systems presenting firmware which is EBBR complaint.
 4. Bug Fixes on BETA rel
 5. Log formatting

Co-authored-by: Chetan Rathore <[email protected]>
Co-authored-by: Rajat Goyal <[email protected]>
Co-authored-by: Jiss Jose <[email protected]>
Co-authored-by: Gowtham Siddarth <[email protected]>
Co-authored-by: Sujana M <[email protected]>
Co-authored-by: Aishwarya Jabi <[email protected]>
  • Loading branch information
7 people committed Sep 16, 2021
1 parent fa6948c commit 8df4f63
Show file tree
Hide file tree
Showing 232 changed files with 4,551 additions and 6,110 deletions.
45 changes: 27 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ For more information, see [BSA specification](https://developer.arm.com/document

BSA **Architecture Compliance Suite** (ACS) is a collection of self-checking, portable C-based tests.
This suite includes a set of examples of the invariant behaviors that are provided by the [BSA](https://developer.arm.com/documentation/den0094/latest) specification, so that you can verify if these behaviour have been interpreted correctly.
Most of the tests are executed from UEFI Shell by executing the BSA UEFI shell application.
Most of the tests are executed from UEFI (Unified Extensible Firmware Interface) Shell by executing the BSA UEFI shell application.
A few tests are executed by running the BSA ACS Linux application which in turn depends on the BSA ACS Linux kernel module.


## Release details
- Code quality: v0.9 Beta
- Code quality: v1.0
- The tests are written for version 1.0 of the BSA specification.
- The compliance suite is not a substitute for design verification.
- To review the BSA ACS logs, Arm licensees can contact Arm directly through their partner managers.
Expand Down Expand Up @@ -93,8 +93,6 @@ The EFI executable file is generated at <edk2_path>/Build/Shell/DEBUG_GCC49/AARC

### 2. Test suite execution

The execution of the compliance suite varies depending on the test environment. The below steps assume that the test suite is invoked through the ACS UEFI shell application.


#### Prerequisites
- If the system supports LPIs (Interrupt ID > 8192) then Firmware should support installation of handler for LPI interrupts.
Expand All @@ -106,6 +104,8 @@ The execution of the compliance suite varies depending on the test environment.
> -mGicNumInterrupts = ArmGicGetMaxNumInterrupts (mGicDistributorBase);
> +mGicNumInterrupts = ARM_GIC_MAX_NUM_INTERRUPT;
The execution of the compliance suite varies depending on the test environment. The following steps assume that the test suite is invoked through the ACS UEFI shell application.

#### 2.1 Silicon

On a system where a USB port is available and functional, perform the following steps:
Expand Down Expand Up @@ -138,11 +138,11 @@ On an emulation environment with secondary storage, perform the following steps:
2. Load the image file to the secondary storage using a backdoor. The steps to load the image file are emulation environment-specific and beyond the scope of this document.
3. Boot the system to UEFI shell.
4. To determine the file system number of the secondary storage, execute 'map -r' command.
5. Type 'fsx' where 'x' is replaced by the number determined in step 4.
5. Type 'fs<x>' where '<x>' is replaced by the number determined in step 4.
6. To start the compliance tests, run the executable Bsa.efi with the appropriate parameters.
7. Copy the UART console output to a log file for analysis and certification.

- For information on the BSA uefi shell application parameters, see [User Guide](docs/Arm_Base_System_Architecture_Compliance_User_Guide.pdf).
- For information on the BSA uefi shell application parameters, see the [User Guide](docs/Arm_Base_System_Architecture_Compliance_User_Guide.pdf).


#### 2.3 Emulation environment without secondary storage
Expand All @@ -152,12 +152,12 @@ On an emulation platform where secondary storage is not available, perform the f
1. Add the path to 'Bsa.efi' file in the UEFI FD file.
2. Build UEFI image including the UEFI Shell.
3. Boot the system to UEFI shell.
4. Run the executable 'Bsa.efi' to start the compliance tests. For details about the parameters,
4. Run the executable 'Bsa.efi' to start the compliance tests. For details about the parameters,see the [User Guide](docs/Arm_Base_System_Architecture_Compliance_User_Guide.pdf).
5. Copy the UART console output to a log file for analysis and certification.


## Linux OS-based tests
Certain Peripheral, PCIe and Memory map tests require Linux operating system with kernel version 5.11 or above.
Certain Peripheral, PCIe and Memory map tests require Linux operating system with kernel version 5.13 or above.
This chapter provides information on executing tests from the Linux application.

### 1. Build steps and environment setup
Expand All @@ -166,7 +166,7 @@ The patch for the kernel tree and the Linux PAL are hosted separately on [linux-

### 1.1 Building the kernel module
#### Prerequisites
- Linux kernel source version 5.11.
- Linux kernel source version 5.13.
- Linaro GCC tool chain 7.5 or above.
- Build environment for AArch64 Linux kernel.

Expand All @@ -175,7 +175,7 @@ The patch for the kernel tree and the Linux PAL are hosted separately on [linux-
2. git clone https://github.com/ARM-software/bsa-acs.git bsa-acs
3. git clone https://github.com/torvalds/linux.git -b v5.11
4. export CROSS_COMPILE=<GCC7.5 toolchain path> pointing to /bin/aarch64-linux-gnu-
5. git apply <local_dir>/bsa-acs-drv/kernel/src/0001-BSA-ACS-Linux-5.11.patch to your kernel source tree.
5. git apply <local_dir>/bsa-acs-drv/kernel/src/0001-BSA-ACS-Linux-5.13.patch to your kernel source tree.
6. make ARCH=arm64 defconfig && make -j $(nproc) ARCH=arm64

#### 1.2 Build steps for BSA kernel module
Expand All @@ -185,14 +185,14 @@ The patch for the kernel tree and the Linux PAL are hosted separately on [linux-
4. ./setup.sh <local_dir/bsa-acs>
5. ./linux_bsa_acs.sh

Successfull completion of above steps will generate bsa_acs.ko
Successful completion of above steps will generate bsa_acs.ko

#### 1.3 BSA Linux application build
1. cd <bsa-acs path>/linux_app/bsa-acs-app
2. export CROSS_COMPILE=<ARM64 toolchain path>/bin/aarch64-linux-gnu-
3. make

Successfull completion of above steps will generate executable file bsa
Successful completion of above steps will generate executable file bsa

### 2. Loading the kernel module
Before the BSA ACS Linux application can be run, load the BSA ACS kernel module using the insmod command.
Expand All @@ -204,27 +204,36 @@ shell> insmod bsa_acs.ko
```sh
shell> ./bsa
```
- For information on the BSA Linux application parameters, see [User Guide](docs/Arm_Base_System_Architecture_Compliance_User_Guide.pdf).
- For information on the BSA Linux application parameters, see the [User Guide](docs/Arm_Base_System_Architecture_Compliance_User_Guide.pdf).

## Security implication
The Arm System Ready ACS test suite may run at a higher privilege level. An attacker may utilize these tests to elevate the privilege which can potentially reveal the platform security assets. To prevent the leakage of secure information, Arm strongly recommends that you run the ACS test suite only on development platforms. If it is run on production systems, the system should be scrubbed after running the test suite.
The Arm SystemReady ACS test suite may run at a higher privilege level. An attacker may utilize these tests to elevate the privilege which can potentially reveal the platform security assets. To prevent the leakage of Secure information, Arm strongly recommends that you run the ACS test suite only on development platforms. If it is run on production systems, the system should be scrubbed after running the test suite.

## Limitations

- PCIE iEP rules are out of scope for current release.
- ITS rules are available only for systems that present firmware compliant to SBBR.
- Peripheral rules RB_PER_01,02,03 are not implemented in current release for systems that present firmware compliant to EBBR.
- Some PCIe and Exerciser test are dependent on PCIe features supported by the test system.
Please fill the required API's with test system information.
- pal_pcie_p2p_support : If the test system PCIe supports peer to peer transaction.
- pal_pcie_is_cache_present : If the test system supports PCIe address translation cache.
- pal_pcie_get_legacy_ir_map : Fill system legacy ir map
Below exerciser capabilities are required by exerciser test.
- MSI-X interrupt generation.
- Incoming Transaction Monitoring(order, type).
- Initiating transacions from and to the exerciser.
- Ability to check on BDF and register address seen for each configuration address along with access type.

## License
BSA ACS is distributed under Apache v2.0 License.


## Feedback, contributions and support
## Feedback, contributions, and support

- For feedback, use the GitHub Issue Tracker that is associated with this repository.
- For support, please send an email to "[email protected]" with details.
- For support, send an email to "[email protected]" with details.
- Arm licensees may contact Arm directly through their partner managers.
- Arm welcomes code contributions through GitHub pull requests. See GitHub documentation on how to raise pull requests.
- Arm welcomes code contributions through GitHub pull requests. See the GitHub documentation on how to raise pull requests.

--------------

Expand Down
8 changes: 8 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@ v21.07_0.9_BETA
* BSA: Initial ITS tests for systems presenting firmware which is SBBR complaint
* BSA: Renamed pal_uefi to pal_uefi_acpi
* BSA: Bug Fixes on Alpha release

v21.09_1.0

* BSA: Added test for PCIe Rules PCI_PP_02, PCI_PP_08 and RE_ORD_4.
* BSA : Added test for ITS Rules ITS_DEV_2,ITS_DEV_7 and ITS_DEV_8 for systems presenting firmware which is SBBR complaint.
* BSA: Added test for Peripherals Rules PER_01,PER_02 and PER_03 for systems presenting firmware which is EBBR complaint.
* BSA: Bug Fixes on BETA release

Binary file modified docs/Arm_Base_System_Architecture_Compliance_User_Guide.pdf
Binary file not shown.
Binary file not shown.
Binary file modified docs/Arm_Base_System_Architecture_Scenario_ES.pdf
Binary file not shown.
Binary file modified docs/Arm_Base_System_Architecture_Scenario_IR.pdf
Binary file not shown.
13 changes: 2 additions & 11 deletions linux_app/bsa-acs-app/bsa_drv_intf.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @file
* Copyright (c) 2016-2018, Arm Limited or its affiliates. All rights reserved.
* Copyright (c) 2016-2018,2021 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 @@ -43,14 +43,12 @@ call_drv_get_status(unsigned long int *arg0, unsigned long int *arg1, unsigned l


fd = fopen("/proc/bsa", "r");

fseek(fd, 0, SEEK_SET);

if (NULL == fd)
{
printf("fopen failed \n");
return 1;
}

fread(&test_params,1,sizeof(test_params),fd);

//printf("read back value is %x %lx \n", test_params.api_num, test_params.arg1);
Expand Down Expand Up @@ -87,7 +85,6 @@ call_drv_init_test_env(unsigned int print_level)
bsa_drv_parms_t test_params;

fd = fopen("/proc/bsa", "rw+");

if (NULL == fd)
{
printf("fopen failed \n");
Expand All @@ -113,7 +110,6 @@ call_drv_clean_test_env()
bsa_drv_parms_t test_params;

fd = fopen("/proc/bsa", "rw+");

if (NULL == fd)
{
printf("fopen failed \n");
Expand All @@ -139,7 +135,6 @@ call_drv_execute_test(unsigned int api_num, unsigned int num_pe,
bsa_drv_parms_t test_params;

fd = fopen("/proc/bsa", "rw+");

if (NULL == fd)
{
printf("fopen failed \n");
Expand All @@ -166,7 +161,6 @@ call_update_skip_list(unsigned int api_num, int *p_skip_test_num)
bsa_drv_parms_t test_params;

fd = fopen("/proc/bsa", "rw+");

if (NULL == fd)
{
printf("fopen failed \n");
Expand Down Expand Up @@ -226,9 +220,6 @@ int read_from_proc_bsa_msg() {
bsa_msg_parms_t msg_params;

fd = fopen("/proc/bsa_msg", "r");

fseek(fd, 0, SEEK_SET);

if (NULL == fd) {
printf("fopen failed \n");
return 1;
Expand Down
4 changes: 2 additions & 2 deletions linux_app/bsa-acs-app/include/bsa_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#define __BSA_APP_LINUX_H__


#define BSA_APP_VERSION_MAJOR 0
#define BSA_APP_VERSION_MINOR 9
#define BSA_APP_VERSION_MAJOR 1
#define BSA_APP_VERSION_MINOR 0

#define G_SW_OS 0
#define G_SW_HYP 1
Expand Down
33 changes: 22 additions & 11 deletions platform/pal_uefi_acpi/include/pal_exerciser.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
#define DMA_BUS_ADDR 0x010
#define DMA_LEN 0x018
#define DMASTATUS 0x01C
#define PASID_VAL 0x020
#define ATSCTL 0x024
#define ATS_ADDR 0x028
#define PCI_MAX_BUS 255
#define PCI_MAX_DEVICE 31

Expand All @@ -65,6 +68,7 @@
#define PASID_VAL_SHIFT 12
#define PASID_LEN_SHIFT 7
#define PASID_LEN_MASK 0x7ul
#define PASID_EN_SHIFT 6
#define DMA_TO_DEVICE_MASK 0xFFFFFFEF

/* shift_bit */
Expand All @@ -85,7 +89,13 @@
#define PCIE_CAP_DIS_MASK 0xFFFEFFFF
#define PCIE_CAP_EN_MASK (1 << 16)
#define PASID_EN_MASK (1 << 6)

#define RID_CTL_REG 0x3C
#define RID_VALUE_MASK 0xFFFF
#define RID_VALID_MASK (1ul << 31)
#define RID_VALID 1
#define RID_NOT_VALID 0
#define ATS_TRIGGER 1
#define ATS_STATUS (1ul << 7)

typedef enum {
TYPE0 = 0x0,
Expand All @@ -106,21 +116,22 @@ typedef enum {
} EXERCISER_DMA_ATTR;

typedef enum {
SNOOP_ATTRIBUTES = 0x1,
LEGACY_IRQ = 0x2,
MSIX_ATTRIBUTES = 0x3,
DMA_ATTRIBUTES = 0x4,
P2P_ATTRIBUTES = 0x5,
PASID_ATTRIBUTES = 0x6,
SNOOP_ATTRIBUTES = 0x1,
LEGACY_IRQ = 0x2,
MSIX_ATTRIBUTES = 0x3,
DMA_ATTRIBUTES = 0x4,
P2P_ATTRIBUTES = 0x5,
PASID_ATTRIBUTES = 0x6,
CFG_TXN_ATTRIBUTES = 0x7,
ATS_RES_ATTRIBUTES = 0x8,
TRANSACTION_TYPE = 0x9,
NUM_TRANSACTIONS = 0xA
TRANSACTION_TYPE = 0x9,
NUM_TRANSACTIONS = 0xA
} EXERCISER_PARAM_TYPE;

typedef enum {
TXN_REQ_ID = 0x0,
TXN_ADDR_TYPE = 0x1,
TXN_REQ_ID = 0x0,
TXN_ADDR_TYPE = 0x1,
TXN_REQ_ID_VALID = 0x2,
} EXERCISER_TXN_ATTR;

typedef enum {
Expand Down
4 changes: 4 additions & 0 deletions platform/pal_uefi_acpi/include/pal_uefi.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,12 @@ typedef struct {
UINT32 max_pasids;
UINT32 baud_rate;
UINT32 interface_type;
UINT32 platform_type;
}PERIPHERAL_INFO_BLOCK;

#define PLATFORM_TYPE_ACPI 0x0
#define PLATFORM_TYPE_DT 0x1

/**
@brief Peripheral Info Structure
**/
Expand Down
19 changes: 13 additions & 6 deletions platform/pal_uefi_acpi/src/pal_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,17 @@

#include "include/pal_uefi.h"

/**
@brief Dump DTB to file
@param None
@return None
**/
VOID
pal_dump_dtb()
{
bsa_print(ACS_PRINT_ERR, L"DTB dump not available for platform initialized"
bsa_print(ACS_PRINT_ERR, L" DTB dump not available for platform initialized"
" with ACPI table \n");
}
/**
Expand Down Expand Up @@ -96,7 +103,7 @@ pal_get_madt_ptr()

Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *) pal_get_xsdt_ptr();
if (Xsdt == NULL) {
bsa_print(ACS_PRINT_ERR, L"XSDT not found \n");
bsa_print(ACS_PRINT_ERR, L" XSDT not found \n");
return 0;
}

Expand Down Expand Up @@ -130,7 +137,7 @@ pal_get_gtdt_ptr()

Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *) pal_get_xsdt_ptr();
if (Xsdt == NULL) {
bsa_print(ACS_PRINT_ERR, L"XSDT not found \n");
bsa_print(ACS_PRINT_ERR, L" XSDT not found \n");
return 0;
}

Expand Down Expand Up @@ -163,7 +170,7 @@ pal_get_mcfg_ptr()

Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *) pal_get_xsdt_ptr();
if (Xsdt == NULL) {
bsa_print(ACS_PRINT_ERR, L"XSDT not found \n");
bsa_print(ACS_PRINT_ERR, L" XSDT not found \n");
return 0;
}

Expand Down Expand Up @@ -196,7 +203,7 @@ pal_get_spcr_ptr()

Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *) pal_get_xsdt_ptr();
if (Xsdt == NULL) {
bsa_print(ACS_PRINT_ERR, L"XSDT not found \n");
bsa_print(ACS_PRINT_ERR, L" XSDT not found \n");
return 0;
}

Expand Down Expand Up @@ -229,7 +236,7 @@ pal_get_iort_ptr()

Xsdt = (EFI_ACPI_DESCRIPTION_HEADER *) pal_get_xsdt_ptr();
if (Xsdt == NULL) {
bsa_print(ACS_PRINT_ERR, L"XSDT not found \n");
bsa_print(ACS_PRINT_ERR, L" XSDT not found \n");
return 0;
}

Expand Down
Loading

0 comments on commit 8df4f63

Please sign in to comment.