Skip to content

Commit

Permalink
Merge pull request #286 from rajatgoyal47/master
Browse files Browse the repository at this point in the history
Updates for SBSA7.1 BETA-0 release
  • Loading branch information
chetan-rathore authored Jan 16, 2023
2 parents 85566c6 + 6e0bd12 commit e60dc6c
Show file tree
Hide file tree
Showing 341 changed files with 34,061 additions and 5,902 deletions.
82 changes: 42 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,37 @@


## Server Base System Architecture
**Server Base System Architecture** (SBSA) specification specifies a hardware system architecture based on the Arm 64-bit architecture. Server system software such as operating systems, hypervisors, and firmware rely on this. It addresses processing element features and key aspects of system architecture.
**Server Base System Architecture** (SBSA) specification specifies a hardware system architecture based on the Arm 64-bit architecture.
Server system software such as operating systems, hypervisors, and firmware rely on this. It addresses processing element features and key aspects of system architecture.

For more information, download the [SBSA specification](https://developer.arm.com/documentation/den0029/e/?lang=en)
For more information, download the [SBSA specification](https://developer.arm.com/documentation/den0029/h/?lang=en)


## SBSA - Architecture Compliance Suite

SBSA **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 [SBSA specification](https://developer.arm.com/documentation/den0029/e/?lang=en), so that implementers can verify if these behaviours have been interpreted correctly.
Most of the tests are executed from UEFI Shell by executing the SBSA UEFI shell application.
A few tests are executed by running the SBSA ACS Linux application which in turn depends on the SBSA ACS Linux kernel module.
SBSA **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 [SBSA specification](https://developer.arm.com/documentation/den0029/h/?lang=en), so that implementers can verify if these behaviours have been interpreted correctly.
Most of the tests are executed from UEFI Shell by executing the SBSA UEFI shell application.
A few tests are executed by running the SBSA ACS Linux application which in turn depends on the SBSA ACS Linux kernel module.


## Release details
- Code Quality: REL v6.1.0
- The tests are written for version 6.1 of the SBSA specification.
- BSA rules referenced in SBSA checklist and common in BSA and SBSA checklist are covered as part of BSA ACS
- For complete SBSA 6.1 coverage, run BSA binary and SBSA binary.
- Code Quality: REL v7.1 BETA-0
- The tests are written for version 7.1 of the SBSA specification.
- The release includes test which are not verified due to platform dependency. Please refer to [testcase-checklist](docs/testcase-checklist.md) for these tests.
- The compliance suite is not a substitute for design verification.
- To review the SBSA ACS logs, Arm licensees can contact Arm directly through their partner managers.
- To know about the gaps in the test coverage, see [Testcase checklist](docs/testcase-checklist.md).
- To know about the gaps in the test coverage, see [Test Scenario Document](docs/Arm_SBSA_Architecture_Compliance_Test_Scenario.pdf).


## GitHub branch
- To pick up the release version of the code, checkout the corresponding tag from master branch.
- To get the latest version of the code with bug fixes and new features, use the master branch.

## Additional reading
- For details on the SBSA ACS UEFI Shell Application, see the [Arm SBSA ACS User Guide](docs/Arm_SBSA_Architecture_Compliance_User_Guide.pdf).
- For details on the SBSA ACS UEFI Shell Application, Linux Application and PMU Linux Application see the [Arm SBSA ACS User Guide](docs/Arm_SBSA_Architecture_Compliance_User_Guide.pdf).
- For details on the design of the SBSA ACS, see the [Arm SBSA Validation Methodology Document](docs/Arm_SBSA_Architecture_Compliance_Validation_Methodology.pdf).
- For information about the test coverage scenarios that are implemented in the current release of ACS and the scenarios that are planned for the future releases, see the [Testcase checklist](docs/testcase-checklist.md).
- For information about the test coverage scenarios that are implemented in the current release of ACS and the scenarios that are planned for the future releases, see the [Test Scenario Document](docs/Arm_SBSA_Architecture_Compliance_Test_Scenario.pdf).

## SBSA ACS Baremetal Reference Code
Bare-metal reference code is added as part of this release. For more information, see
Expand All @@ -50,19 +50,18 @@ To enable the export of a few kernel APIs that are necessary for PCIe and IOMMU
## ACS build steps - UEFI Shell application

### Prebuilt images
Prebuilt images for v22_10_REL6.1.0 release is available in the prebuilt_images folder of the master branch. The prebuilt images of previous release are present in [release branch](https://github.com/chetan-rathore/sbsa-acs/tree/release/prebuilt_images). You can choose to use this images or build your own image by following the steps below. If you choose to use the prebuilt image, jump to the test suite execution section below for details on how to run the application.
Prebuilt images for v23_01_REL7.1.0_BETA-0 release is available in the prebuilt_images folder of the master branch. The prebuilt images of previous release are present in [release branch](https://github.com/chetan-rathore/sbsa-acs/tree/release/prebuilt_images). You can choose to use this images or build your own image by following the steps below. If you choose to use the prebuilt image, jump to the test suite execution section below for details on how to run the application.

### Prerequisites
Before starting the ACS build, ensure that the following requirements are met.
Before starting the build, ensure that the following requirements are met.

- Any mainstream Linux based OS distribution running on a x86 or AArch64 machine.
- Install GCC-ARM 10.3 or later toolchain for Linux from [here](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads).
- git clone the edk2-stable202208 tag of [EDK2 tree](https://github.com/tianocore/edk2).
- git clone the [EDK2 port of libc](https://github.com/tianocore/edk2-libc) SHA: 61687168fe02ac4d933a36c9145fdd242ac424d1.
- Install GCC 7.5 or later toolchain for Linux from [here](https://releases.linaro.org/components/toolchain/binaries/).
- Install the build prerequisite packages to build EDK2.<br />
Note:<br />
- The details of the packages are beyond the scope of this document.
- GCC 7.5 is recommended toolchain, build issues are observed with toolchain version 10.xx and above.

To start the ACS build, perform the following steps:

Expand All @@ -77,22 +76,12 @@ To start the ACS build, perform the following steps:

### Linux build environment
If the build environment is Linux, perform the following steps:
1. export GCC49_AARCH64_PREFIX= GCC7.5 toolchain path pointing to /bin/aarch64-linux-gnu- in case of x86 machine.<br /> For AArch64 build it should point to /usr/bin/
1. export GCC49_AARCH64_PREFIX= GCC 10.3 toolchain path pointing to /bin/aarch64-none-linux-gnu- in case of x86 machine.<br /> For AArch64 build it should point to /usr/bin/
2. export PACKAGES_PATH= path pointing to edk2-libc
3. source edksetup.sh
4. make -C BaseTools/Source/C
5. source ShellPkg/Application/sbsa-acs/tools/scripts/avsbuild.sh

### Windows build environment
If the build environment is Windows, perform the following steps:
1. Set the toolchain path to GCC53 or above.
2. Setup the environment for AArch64 EDK2 build.
3. Setup the environment for PACKAGES_PATH.
4. Build the SBSA shell application.
For example,
build -a AARCH64 -t GCC49 -p ShellPkg/ShellPkg.dsc -m
ShellPkg/Application/sbsa-acs/uefi_app/SbsaAvs.inf

**Note:** To build the ACS with NIST Statistical Test Suite, see the [SBSA_NIST_User_Guide](docs/Arm_SBSA_NIST_User_Guide.md)

### Build output
Expand Down Expand Up @@ -135,14 +124,16 @@ On an emulation environment with secondary storage, perform the following steps:

1. Create an image file which contains the 'Sbsa.efi' file. For Example:
- mkfs.vfat -C -n HD0 hda.img 2097152
- sudo mount -o rw,loop=/dev/loop0,uid=`whoami`,gid=`whoami` hda.img /mnt/sbsa. If loop0 is busy, specify the loop that is free
- sudo mount -o rw,loop=/dev/loop0,uid=`whoami`,gid=`whoami` hda.img /mnt/sbsa.
If loop0 is busy, specify the loop that is free
- cp "<path to application>/Sbsa.efi" /mnt/sbsa/
- sudo umount /mnt/sbsa
2. Load the image file to the secondary storage using a backdoor. The steps followed to load the image file are emulation environment-specific and beyond the scope of this document.
2. Load the image file to the secondary storage using a backdoor.
The steps followed 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.
6. To start the compliance tests, run the executable Sbsa.efi with the appropriate parameters.
6. To start the compliance tests, run the executable Sbsa.efi with the appropriate parameters.
For details on the parameters, see the [SBSA ACS User Guide](docs/Arm_SBSA_Architecture_Compliance_User_Guide.pdf)
7. Copy the UART console output to a log file for analysis and certification.

Expand All @@ -154,8 +145,9 @@ On an emulation platform where secondary storage is not available, perform the f
1. Add the path to 'Sbsa.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 'Sbsa.efi' to start the compliance tests. For details about the parameters,
see the [SBSA ACS User Guide](docs/Arm_SBSA_Architecture_Compliance_User_Guide.pdf).
4. Run the executable 'Sbsa.efi' to start the compliance tests.
For details about the parameters, see the [SBSA ACS User Guide](docs/Arm_SBSA_Architecture_Compliance_User_Guide.pdf).
> shell> Sbsa.efi
5. Copy the UART console output to a log file for analysis and certification.


Expand All @@ -170,17 +162,17 @@ 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, 5.13, 5.15, 6.0.
- Linaro GCC tool chain 7.5 or above.
- Linaro GCC tool chain 10.3 or above.
- Build environment for AArch64 Linux kernel.<br />
NOTE: <br />
- Linux version 6.0 is recommened version.
- GCC 7.5 is recommended toolchain, build issues are observed with toolchain version 10.xx and above.
- GCC 10.3 is recommended toolchain.

#### Porting steps for Linux kernel
1. git clone https://gitlab.arm.com/linux-arm/linux-acs sbsa-acs-drv
2. git clone https://github.com/ARM-software/sbsa-acs.git sbsa-acs
3. git clone https://github.com/torvalds/linux.git -b v6.0
4. export CROSS_COMPILE=<GCC7.5 toolchain path> pointing to /bin/aarch64-linux-gnu-
4. export CROSS_COMPILE=<GCC10.3 toolchain path> pointing to /bin/aarch64-linux-gnu-
5. git apply <local_dir>/sbsa-acs-drv/kernel/src/0001-BSA-ACS-Linux-6.0.patch to your kernel source tree.
6. make ARCH=arm64 defconfig && make -j $(nproc) ARCH=arm64

Expand Down Expand Up @@ -222,8 +214,18 @@ Arm Enterprise ACS test suite may run at higher privilege level. An attacker may
Validating the compliance of certain PCIe rules defined in the SBSA specification requires the PCIe end-point to generate specific stimulus during the runtime of the test. Examples of such stimulus are P2P, PASID, ATC, etc. The tests that requires these stimuli are grouped together in the exerciser module. The exerciser layer is an abstraction layer that enables the integration of hardware capable of generating such stimuli to the test framework.
The details of the hardware or Verification IP which enable these exerciser tests are platform specific and are beyond the scope of this document.

- 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.
### SBSA Level 7 tests dependencies
- MPAM test will require EL3 firmware to enable access to MPAM registers from lower EL's.
If arm trusted firmware is used as EL3 fimrware, enable ENABLE_MPAM_FOR_LOWER_ELS=1 in tf build
- RAS test will require EL3 firmware to enable access to RAS registers from lower EL's and forward RAS related exceptions to lower EL's.
If arm trusted firmware is used as EL3 fimrware, enable EL3_EXCEPTION_HANDLING=1 RAS_EXTENSION=1 HANDLE_EA_EL3_FIRST=1 RAS_TRAP_LOWER_EL_ERR_ACCESS=0 in tf build
- If the above flags are not enabled, MPAM and RAS test can lead to exception at EL3.
- MPAM test will require system to implement MPAM, SRAT, HMAT, PPTT tables.
- RAS test will require system to implement AEST, RAS2, SRAT, HMAT, PPTT tables.
- PMU test will require system to implement APMT table.
- Entrophy rule will require ACS to build with STS package

**Note:** To build the ACS with NIST Statistical Test Suite, see the [SBSA_NIST_User_Guide](docs/Arm_SBSA_NIST_User_Guide.md)

|APIs |Description |Affected tests |
|-----------------------------|------------------------------------------------------------------------------|------------------------|
Expand All @@ -246,10 +248,10 @@ SBSA ACS is distributed under Apache v2.0 License.
## Feedback, contributions, and support

- For feedback, use the GitHub Issue Tracker that is associated with this repository.
- For support, send an email to "support-enterprise[email protected]" with details.
- For support, send an email to "support-systemready[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.

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

*Copyright (c) 2018-2022, Arm Limited and Contributors. All rights reserved.*
*Copyright (c) 2018-2023 Arm Limited and Contributors. All rights reserved.*
Binary file modified docs/Arm_SBSA_Architecture_Compliance_Test_Scenario.pdf
Binary file not shown.
Binary file modified docs/Arm_SBSA_Architecture_Compliance_User_Guide.pdf
Binary file not shown.
Binary file not shown.
24 changes: 12 additions & 12 deletions docs/Arm_SBSA_NIST_User_Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@ To start the ACS build with NIST STS, perform the following steps:
*_*_*_CC_FLAGS =
!endif
!include StdLib/StdLib.inc
!include edk2-libc/StdLib/StdLib.inc
```
4. Modify the following in the StdLib/LibC/Main/Main.c
4. Modify the following in the edk2-libc/StdLib/LibC/Main/Main.c
```
-extern int main( int, char**);
+extern int ShellAppMainsbsa( int, char**);
```
5. Modify the following in ShellAppMain() of StdLib/LibC/Main/Main.c
5. Modify the following in ShellAppMain() of edk2-libc/StdLib/LibC/Main/Main.c
```
-ExitVal = (INTN)main( (int)Argc, gMD->NArgV);
+ExitVal = (INTN)ShellAppMainsbsa( (int)Argc, gMD->NArgV);
```
6. Comment the map[] variable in StdLib/LibC/Main/Arm/flt_rounds.c to avoid -werror=unused-variable
6. Comment the map[] variable in edk2-libc/StdLib/LibC/Main/Arm/flt_rounds.c to avoid -werror=unused-variable
```
+#if 0
static const int map[] = {
Expand Down Expand Up @@ -104,20 +104,20 @@ The following figure shows the source code directory for SBSA ACS
    │<br/>
    ├── platform<br/>
    │   ├── pal_baremetal<br/>
    │   ├── pal_linux<br/>
    │   ├── pal_uefi<br/>
    │   └── secure_sw<br/>
    │       └── arm-tf<br/>
    │<br/>
|
    ├── test_pool<br/>
    │   ├── exerciser<br/>
    │   ├── gic<br/>
    │   ├── io_virt<br/>
    │   ├── pcie<br/>
    │   ├── pe<br/>
    │   ├── peripherals<br/>
    │   ├── power_wakeup<br/>
    │   ├── secure<br/>
    │   ├── power_wakeup<br/>
    │   ├── mpam<br/>
    │   ├── ras<br/>
    │   ├── pmu<br/>
    │   ├── smmu<br/>
    │   ├── timer_wd<br/>
    │   └── nist_sts<br/>
    │       ├── test_n001.c     ────────>  NIST entry point to STS<br/>
Expand Down Expand Up @@ -170,8 +170,8 @@ Final analysis report is generated when statistical testing is complete. The rep

For more details on NIST STS, see: <https://doi.org/10.6028/NIST.SP.800-22r1a>

**Note**: For SBSA level 6 compliance, passing the NIST statistical test suite is not mandatory.
**Note**: For SBSA level 7 compliance, passing the NIST statistical test suite is required for S_L7ENT_1 rule.

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

*Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.*
*Copyright (c) 2020, 2023, Arm Limited and Contributors. All rights reserved.*
47 changes: 46 additions & 1 deletion docs/Exerciser_porting_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,57 @@ Value1 - Requested transaction data<br/>
Value2 - Null<br/>
Bdf - BDF of the exerciser<br/>
<br/>

### Error Injection
Error injection capability enables user to inject error in a PCIe endpoint.<br/>
- The user can inject an error at that endpoint with the error configured using the error_code field. The error_codes are defined in Error Codes section. This bit is cleared once the error has been injected.
**pal_exerciser_get_param(Type, Value1, Value2, Bdf)**<br/>
Type - ERRR_INJECT_TYPE<br/>
Value1 - Type of error to inject(Refer error code section)<br/>
Value2 - Null<br/>
Bdf - BDF of the exerciser<br/>
**pal_exerciser_ops(Ops, Param, Bdf)**<br/>
Ops - INJECT_ERROR<br/>
Param - Type of error to inject(Refer error code section)<br/>
Bdf - BDF of the exerciser<br/>
<br/>

## Error Codes
|Error Name |Error Code|
|------------------------------------------|----------|
|Correctable Receiver Error |0x00 |
|Correctable Bad TLP |0x01 |
|Correctable Bad DLLP |0x02 |
|Correctable Replay Num Rollover |0x03 |
|Correctable Replay Timer Timeout |0x04 |
|Correctable Advisory Non-Fatal Error |0x05 |
|Correctable Internal Error |0x06 |
|Correctable Header Log OverFlow |0x07 |
|Uncorrectable Data Link Error |0x08 |
|Uncorrectable Surprise Down Error |0x09 |
|Uncorrectable Poisoned TLP Received |0x0A |
|Uncorrectable Flow Control Error |0x0B |
|Uncorrectable Completion Timeout |0x0C |
|Uncorrectable Completer Abort |0x0D |
|Uncorrectable Unexpected Completion |0x0E |
|Uncorrectable Receiver Overflow |0x0F |
|Uncorrectable Malformed TLP |0x10 |
|Uncorrectable ECRC Error |0x11 |
|Uncorrectable Unsupported Request |0x12 |
|Uncorrectable ACS Violation |0x13 |
|Uncorrectable Internal Error |0x14 |
|Uncorrectable MultiCast Blocked TLP |0x15 |
|Uncorrectable Atomic Op Egress Blocked |0x16 |
|Uncorrectable TLP Prefix Blocked Egress |0x17 |
|Uncorrectable Poisoned TLP Egress Blocked |0x18 |
|Invalid configuration |0x19 |
<br/>
<br/>

## License
Arm SBSA ACS is distributed under Apache v2.0 License.

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

*Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.*
*Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved.*

Loading

0 comments on commit e60dc6c

Please sign in to comment.