1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-07-18 16:37:08 +00:00

Compare commits

..

26 Commits

Author SHA1 Message Date
Jon Mason 150169d01f arm/linux-yocto: backport patch to fix 6.5.13 networking issues
Linux kernel commit 9aea191c29e18f7c044a2f95a2da7f7b7fdd0449 (backported
to 6.5.13 as part of the stable process) introduces an bug, which is
preventing networking from functioning (and logging lots of errors in
dmesg).  Linux kernel commit 45b3fae4675dc1d4ee2d7aefa19d85ee4f891377
resolves the issue.

It is need for everything, but only applying for aarch64 to keep the
CI tooling happy.

Signed-off-by: Jon Mason <jon.mason@arm.com>
2024-03-12 14:00:59 -04:00
Emekcan Aras 9a4ae38e84 arm-bsp/optee: Improve PIN counter handling robustness
This patches a security issue discovered lately in OP-TEE version
earlier than v4.1. The detailed report can be found here:

https://github.com/OP-TEE/optee_os/security/advisories/GHSA-2f5m-q4w3-865p

Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
2024-02-21 09:54:41 +00:00
Ross Burton 12e80bade1 CI: use https: to fetch meta-virtualization
Some firewalls may reject git: traffic, so use https.

Signed-off-by: Ross Burton <ross.burton@arm.com>
2024-02-15 12:24:04 +00:00
Harsimran Singh Tungal 6bfd024269 arm-bsp/tf-a-tests: fix corstone1000
The tftf tests are getting stuck on nanbield for corstone1000
due to incompatible optee version. The optee version on nanbield
needs to be upgraded to fix the tftf tests. To avoid that upgrade
on the release branch, some tftf tests are skipped for corstone1000
platform to make the tftf tests work.

Signed-off-by: Harsimran Singh Tungal <harsimransingh.tungal@arm.com>
2024-02-08 14:11:47 +00:00
Ross Burton 7915779267 arm-bsp/documentation: upgrade Sphinx slightly
Many Sphinx plugins now require Sphinx 5+ ([1], [2], and more), so
sphinx 4.5 isn't usable as the requirements in sphinx itself are not
pinned so you end up with a broken setup with errors such as:

sphinx.errors.VersionRequirementError: The sphinxcontrib.serializinghtml
extension used by this project needs at least Sphinx v5.0; it therefore
cannot be built with this version.

There's a sufficient number of plugins that manually pinning them all is
tedious, so upgrade the documentation to Sphinx 5 (and the corresponding
RTD theme).

Also remove sphinx-copybutton, as this extension is unused.

[1] https://github.com/sphinx-doc/sphinxcontrib-applehelp/commit/ccc77c814a92ef21c300e5ef725b76c40b7ce653
[2] https://github.com/sphinx-doc/sphinxcontrib-devhelp/commit/b2dc14bd8bdd7994c565d254772a0ba3ddecfe51

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
2024-01-18 10:53:16 -05:00
Harsimran Singh Tungal 987d685ed0 corstone1000:arm-bsp/tftf: Fix tftf tests on mps3
The tftf tests were getting crashed on the MPS3 and two issues were found
during investigation. This change set provide fix for those issues:
1. The tftf tests were getting crashed on the MPS3 when compiled with
LOG_LEVEL=50. So, reducing the log level and aligning it with the TF-A
allows us to get rid of the crash.

2. Once the above crash got resolved, it has been found that tftf tests
were getting asserted while reading the value of the register
GICD_ITARGETSR. The reason for the crash is that the value of this register
is zero. As per the GIC documentation, this register is RAZ/WI for uniprocessor
implementation and corstone1000 is uniprocessor implementation for FPGA.
So, this change compiles the tftf tests in release mode which allows us
to compile out the assert definitions.

Signed-off-by: Harsimran Singh Tungal <harsimransingh.tungal@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
2024-01-18 09:34:00 -05:00
Debbie Martin 79c52afe74 ci: Add Arm SystemReady firmware and IR ACS builds
Add CI builds for Arm SystemReady Firmware within the fvp-base CI job and a new
Arm SystemReady IR ACS build job. Add the CI kas config for each of these
builds.

The ACS build can be controlled by the ACS_TEST GitLab variable to specify
whether or not to run the testimage. If this variable is not set, the
testimage step will not run. The job tag can be controlled by the ACS_TAG GitLab
variable.

Signed-off-by: Debbie Martin <Debbie.Martin@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
2024-01-08 09:09:36 -05:00
Debbie Martin 5afb0ce40e arm-systemready: Add parted dependency and inherit testimage
Add the parted-native dependency explicitly which is needed to
use wic commands.

Also explicitly inherit testimage. This means that the kas config
is no longer required to include it in IMAGE_CLASSES.

Signed-off-by: Debbie Martin <Debbie.Martin@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
2024-01-08 09:09:36 -05:00
Harsimran Singh Tungal ae11c9d473 arm-bsp/documentation: corstone1000: fix the steps in the user guide and instructions
Provide updates and fixes in the user guide identified during testing.

Signed-off-by: Harsimran Singh Tungal <harsimransingh.tungal@arm.com>
Signed-off-by: Emekcan Aras <Emekcan.Aras@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
2023-12-06 09:11:22 -05:00
Emekcan Aras 0bd7fece41 arm-bsp/documentation: corstone1000: fix the requirements.txt and conf.py path
Readthedocs server requires an absolute path from project's root
directory to find correct requirements.txt and conf.py.

Signed-off-by: Emekcan Aras <Emekcan.Aras@arm.com>
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Signed-off-by: Ross Burton <ross.burton@arm.com>
2023-11-24 19:49:49 +00:00
Emekcan Aras 507eb6c01c arm-bsp/documentation: corstone1000: add readthedocs.yaml file
Migrate Corstone-1000 documentation to .readthedocs.yaml configuration file v2.

Signed-off-by: Emekcan Aras <Emekcan.Aras@arm.com>
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Signed-off-by: Ross Burton <ross.burton@arm.com>
2023-11-24 16:32:38 +00:00
Abdellatif El Khlifi 118c376ab2 kas: corstone1000: pin the SHAs
Upgrade the Corstone-1000 YMLs as follows:

- Set the layers SHAs
- Align with Kas v4
- Update the layers list

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Signed-off-by: Ross Burton <ross.burton@arm.com>
2023-11-24 15:12:13 +00:00
Emekcan Aras af84b2c79d arm-bsp/documentation: corstone1000: add a note and fix instructions
Add a note for Capsule update negative test scenario and fixes instructions
regarding distro-boot in Corstone-1000 user guide.

Signed-off-by: Emekcan Aras <Emekcan.Aras@arm.com>
Signed-off-by: Delane Brandy <delane.brandy@arm.com>
Signed-off-by: Ross Burton <ross.burton@arm.com>
2023-11-24 15:12:13 +00:00
Emekcan Aras 4cb225ae8f arm-bsp/documentation: corstone1000: Add EFI system partition section
Adds creating an EFI System Partition for Corstone-1000.

Signed-off-by: Emekcan Aras <Emekcan.Aras@arm.com>
Signed-off-by: Ross Burton <ross.burton@arm.com>
2023-11-24 15:12:13 +00:00
Abdellatif El Khlifi e0f91d02ab arm-bsp/documentation: corstone1000: update the user guide
align the user guide with the upcoming CORSTONE1000-2023.11 release

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Signed-off-by: Ross Burton <ross.burton@arm.com>
2023-11-24 13:40:39 +00:00
Emekcan Aras 7d04734458 arm-bsp/documentation: corstone1000: update the architecture document
align the architecture document with the upcoming CORSTONE1000-2023.11 release

Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Signed-off-by: Ross Burton <ross.burton@arm.com>
2023-11-24 13:40:39 +00:00
Abdellatif El Khlifi b7d14693f4 arm-bsp/documentation: corstone1000: update the change log
align the change log with the upcoming CORSTONE1000-2023.11 release

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Signed-off-by: Ross Burton <ross.burton@arm.com>
2023-11-24 13:40:39 +00:00
Abdellatif El Khlifi 3ead3b9ecd arm-bsp/documentation: corstone1000: update the release note
align the release note with the upcoming CORSTONE1000-2023.11 release

Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Signed-off-by: Ross Burton <ross.burton@arm.com>
2023-11-24 13:40:39 +00:00
Emekcan Aras 8e0757c6cf arm-bsp/u-boot: corstone1000: enable virtio-net support for FVP
Use Ethernet over VirtIO on FVP due to lan91c111 Ethernet driver support dropped from U-Boot.
This patch enables virtio-net device in u-boot to pass ACS tests related to
NIC and PXE. The current ethernet device still works in linux kernel and
corstone1000-mps3 Ethernet device is supported by u-boot, so no change is
required regarding existing Ethernet device.

Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
Signed-off-by: Ross Burton <ross.burton@arm.com>
2023-11-24 13:40:39 +00:00
Emekcan Aras 1cc64ee62f arm-bsp/corstone1000-fvp: Disable Time Annotation
Timing Annotation is a feature of the model that enables high-level
performance estimations to be made [1]. This currently doesn't work
properly with the new models and it's recommended to unset FASTSIM_DISABLE_TA.

[1] https://developer.arm.com/documentation/100965/1119/Timing-Annotation

Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
Signed-off-by: Ross Burton <ross.burton@arm.com>
2023-11-24 13:40:39 +00:00
Emekcan Aras 326013b877 arm-bsp/corstone1000-fvp: add unpadded image support for MMC card config
Enables unpadded image support for MMC cards.

Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
Signed-off-by: Ross Burton <ross.burton@arm.com>
2023-11-24 13:40:39 +00:00
Emekcan Aras 070c349a85 arm-bsp/corstone1000-fvp: Add virtio-net configuration
Adds virtio-net configuration to use virtio-net in corstone1000-fvp.

Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
Signed-off-by: Ross Burton <ross.burton@arm.com>
2023-11-24 13:40:39 +00:00
Emekcan Aras 472df5300f arm/fvp-corstone1000: upgrade to 11.23_25
Upgrade to the 11.23_25 release of the FVP.

Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
Signed-off-by: Ross Burton <ross.burton@arm.com>
2023-11-24 13:40:39 +00:00
Delane Brandy 238dc94e2b arm-bsp/documentation: corstone1000: Update the user guide
Update the user guide to include Linux distro installation on fvp

Signed-off-by: Delane Brandy <delane.brandy@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
2023-11-24 13:40:39 +00:00
Emekcan Aras 6bdf52fb09 arm-bsp/corstone1000: fix synchronization issue on openamp notification
This fixes a race that is observed rarely in the FVP. It occurs in FVP
when tfm sends the notication ack in openamp, and then reset the access
request which resets the mhu registers before received by the host
processor. It implements the fix both in SE and the host processor openamp
wrapper. This solution enables polling on the status register of mhu until
the notificaiton is read by the host processor. (Inspired by
signal_and_wait_for_signal function in mhu_wrapper_v2_x.c in trusted-firmware-m
https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/target/arm/rss/common/native_drivers/mhu_wrapper_v2_x.c#n61)

Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
2023-11-24 13:40:39 +00:00
Ross Burton 81b3db6673 arm-bsp/optee-os: update Upstream-Status tags
Fix some formatting, and switch Accepted to Backport.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
2023-11-24 12:26:42 +00:00
34 changed files with 1038 additions and 253 deletions
+18 -2
View File
@@ -9,6 +9,8 @@ variables:
# by default
FF_KUBERNETES_HONOR_ENTRYPOINT: 1
FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY: 0
ACS_TEST: 0
ACS_TAG: ""
stages:
- prep
@@ -67,8 +69,8 @@ stages:
name: "logs"
when: always
paths:
- $CI_PROJECT_DIR/work/build/tmp/work*/**/temp/log.do_*.*
- $CI_PROJECT_DIR/work/build/tmp/work*/**/testimage/*
- $CI_PROJECT_DIR/work/build/tmp*/work*/**/temp/log.do_*.*
- $CI_PROJECT_DIR/work/build/tmp*/work*/**/testimage/*
#
# Prep stage, update repositories once.
@@ -126,6 +128,20 @@ fvp-base:
matrix:
- TESTING: testimage
- FIRMWARE: edk2
- SYSTEMREADY_FIRMWARE: arm-systemready-firmware
arm-systemready-ir-acs:
extends: .build
timeout: 12h
parallel:
matrix:
# arm-systemready-ir-acs must be specified after fvp-base for ordering
# purposes for the jobs-to-kas output. It is not enough to just have it
# in the job name because fvp-base.yml overwrites the target.
- PLATFORM: fvp-base
ARM_SYSTEMREADY_IR_ACS: arm-systemready-ir-acs
tags:
- ${ACS_TAG}
fvps:
extends: .build
+4
View File
@@ -0,0 +1,4 @@
header:
version: 11
includes:
- kas/arm-systemready-firmware.yml
+14
View File
@@ -0,0 +1,14 @@
header:
version: 11
includes:
- kas/arm-systemready-ir-acs.yml
env:
ACS_TEST: "0"
local_conf_header:
testimage: |
TESTIMAGE_AUTO = "${ACS_TEST}"
target:
- arm-systemready-ir-acs
+1 -1
View File
@@ -5,4 +5,4 @@ header:
repos:
meta-virtualization:
url: git://git.yoctoproject.org/meta-virtualization
url: https://git.yoctoproject.org/meta-virtualization
-5
View File
@@ -8,10 +8,5 @@ env:
# The full testimage run typically takes around 12-24h on fvp-base.
TEST_OVERALL_TIMEOUT: "${@ 24*60*60}"
local_conf_header:
systemready-ir-acs: |
IMAGE_CLASSES:append = " testimage"
target:
- arm-systemready-ir-acs
+6 -5
View File
@@ -1,5 +1,5 @@
header:
version: 11
version: 14
env:
DISPLAY: ""
@@ -8,7 +8,7 @@ distro: poky-tiny
defaults:
repos:
refspec: master
branch: nanbield
repos:
meta-arm:
@@ -19,21 +19,22 @@ repos:
poky:
url: https://git.yoctoproject.org/git/poky
refspec: 31dd418207f6c95ef0aad589cd03cd2a4c9a8bf2
commit: 2e9c2a2381105f1306bcbcb54816cbc5d8110eff
layers:
meta:
meta-poky:
meta-yocto-bsp:
meta-openembedded:
url: https://git.openembedded.org/meta-openembedded
refspec: 5a01ab461c9bcabcbb2298236602373948f8f073
commit: 1750c66ae8e4268c472c0b2b94748a59d6ef866d
layers:
meta-oe:
meta-python:
meta-perl:
meta-secure-core:
url: https://github.com/wind-river/meta-secure-core.git
commit: e29165a1031dcf601edbed1733cedd64826672a5
layers:
meta:
meta-signing-key:
+1 -1
View File
@@ -1,5 +1,5 @@
header:
version: 11
version: 14
includes:
- kas/corstone1000-base.yml
- kas/fvp-eula.yml
+1 -1
View File
@@ -1,5 +1,5 @@
header:
version: 11
version: 14
includes:
- kas/corstone1000-base.yml
@@ -16,6 +16,9 @@ FVP_PROVIDER ?= "fvp-corstone1000-native"
FVP_EXE ?= "FVP_Corstone-1000"
FVP_CONSOLE ?= "host_terminal_0"
#Disable Time Annotation
FASTSIM_DISABLE_TA = "0"
# FVP Parameters
FVP_CONFIG[se.trustedBootROMloader.fname] ?= "bl1.bin"
FVP_CONFIG[board.xnvm_size] ?= "64"
@@ -49,10 +52,19 @@ FVP_CONFIG[board.msd_mmc.p_fast_access] ?= "0"
FVP_CONFIG[board.msd_mmc.diagnostics] ?= "2"
FVP_CONFIG[board.msd_mmc.p_max_block_count] ?= "0xFFFF"
FVP_CONFIG[board.msd_config.pl180_fifo_depth] ?= "16"
FVP_CONFIG[board.msd_mmc.support_unpadded_images] ?= "true"
# MMC2 card configuration
FVP_CONFIG[board.msd_mmc_2.card_type] ?= "SDHC"
FVP_CONFIG[board.msd_mmc_2.p_fast_access] ?= "0"
FVP_CONFIG[board.msd_mmc_2.diagnostics] ?= "2"
FVP_CONFIG[board.msd_mmc_2.p_max_block_count] ?= "0xFFFF"
FVP_CONFIG[board.msd_config_2.pl180_fifo_depth] ?= "16"
FVP_CONFIG[board.msd_config_2.pl180_fifo_depth] ?= "16"
FVP_CONFIG[board.msd_mmc_2.support_unpadded_images] ?= "true"
# Virtio-Net configuration
FVP_CONFIG[board.virtio_net.enabled] ?= "1"
FVP_CONFIG[board.virtio_net.hostbridge.interfaceName] ?= "eth1"
FVP_CONFIG[board.virtio_net.hostbridge.userNetworking] ?= "true"
FVP_CONFIG[board.virtio_net.hostbridge.userNetPorts] ?= "5555=5555,8080=80,2222=22"
FVP_CONFIG[board.virtio_net.transport] ?= "legacy"
@@ -0,0 +1,12 @@
version: 2
build:
os: "ubuntu-22.04"
tools:
python: "3.9"
sphinx:
configuration: meta-arm-bsp/documentation/corstone1000/conf.py
formats:
- pdf
python:
install:
- requirements: meta-arm-bsp/documentation/requirements.txt
@@ -10,6 +10,77 @@ Change Log
This document contains a summary of the new features, changes and
fixes in each release of Corstone-1000 software stack.
***************
Version 2023.11
***************
Changes
=======
- Making Corstone-1000 SystemReady IR 2.0 certifiable
- Allow booting Debian & OpenSUSE on FVP
- Add support for two MMC cards for the FVP
- Add signed capsule update support
- Enable on-disk capsule update
- Add the feature of purging specific DT nodes in U-Boot before Linux
- Add Ethernet over VirtIO support in U-Boot
- Add support for unaligned MMC card images
- Reducing the out-of-tree patches by upstreaming them to the corresponding open-source projects
- SW components upgrades
- Bug fixes
Corstone-1000 components versions
=================================
+-------------------------------------------+-----------------------------------------------------+
| arm-ffa-tee | 1.1.2-r0 |
+-------------------------------------------+-----------------------------------------------------+
| linux-yocto | 6.5.7 |
+-------------------------------------------+-----------------------------------------------------+
| u-boot | 2023.07 |
+-------------------------------------------+-----------------------------------------------------+
| external-system | 0.1.0+gitAUTOINC+8c9dca74b1-r0 |
+-------------------------------------------+-----------------------------------------------------+
| optee-client | 3.22.0 |
+-------------------------------------------+-----------------------------------------------------+
| optee-os | 3.22.0 |
+-------------------------------------------+-----------------------------------------------------+
| trusted-firmware-a | 2.9.0 |
+-------------------------------------------+-----------------------------------------------------+
| trusted-firmware-m | 1.8.1 |
+-------------------------------------------+-----------------------------------------------------+
| libts | 08b3d39471 |
+-------------------------------------------+-----------------------------------------------------+
| ts-newlib | 4.1.0 |
+-------------------------------------------+-----------------------------------------------------+
| ts-psa-{crypto, iat, its. ps}-api-test | 38cb53a4d9 |
+-------------------------------------------+-----------------------------------------------------+
| ts-sp-{se-proxy, smm-gateway} | 08b3d39471 |
+-------------------------------------------+-----------------------------------------------------+
Yocto distribution components versions
======================================
+-------------------------------------------+------------------------------+
| meta-arm | nanbield |
+-------------------------------------------+------------------------------+
| poky | nanbield |
+-------------------------------------------+------------------------------+
| meta-openembedded | nanbield |
+-------------------------------------------+------------------------------+
| meta-secure-core | nanbield |
+-------------------------------------------+------------------------------+
| busybox | 1.36.1 |
+-------------------------------------------+------------------------------+
| musl | 1.2.4 |
+-------------------------------------------+------------------------------+
| gcc-arm-none-eabi | 11.2-2022.02 |
+-------------------------------------------+------------------------------+
| gcc-cross-aarch64 | 13.2.0 |
+-------------------------------------------+------------------------------+
| openssl | 3.1.3 |
+-------------------------------------------+------------------------------+
***************
Version 2023.06
***************
@@ -19,6 +19,27 @@ intended for safety-critical applications. Should Your Software or Your Hardware
prove defective, you assume the entire cost of all necessary servicing, repair
or correction.
***********************
Release notes - 2023.11
***********************
Known Issues or Limitations
---------------------------
- Use Ethernet over VirtIO due to lan91c111 Ethernet driver support dropped from U-Boot.
- Temporally removing the External system support in Linux due to it using multiple custom devicetree bindings that caused problems with SystemReady IR 2.0 certification. For External system support please refer to the version 2023.06. We are aiming to restore it in a more standardised manner in our next release.
- Due to the performance uplimit of MPS3 FPGA and FVP, some Linux distros like Fedora Rawhide can not boot on Corstone-1000 (i.e. user may experience timeouts or boot hang).
- PSA Crypto tests (psa-crypto-api-test command) approximately take 30 minutes to complete for FVP and MPS3.
- Corstone-1000 SoC on FVP doesn't have a secure debug peripheral. It does on the MPS3.
- See previous release notes for the known limitations regarding ACS tests.
Platform Support
-----------------
- This software release is tested on Corstone-1000 FPGA version AN550_v2
https://developer.arm.com/downloads/-/download-fpga-images
- This software release is tested on Corstone-1000 Fast Model platform (FVP) version 11.23_25
https://developer.arm.com/tools-and-software/open-source-software/arm-platforms-software/arm-ecosystem-fvps
***********************
Release notes - 2023.06
***********************
@@ -72,8 +72,10 @@ non-secure and the secure world is performed via FF-A messages.
An external system is intended to implement use-case specific
functionality. The system is based on Cortex-M3 and run RTX RTOS.
Communictaion between external system and Host(cortex-A35) is performed
using MHU as transport mechanism and rpmsg messaging system.
Communication between the external system and Host (Cortex-A35) is performed
using MHU as transport mechanism and rpmsg messaging system (the external system
support in Linux is disabled in this release. More info about this change can be found in the
release-notes).
Overall, the Corstone-1000 architecture is designed to cover a range
of Power, Performance, and Area (PPA) applications, and enable extension
@@ -157,9 +159,9 @@ Secure Firmware Update
**********************
Apart from always booting the authorized images, it is also essential that
the device only accepts the authorized images in the firmware update
the device only accepts the authorized (signed) images in the firmware update
process. Corstone-1000 supports OTA (Over the Air) firmware updates and
follows Platform Security Firmware Update sepcification (`FWU`_).
follows Platform Security Firmware Update specification (`FWU`_).
As standardized into `FWU`_, the external flash is divided into two
banks of which one bank has currently running images and the other bank is
@@ -172,7 +174,10 @@ Image (the initramfs bundle). The new images are accepted in the form of a UEFI
:width: 690
:alt: ExternalFlash
When Firmware update is triggered, u-boot verifies the capsule by checking the
capsule signature, version number and size. Then it signals the Secure Enclave
that can start writing UEFI capsule into the flash. Once this operation finishes
,Secure Enclave resets the entire system.
The Metadata Block in the flash has the below firmware update state machine.
TF-M runs an OTA service that is responsible for accepting and updating the
images in the flash. The communication between the UEFI Capsule update
@@ -230,7 +235,7 @@ References
.. _Arm security features: https://www.arm.com/architecture/security-features/platform-security
.. _linux repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
.. _FF-A: https://developer.arm.com/documentation/den0077/latest
.. _FF-M: https://developer.arm.com/-/media/Files/pdf/PlatformSecurityArchitecture/Architect/DEN0063-PSA_Firmware_Framework-1.0.0-2.pdf?revision=2d1429fa-4b5b-461a-a60e-4ef3d8f7f4b4&hash=3BFD6F3E687F324672F18E5BE9F08EDC48087C93
.. _FF-M: https://developer.arm.com/architectures/Firmware%20Framework%20for%20M-Profile
.. _FWU: https://developer.arm.com/documentation/den0118/a/
.. _OPTEE-OS: https://github.com/OP-TEE/optee_os
.. _PSA: https://www.psacertified.org/
@@ -18,7 +18,7 @@ for more information.
Prerequisites
-------------
This guide assumes that your host PC is running Ubuntu 20.04 LTS, with at least
This guide assumes that your host machine is running Ubuntu 20.04 LTS, with at least
32GB of free disk space and 16GB of RAM as minimum requirement.
The following prerequisites must be available on the host system:
@@ -68,33 +68,33 @@ Trusted Firmware-A
==================
Based on `Trusted Firmware-A <https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git>`__
+----------+-----------------------------------------------------------------------------------------------------+
| bbappend | <_workspace>/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a_2.8.%.bbappend |
+----------+-----------------------------------------------------------------------------------------------------+
| Recipe | <_workspace>/meta-arm/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a_2.8.0.bb |
+----------+-----------------------------------------------------------------------------------------------------+
+----------+-------------------------------------------------------------------------------------------------+
| bbappend | <_workspace>/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a_%.bbappend |
+----------+-------------------------------------------------------------------------------------------------+
| Recipe | <_workspace>/meta-arm/meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a_2.9.0.bb |
+----------+-------------------------------------------------------------------------------------------------+
OP-TEE
======
Based on `OP-TEE <https://git.trustedfirmware.org/OP-TEE/optee_os.git>`__
+----------+------------------------------------------------------------------------------------+
| bbappend | <_workspace>/meta-arm/meta-arm-bsp/recipes-security/optee/optee-os_3.20.0.bbappend |
+----------+------------------------------------------------------------------------------------+
| Recipe | <_workspace>/meta-arm/meta-arm/recipes-security/optee/optee-os_3.20.0.bb |
+----------+------------------------------------------------------------------------------------+
+----------+----------------------------------------------------------------------------------------+
| bbappend | <_workspace>/meta-arm/meta-arm-bsp/recipes-security/optee/optee-os_3.22.0.bbappend |
+----------+----------------------------------------------------------------------------------------+
| Recipe | <_workspace>/meta-arm/meta-arm-bsp/recipes-security/optee/optee-os_3.22.0.bb |
+----------+----------------------------------------------------------------------------------------+
U-Boot
======
Based on `U-Boot repo`_
+----------+-------------------------------------------------------------------------+
| bbappend | <_workspace>/meta-arm/meta-arm/recipes-bsp/u-boot/u-boot_%.bbappend |
+----------+-------------------------------------------------------------------------+
| bbappend | <_workspace>/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot_%.bbappend |
+----------+-------------------------------------------------------------------------+
| Recipe | <_workspace>/poky/meta/recipes-bsp/u-boot/u-boot_2023.01.bb |
+----------+-------------------------------------------------------------------------+
+----------+----------------------------------------------------------------------------+
| bbappend | <_workspace>/meta-arm/meta-arm/recipes-bsp/u-boot/u-boot_%.bbappend |
+----------+----------------------------------------------------------------------------+
| bbappend | <_workspace>/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot_%.bbappend |
+----------+----------------------------------------------------------------------------+
| Recipe | <_workspace>/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot_2023.07.02.bb |
+----------+----------------------------------------------------------------------------+
Linux
=====
@@ -107,30 +107,20 @@ recipe responsible for building a tiny version of Linux is listed below.
+-----------+----------------------------------------------------------------------------------------------+
| bbappend | <_workspace>/meta-arm/meta-arm-bsp/recipes-kernel/linux/linux-yocto_%.bbappend |
+-----------+----------------------------------------------------------------------------------------------+
| Recipe | <_workspace>/poky/meta/recipes-kernel/linux/linux-yocto_6.1.bb |
| Recipe | <_workspace>/poky/meta/recipes-kernel/linux/linux-yocto_6.5.bb |
+-----------+----------------------------------------------------------------------------------------------+
| defconfig | <_workspace>/meta-arm/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/defconfig |
+-----------+----------------------------------------------------------------------------------------------+
External System Tests
=====================
Based on `Corstone-1000/applications <https://git.gitlab.arm.com/arm-reference-solutions/corstone1000/applications>`__
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Recipe | <_workspace>/meta-arm/meta-arm-bsp/recipes-test/corstone1000-external-sys-tests/corstone1000-external-sys-tests_1.0.bb |
+------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
The recipe provides the systems-comms-tests command run in Linux and used for testing the External System.
**************************************************
Software for Boot Processor (a.k.a Secure Enclave)
**************************************************
Based on `Trusted Firmware-M <https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git>`__
+----------+-----------------------------------------------------------------------------------------------------+
| bbappend | <_workspace>/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.7.%.bbappend |
| bbappend | <_workspace>/meta-arm/meta-arm-bsp/recipes-bsp/trusted-firmware-m/trusted-firmware-m_%.bbappend |
+----------+-----------------------------------------------------------------------------------------------------+
| Recipe | <_workspace>/meta-arm/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.7.0.bb |
| Recipe | <_workspace>/meta-arm/meta-arm/recipes-bsp/trusted-firmware-m/trusted-firmware-m_1.8.1.bb |
+----------+-----------------------------------------------------------------------------------------------------+
********************************
@@ -156,7 +146,7 @@ to as ``<_workspace>`` in these instructions. To create the folder, run:
cd <_workspace>
Corstone-1000 software is based on the Yocto Project which uses kas and bitbake
commands to build the stack. To install kas tool, run:
commands to build the stack. kas version 4 is required. To install kas, run:
::
@@ -168,7 +158,7 @@ In the top directory of the workspace ``<_workspace>``, run:
::
git clone https://git.yoctoproject.org/git/meta-arm -b CORSTONE1000-2023.06
git clone https://git.yoctoproject.org/git/meta-arm -b CORSTONE1000-2023.11
To build a Corstone-1000 image for MPS3 FPGA, run:
@@ -343,7 +333,7 @@ A Yocto recipe is provided and allows to download the latest supported FVP versi
The recipe is located at <_workspace>/meta-arm/meta-arm/recipes-devtools/fvp/fvp-corstone1000.bb
The latest supported Fixed Virtual Platform (FVP) version is 11.19_21 and is automatically downloaded and installed when using the runfvp command as detailed below. The FVP version can be checked by running the following command:
The latest supported Fixed Virtual Platform (FVP) version is 11_23.25 and is automatically downloaded and installed when using the runfvp command as detailed below. The FVP version can be checked by running the following command:
::
@@ -374,8 +364,6 @@ The host will boot trusted-firmware-a, OP-TEE, U-Boot and then Linux, and presen
Login using the username root.
The External System can be released out of reset on demand using the systems-comms-tests command.
SystemReady-IR tests
--------------------
@@ -398,6 +386,110 @@ steps described in following section "Clean Secure Flash Before Testing" to
erase the SecureEnclave flash cleanly and prepare a clean board environment for
the testing.
Prepare EFI System Partition
===========================================================
Corstone-1000 FVP and FPGA do not have enough on-chip nonvolatile memory to host
an EFI System Partition (ESP). Thus, Corstone-1000 uses mass storage device for
ESP. The instructions below should be followed for both FVP and FPGA before
running the ACS tests.
**Common to FVP and FPGA:**
#. Create an empty 100 MB partition:
::
dd if=/dev/zero of=corstone1000-efi-partition.img iflag=fullblock bs=512 count=204800 && sync
#. Use OpenSuse Raw image to copy the contents of EFI partition.
To download OpenSUSE Tumbleweed raw image:
- Under `OpenSUSE Tumbleweed appliances <http://download.opensuse.org/ports/aarch64/tumbleweed/appliances/>`__
- The user should look for a Tumbleweed-ARM-JeOS-efi.aarch64-* Snapshot, for example,
``openSUSE-Tumbleweed-ARM-JeOS-efi.aarch64-<date>-Snapshot<date>.raw.xz``
Once the .raw.xz file is downloaded, the raw image file needs to be extracted:
::
unxz <file-name.raw.xz>
The above command will generate a file ending with extension .raw image. Use the
following command to get address of the first partition
::
fdisk -lu <path-to-img>/openSUSE-Tumbleweed-ARM-JeOS-efi.aarch64-<date>-Snapshot<date>.raw
-> Device Start End Sectors Size Type
<path-to-img>/openSUSE-Tumbleweed-ARM-JeOS-efi.aarch64-<date>-Snapshot<date>.raw1 8192 40959 32768 16M EFI System
<path-to-img>/openSUSE-Tumbleweed-ARM-JeOS-efi.aarch64-<date>-Snapshot<date>.raw2 40960 1064959 1024000 500M Linux swap
<path-to-img>/openSUSE-Tumbleweed-ARM-JeOS-efi.aarch64-<date>-Snapshot<date>.raw3 1064960 5369822 4304863 2.1G Linux filesystem
-> <blockaddress_1st_partition> = 8192
-> <sectorsize_1st_partition> = 32768
#. Copy the ESP from opensuse image to empty image:
::
dd conv=notrunc if=openSUSE-Tumbleweed-ARM-JeOS-efi.aarch64-<date>-Snapshot<date>.raw skip=<blockaddress_1st_partition> of=corstone1000-efi-partition.img seek=<blockaddress_1st_partition> iflag=fullblock seek=<blockaddress_1st_partition> bs=512 count=<sectorsize_1s_partition> && sync
#. Create the file efi_disk.layout locally. Copy the content of provided disk layout below to the efi_disk.layout to label the ESP correctly.
efi_disk.layout
::
label: gpt
label-id: AC53D121-B818-4515-9031-BE02CCEB8701
device: corstone1000-efi-partition.img
unit: sectors
first-lba: 34
last-lba: 204766
corstone1000-efi-partition.img : start=8192, size=32768, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=792D821F-98AE-46E3-BABD-948003A650F8, name="p.UEFI"
And use the following command the label the newly created ESP.
::
sfdisk corstone1000-efi-partition.img < efi_disk.layout
To test the image, you can now mount the disk image
::
fdisk -lu corstone1000-efi-partition.img
-> Device Start End Sectors Size Type
corstone1000-efi-partition.img1 8192 40959 32768 16M EFI System
<offset_1st_partition> = 8192 * 512 (sector size) = 4194304
sudo mount -o loop,offset=4194304 corstone1000-efi-partition.img /mount_point
**Using ESP in FPGA:**
Once the ESP is created, it needs to be flashed to a second USB drive different than ACS image.
This can be done with the development machine. In the given example here
we assume the USB device is ``/dev/sdb`` (the user should use ``lsblk`` command to
confirm). Be cautious here and don't confuse your host machine own hard drive with the
USB drive. Run the following commands to prepare the ACS image in USB stick:
::
sudo dd if=corstone1000-efi-partition.img of=/dev/sdb iflag=direct oflag=direct status=progress bs=512; sync;
Now you can plug this USB stick to the board together with ACS test USB stick.
**Using ESP in FVP:**
The ESP disk image can directly be used in Corstone-1000 FVP by simply passing it as
the 2nd MMC card image.
::
<_workspace>/meta-arm/scripts/runfvp <_workspace>/build/tmp/deploy/images/corstone1000-fvp/corstone1000-image-corstone1000-fvp.fvpconf -- -C board.msd_mmc.p_mmc_file="${<path-to-img>/ir_acs_live_image.img}" -C board.msd_mmc_2.p_mmc_file="${<path-to-img>/corstone1000-efi-partition.img}"
Clean Secure Flash Before Testing (applicable to FPGA only)
===========================================================
@@ -408,8 +500,8 @@ boot. Run following commands to build such image.
::
cd <_workspace>
git clone https://git.yoctoproject.org/git/meta-arm -b CORSTONE1000-2023.06
git clone https://git.gitlab.arm.com/arm-reference-solutions/systemready-patch.git -b CORSTONE1000-2023.06
git clone https://git.yoctoproject.org/git/meta-arm -b CORSTONE1000-2023.11
git clone https://git.gitlab.arm.com/arm-reference-solutions/systemready-patch.git -b CORSTONE1000-2023.11
cp -f systemready-patch/embedded-a/corstone1000/erase_flash/0001-embedded-a-corstone1000-clean-secure-flash.patch meta-arm
cd meta-arm
git apply 0001-embedded-a-corstone1000-clean-secure-flash.patch
@@ -471,7 +563,7 @@ BOOT partition contains the following:
└── ramdisk-busybox.img
RESULT partition is used to store the test results.
**NOTE**: PLEASE MAKE SURE THAT THE RESULT PARTITION IS EMPTY BEFORE YOU START THE TESTING. OTHERWISE THE TEST RESULTS
**NOTE**: PLEASE MAKE SURE THAT "acs_results" FOLDER UNDER THE RESULT PARTITION IS EMPTY BEFORE YOU START THE TESTING. OTHERWISE THE TEST RESULTS
WILL NOT BE CONSISTENT
FPGA instructions for ACS image
@@ -500,7 +592,7 @@ SystemReady release in this repository.
Then, the user should prepare a USB stick with ACS image. In the given example here,
we assume the USB device is ``/dev/sdb`` (the user should use ``lsblk`` command to
confirm). Be cautious here and don't confuse your host PC's own hard drive with the
confirm). Be cautious here and don't confuse your host machine own hard drive with the
USB drive. Run the following commands to prepare the ACS image in USB stick:
::
@@ -510,11 +602,16 @@ USB drive. Run the following commands to prepare the ACS image in USB stick:
sudo dd if=ir-acs-live-image-generic-arm64.wic of=/dev/sdb iflag=direct oflag=direct bs=1M status=progress; sync
Once the USB stick with ACS image is prepared, the user should make sure that
ensure that only the USB stick with the ACS image is connected to the board,
ensure that both USB sticks (ESP and ACS image) are connected to the board,
and then boot the board.
The FPGA will reset multiple times during the test, and it might take approx. 24-36 hours to finish the test.
**NOTE**: The USB stick which contains the ESP partition might cause grub to
unable to find the bootable partition (only in the FPGA). If that's the case, please
remove the USB stick and run the ACS tests. ESP partition can be mounted after
the platform is booted to linux at the end of the ACS tests.
FVP instructions for ACS image and run
======================================
@@ -522,14 +619,14 @@ FVP instructions for ACS image and run
Download ACS image from:
- ``https://gitlab.arm.com/systemready/acs/arm-systemready/-/tree/main/IR/prebuilt_images/v23.03_2.0.0``
Use the below command to run the FVP with ACS image support in the
SD card.
Use the below command to run the FVP with EFI and ACS image support in the
SD cards.
::
unxz ${<path-to-img>/ir-acs-live-image-generic-arm64.wic.xz}
<_workspace>/meta-arm/scripts/runfvp --terminals=xterm <_workspace>/build/tmp/deploy/images/corstone1000-fvp/corstone1000-image-corstone1000-fvp.fvpconf -- -C board.msd_mmc.p_mmc_file=<path-to-img>/ir-acs-live-image-generic-arm64.wic
<_workspace>/meta-arm/scripts/runfvp --terminals=xterm <_workspace>/build/tmp/deploy/images/corstone1000-fvp/corstone1000-image-corstone1000-fvp.fvpconf -- -C board.msd_mmc.p_mmc_file=<path-to-img>/ir-acs-live-image-generic-arm64.wic -C board.msd_mmc_2.p_mmc_file="${<path-to-img>/corstone1000-efi-partition.img}"
The test results can be fetched using following commands:
@@ -550,6 +647,20 @@ the test. At the end of test, the FVP host terminal will halt showing a shell pr
Once test is finished, the FVP can be stoped, and result can be copied following above
instructions.
**NOTE:** A rare issue has been noticed (5-6% occurence) during which the FVP hangs during booting the system while running ACS tests.
If this happens, please apply the following patch, rebuild the software stack for FVP and re-run the ACS tests.
::
cd <_workspace>
git clone https://git.gitlab.arm.com/arm-reference-solutions/systemready-patch.git -b CORSTONE1000-2023.11
cp -f systemready-patch/embedded-a/corstone1000/sr_ir_workaround/0001-embedded-a-corstone1000-sr-ir-workaround.patch meta-arm
cd meta-arm
git am 0001-embedded-a-corstone1000-sr-ir-workaround.patch
cd ..
kas shell meta-arm/kas/corstone1000-fvp.yml:meta-arm/ci/debug.yml -c="bitbake u-boot -c cleanall; bitbake trusted-firmware-a -c cleanall; corstone1000-image -c cleanall; bitbake corstone1000-image"
Common to FVP and FPGA
======================
@@ -568,7 +679,7 @@ The results can be fetched from the ``acs_results`` folder in the RESULT partiti
Manual capsule update and ESRT checks
-------------------------------------
The following section describes running manual capsule update with the ``direct`` method.
The following section describes running manual capsule update.
The steps described in this section perform manual capsule update and show how to use the ESRT feature
to retrieve the installed capsule details.
@@ -592,10 +703,17 @@ Download u-boot under <_workspace> and install tools:
make tools-only_defconfig
make tools-only
**NOTE:** The following error could happen if the linux build system does not have "libgnutls28-dev".
**error: "tools/mkeficapsule.c:21:10: fatal error: gnutls/gnutls.h: No such file or directory"**. If that's the case please install libgnutls28-dev and its dependencies by using the following command.
::
sudo apt-get install -y libgnutls28-dev
Download systemready-patch repo under <_workspace>:
::
git clone https://git.gitlab.arm.com/arm-reference-solutions/systemready-patch.git -b CORSTONE1000-2023.06
git clone https://git.gitlab.arm.com/arm-reference-solutions/systemready-patch.git -b CORSTONE1000-2023.11
*******************
Generating Capsules
@@ -699,20 +817,7 @@ Then, unmount the IR image:
sudo umount /mnt/test
**NOTE:**
The size of first partition in the image file is calculated in the following way. The data is
just an example and might vary with different ir-acs-live-image-generic-arm64.wic files.
::
fdisk -lu <path-to-img>/ir-acs-live-image-generic-arm64.wic
-> Device Start End Sectors Size Type
<path-to-img>/ir-acs-live-image-generic-arm64.wic1 2048 206847 204800 100M Microsoft basic data
<path-to-img>/ir-acs-live-image-generic-arm64.wic2 206848 1024239 817392 399.1M Linux filesystem
<path-to-img>/ir-acs-live-image-generic-arm64.wic3 1026048 1128447 102400 50M Microsoft basic data
-> <offset_1st_partition> = 2048 * 512 (sector size) = 1048576
**NOTE:** Please refer to `FVP instructions for ACS image and run`_ section to find the first partition offset.
******************************
Performing the capsule update
@@ -730,10 +835,7 @@ Run the FVP with the IR prebuilt image:
<_workspace>/meta-arm/scripts/runfvp --terminals=xterm <_workspace>/build/tmp/deploy/images/corstone1000-fvp/corstone1000-image-corstone1000-fvp.fvpconf -- -C board.msd_mmc.p_mmc_file=<path-to-img>/ir-acs-live-image-generic-arm64.wic
**NOTE:**
<path-to-img> must start from the root directory.
make sure there are no spaces before or after of "=". board.msd_mmc.p_mmc_file=<path-to-img>/ir-acs-live-image-generic-arm64.wic.
**NOTE:** <path-to-img> must start from the root directory. make sure there are no spaces before or after of "=". board.msd_mmc.p_mmc_file=<path-to-img>/ir-acs-live-image-generic-arm64.wic.
Running the FPGA with the IR prebuilt image
===========================================
@@ -859,8 +961,8 @@ In the Linux command-line run the following:
lowest_supported_fw_ver: 0
Negative scenario
=================
Negative scenario (Applicable to FPGA only)
===========================================
In the negative case scenario (rollback the capsule version), the user should
see appropriate logs in the secure enclave terminal.
@@ -923,19 +1025,25 @@ In the Linux command-line run the following:
last_attempt_version: 5
lowest_supported_fw_ver: 0
**Note**: This test is currently not working properly in Corstone-1000 FVP.
However, it is not part of the System-Ready IR tests, and it won't affect the
SR-IR certification. All the compulsory `capsule update tests for SR-IR
<https://developer.arm.com/documentation/DUI1101/2-1/Test-SystemReady-IR/Test-UpdateCapsule>`__
works on both Corstone-1000 FVP and FPGA.
Linux distros tests
-------------------
*************************************************************
Debian install and boot preparation (applicable to FPGA only)
Debian install and boot preparation
*************************************************************
There is a known issue in the `Shim 15.7 <https://salsa.debian.org/efi-team/shim/-/tree/upstream/15.7?ref_type=tags>`__
provided with the Debian installer image (see below). This bug causes a fatal
error when attempting to boot media installer for Debian, and it resets the MPS3 before installation starts.
error when attempting to boot media installer for Debian, and it resets the platform before installation starts.
A patch to be applied to the Corstone-1000 stack (only applicable when
installing Debian) is provided to
`Skip the Shim <https://gitlab.arm.com/arm-reference-solutions/systemready-patch/-/blob/CORSTONE1000-2023.06/embedded-a/corstone1000/shim/0001-arm-bsp-u-boot-corstone1000-Skip-the-shim-by-booting.patch>`__.
`Skip the Shim <https://gitlab.arm.com/arm-reference-solutions/systemready-patch/-/blob/CORSTONE1000-2023.11/embedded-a/corstone1000/shim/0001-arm-bsp-u-boot-corstone1000-Skip-the-shim-by-booting.patch>`__.
This patch makes U-Boot automatically bypass the Shim and run grub and allows
the user to proceed with a normal installation. If at the moment of reading this
document the problem is solved in the Shim, the user is encouraged to try the
@@ -947,36 +1055,58 @@ documentation.
::
cd <_workspace>
git clone https://git.gitlab.arm.com/arm-reference-solutions/systemready-patch.git -b CORSTONE1000-2023.06
git clone https://git.gitlab.arm.com/arm-reference-solutions/systemready-patch.git -b CORSTONE1000-2023.11
cp -f systemready-patch/embedded-a/corstone1000/shim/0001-arm-bsp-u-boot-corstone1000-Skip-the-shim-by-booting.patch meta-arm
cd meta-arm
git am 0001-arm-bsp-u-boot-corstone1000-Skip-the-shim-by-booting.patch
cd ..
**On FPGA**
::
kas shell meta-arm/kas/corstone1000-mps3.yml:meta-arm/ci/debug.yml -c="bitbake u-boot trusted-firmware-a corstone1000-image -c cleansstate; bitbake corstone1000-image"
Please update the cs1000.bin on the SD card with the newly generated wic file.
**On FVP**
::
kas shell meta-arm/kas/corstone1000-fvp.yml:meta-arm/ci/debug.yml -c="bitbake u-boot trusted-firmware-a corstone1000-image -c cleansstate; bitbake corstone1000-image"
On FPGA, please update the cs1000.bin on the SD card with the newly generated wic file.
**NOTE:** Skip the shim patch only applies to Debian installation. The user should remove the patch from meta-arm before running the software to boot OpenSUSE or executing any other tests in this user guide. You can make sure of removing the skip the shim patch by executing the steps below.
::
cd <_workspace>/meta-arm
git reset --hard HEAD~1
cd ..
kas shell meta-arm/kas/corstone1000-fvp.yml:meta-arm/ci/debug.yml -c="bitbake u-boot -c cleanall; bitbake trusted-firmware-a -c cleanall; corstone1000-image -c cleanall; bitbake corstone1000-image"
*************************************************
Debian/openSUSE install (applicable to FPGA only)
Preparing the Installation Media
*************************************************
To test Linux distro install and boot, the user should prepare two empty USB
sticks (minimum size should be 4GB and formatted with FAT32).
Download one of following Linux distro images:
- `Debian 12.0.0 installer image <https://cdimage.debian.org/debian-cd/current/arm64/iso-dvd/debian-12.0.0-arm64-DVD-1.iso>`__
- `OpenSUSE Tumbleweed installer image <http://download.opensuse.org/ports/aarch64/tumbleweed/iso/>`__
- `Debian installer image <https://cdimage.debian.org/debian-cd/current/arm64/iso-dvd/>`__ (Tested on: debian-12.2.0-arm64-DVD-1.iso)
- `OpenSUSE Tumbleweed installer image <http://download.opensuse.org/ports/aarch64/tumbleweed/iso/>`__ (Tested on: openSUSE-Tumbleweed-DVD-aarch64-Snapshot20231120-Media.iso)
**NOTE:** For OpenSUSE Tumbleweed, the user should look for a DVD Snapshot like
openSUSE-Tumbleweed-DVD-aarch64-Snapshot<date>-Media.iso
Once the iso file is downloaded, the iso file needs to be flashed to your USB
drive. This can be done with your development machine.
FPGA
==================================================
To test Linux distro install and boot on FPGA, the user should prepare two empty USB
sticks (minimum size should be 4GB and formatted with FAT32).
The downloaded iso file needs to be flashed to your USB drive.
This can be done with your development machine.
In the example given below, we assume the USB device is ``/dev/sdb`` (the user
should use the `lsblk` command to confirm).
**NOTE:** Please don't confuse your host PC's own hard drive with the USB drive.
**NOTE:** Please don't confuse your host machine own hard drive with the USB drive.
Then, copy the contents of the iso file into the first USB stick by running the
following command in the development machine:
@@ -984,6 +1114,27 @@ following command in the development machine:
sudo dd if=<path-to-iso_file> of=/dev/sdb iflag=direct oflag=direct status=progress bs=1M; sync;
FVP
==================================================
To test Linux distro install and boot on FVP, the user should prepare an mmc image.
With a minimum size of 8GB formatted with gpt.
::
#Generating mmc2
dd if=/dev/zero of=<_workspace>/mmc2_file.img bs=1 count=0 seek=8G; sync;
parted -s mmc2_file.img mklabel gpt
*************************************************
Debian/openSUSE install
*************************************************
FPGA
==================================================
Unplug the first USB stick from the development machine and connect it to the
MSP3 board. At this moment, only the first USB stick should be connected. Open
the following picocom sessions in your development machine:
@@ -1001,15 +1152,25 @@ the process.
**NOTE:** Due to the performance limitation of Corstone-1000 MPS3 FPGA, the
distro installation process can take up to 24 hours to complete.
FVP
==================================================
::
<_workspace>/meta-arm/scripts/runfvp --terminals=xterm <_workspace>/build/tmp/deploy/images/corstone1000-fvp/corstone1000-image-corstone1000-fvp.fvpconf -- -C board.msd_mmc.p_mmc_file="<path-to-iso_file>" -C board.msd_mmc_2.p_mmc_file="<_workspace>/mmc2_file.img"
The installer should now start.
The os will be installed on the second mmc 'mmc2_file.img'.
*******************************************************
Debian install clarifications (applicable to FPGA only)
Debian install clarifications
*******************************************************
As the installation process for Debian is different than the one for openSUSE,
Debian may need some extra steps, that are indicated below:
During Debian installation, please answer the following question:
- "Force GRUB installation to the EFI removable media path?" Yes
- "Force grub installation to the EFI removable media path?" Yes
- "Update NVRAM variables to automatically boot into Debian?" No
If the grub installation fails, these are the steps to follow on the subsequent
@@ -1040,21 +1201,56 @@ popups:
8. At this stage, the installation should proceed as normal.
*****************************************************************
Debian/openSUSE boot after installation (applicable to FPGA only)
Debian/openSUSE boot after installation
*****************************************************************
FPGA
===============
Once the installation is complete, unplug the first USB stick and reboot the
board.
The board will then enter recovery mode, from which the user can access a shell
after entering the password for the root user. Proceed to edit the following
files accordingly:
after entering the password for the root user.
FVP
==============
Once the installation is complete, you will need to exit the shell instance
and run this command to boot into the installed OS:
::
<_workspace>/meta-arm/scripts/runfvp --terminals=xterm <_workspace>/build/tmp/deploy/images/corstone1000-fvp/corstone1000-image-corstone1000-fvp.fvpconf -- -C board.msd_mmc.p_mmc_file="<_workspace>/mmc2_file.img"
Once the FVP begins booting, you will need to quickly change the boot option in grub,
to boot into recovery mode.
**NOTE:** This option will disappear quickly, so it's best to preempt it.
Select 'Advanced Options for '<OS>' and then '<OS> (recovery mode)'.
Common
==============
Proceed to edit the following files accordingly:
::
#Only applicable to Debian
vi /etc/systemd/system.conf
DefaultDeviceTimeoutSec=infinity
The file to be editted next is different depending on the installed distro:
::
#Only applicable to openSUSE
vi /usr/lib/systemd/system.conf
DefaultDeviceTimeoutSec=infinity
The system.conf has been moved from /etc/systemd/ to /usr/lib/systemd/ and directly modifying
the /usr/lib/systemd/system.conf is not working and it is getting overridden. We have to create
drop ins system configurations in /etc/systemd/system.conf.d/ directory. So, copy the
/usr/lib/systemd/system.conf to /etc/systemd/system.conf.d/ directory after the mentioned modifications.
The file to be edited next is different depending on the installed distro:
::
@@ -1068,8 +1264,9 @@ To make sure the changes are applied, please run:
systemctl daemon-reload
After applying the previous commands, please reboot the board. The user should
see a login prompt after booting, for example, for debian:
After applying the previous commands, please reboot the board or restart the runfvp command.
The user should see a login prompt after booting, for example, for debian:
::
@@ -1078,37 +1275,7 @@ see a login prompt after booting, for example, for debian:
Login with the username root and its corresponding password (already set at
installation time).
************************************************************
OpenSUSE Raw image install and boot (applicable to FVP only)
************************************************************
Steps to download OpenSUSE Tumbleweed raw image:
- Under `OpenSUSE Tumbleweed appliances <http://download.opensuse.org/ports/aarch64/tumbleweed/appliances/>`__
- The user should look for a Tumbleweed-ARM-JeOS-efi.aarch64-* Snapshot, for example,
``openSUSE-Tumbleweed-ARM-JeOS-efi.aarch64-<date>-Snapshot<date>.raw.xz``
Once the .raw.xz file is downloaded, the raw image file needs to be extracted:
::
unxz <file-name.raw.xz>
The above command will generate a file ending with extension .raw image. Now, use the following command
to run FVP with raw image installation process.
::
<_workspace>/meta-arm/scripts/runfvp --terminals=xterm <_workspace>/build/tmp/deploy/images/corstone1000-fvp/corstone1000-image-corstone1000-fvp.fvpconf -- -C board.msd_mmc.p_mmc_file="${openSUSE raw image file path}"
After successfully installing and booting the Linux distro, the user should see
a openSUSE login prompt.
::
localhost login:
Login with the username 'root' and password 'linux'.
**NOTE:** Debian/OpenSUSE Timeouts are not applicable for all systems. Some systems are faster than the others (especially when running the FVP) and works well with default timeouts. If the system boots to Debian or OpenSUSE unmodified, the user can skip this section.
PSA API tests
-------------
@@ -1129,7 +1296,7 @@ First, load FF-A TEE kernel module:
::
insmod /lib/modules/6.1.32-yocto-standard/extra/arm-ffa-tee.ko
insmod /lib/modules/*-yocto-standard/updates/arm-ffa-tee.ko
Then, check whether the FF-A TEE driver is loaded correctly by using the following command:
@@ -1141,7 +1308,7 @@ The output should be:
::
arm_ffa_tee 16384 - - Live 0xffffffc000510000 (O)
arm_ffa_tee <ID> - - Live <address> (O)
Now, run the PSA API tests in the following order:
@@ -1154,105 +1321,16 @@ Now, run the PSA API tests in the following order:
**NOTE:** The psa-crypto-api-test takes between 30 minutes to 1 hour to run.
External System tests
---------------------
**************************************************************
Running the External System test command (systems-comms-tests)
**************************************************************
Test 1: Releasing the External System out of reset
==================================================
Run this command in the Linux command-line:
::
systems-comms-tests 1
The output on the External System terminal should be:
::
___ ___
| / __|
|=== \___
|___ |___/
External System Cortex-M3 Processor
Running RTX RTOS
v0.1.0_2022-10-19_16-41-32-8c9dca7
MHUv2 module 'MHU0_H' started
MHUv2 module 'MHU1_H' started
MHUv2 module 'MHU0_SE' started
MHUv2 module 'MHU1_SE' started
Test 2: Communication
=====================
Test 2 releases the External System out of reset if not already done. Then, it performs communication between host and External System.
After running Test 1, run this command in the Linux command-line:
::
systems-comms-tests 2
Additional output on the External System terminal will be printed:
::
MHUv2: Message from 'MHU0_H': 0xabcdef1
Received 'abcdef1' From Host MHU0
CMD: Increment and return to sender...
MHUv2: Message from 'MHU1_H': 0xabcdef1
Received 'abcdef1' From Host MHU1
CMD: Increment and return to sender...
When running Test 2 the first, Test 1 will be run in the background.
The output on the External System terminal should be:
::
___ ___
| / __|
|=== \___
|___ |___/
External System Cortex-M3 Processor
Running RTX RTOS
v0.1.0_2022-10-19_16-41-32-8c9dca7
MHUv2 module 'MHU0_H' started
MHUv2 module 'MHU1_H' started
MHUv2 module 'MHU0_SE' started
MHUv2 module 'MHU1_SE' started
MHUv2: Message from 'MHU0_H': 0xabcdef1
Received 'abcdef1' From Host MHU0
CMD: Increment and return to sender...
MHUv2: Message from 'MHU1_H': 0xabcdef1
Received 'abcdef1' From Host MHU1
CMD: Increment and return to sender...
The output on the Host terminal should be:
::
Received abcdf00 from es0mhu0
Received abcdf00 from es0mhu1
Tests results
-------------
As a reference for the end user, reports for various tests for `Corstone-1000 software (CORSTONE1000-2023.06) <https://git.yoctoproject.org/meta-arm/tag/?h=CORSTONE1000-2023.06>`__
As a reference for the end user, reports for various tests for `Corstone-1000 software (CORSTONE1000-2023.11) <https://git.yoctoproject.org/meta-arm/tag/?h=CORSTONE1000-2023.11>`__
can be found `here <https://gitlab.arm.com/arm-reference-solutions/arm-reference-solutions-test-report/-/tree/master/embedded-a/corstone1000>`__.
Running the software on FVP on Windows
--------------------------------------
Running the software on FVP on Windows or AArch64 Linux
------------------------------------------------------------
If the user needs to run the Corstone-1000 software on FVP on Windows. The user
should follow the build instructions in this document to build on Linux host
PC, and copy the output binaries to the Windows PC where the FVP is located,
and launch the FVP binary.
The user should follow the build instructions in this document to build on a Linux host machine. Then, copy the output binaries to the Windows or Aarch64 Linux machine where the FVP is located. Then, launch the FVP binary.
Security Issue Reporting
------------------------
+2 -3
View File
@@ -6,7 +6,6 @@
jinja2==3.1.1
# Required to build the documentation
sphinx==4.5.0
sphinx_rtd_theme==1.0.0
sphinx-copybutton==0.5.0
sphinx~=5.0
sphinx_rtd_theme~=2.0.0
docutils==0.17.1
@@ -0,0 +1,33 @@
From 27300daa2397c89e13aa648db30aa5c6acb06bcc Mon Sep 17 00:00:00 2001
From: Harsimran Singh Tungal <harsimransingh.tungal@arm.com>
Date: Fri, 2 Feb 2024 11:58:33 +0000
Subject: [PATCH] corstone1000: skip tftf tests
Skip some tests for platform corstone1000 which make the tftf tests
hanged when use with optee v3.22
Upstream-Status: Pending
Signed-off-by: Harsimran Singh Tungal <harsimransingh.tungal@arm.com>
---
plat/arm/corstone1000/tests_to_skip.txt | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/plat/arm/corstone1000/tests_to_skip.txt b/plat/arm/corstone1000/tests_to_skip.txt
index fdab230..c5eaac0 100644
--- a/plat/arm/corstone1000/tests_to_skip.txt
+++ b/plat/arm/corstone1000/tests_to_skip.txt
@@ -13,3 +13,11 @@ Timer framework Validation/Verify the timer interrupt generation
CPU Hotplug/CPU hotplug
PSCI CPU Suspend
PSCI STAT/for valid composite state CPU suspend
+FF-A Direct messaging/FF-A Request SP-to-SP direct messaging
+FF-A Direct messaging/FF-A Request SP-to-SP direct messaging deadlock
+FF-A Memory Sharing/Share Memory with Secure World
+FF-A Memory Sharing/Request Donate Memory SP-to-SP
+FF-A Memory Sharing/Request Share Memory SP-to-VM
+SIMD,SVE Registers context/Check that SIMD registers context is preserved
+FF-A Interrupt/Test NS interrupts
+SMMUv3 tests
--
2.34.1
@@ -1,6 +1,14 @@
# Machine specific TFAs
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
COMPATIBLE_MACHINE:corstone1000 = "corstone1000"
SRCREV:corstone1000 = "5f591f67738a1bbe6b262c53d9dad46ed8bbcd67"
EXTRA_OEMAKE:append:corstone1000 = " DEBUG=0"
EXTRA_OEMAKE:append:corstone1000 = " LOG_LEVEL=30"
TFTF_MODE:corstone1000 = "release"
SRC_URI:append:corstone1000 = " \
file://0001-corstone1000-skip-tftf-tests.patch \
"
COMPATIBLE_MACHINE:n1sdp = "n1sdp"
@@ -19,6 +19,9 @@ EXTRA_OEMAKE += "USE_NVM=0"
EXTRA_OEMAKE += "SHELL_COLOR=1"
EXTRA_OEMAKE += "DEBUG=1"
# Modify mode based on debug or release mode
TFTF_MODE ?= "debug"
# Platform must be set for each machine
TFA_PLATFORM ?= "invalid"
@@ -45,7 +48,7 @@ SYSROOT_DIRS += "/firmware"
do_install() {
install -d -m 755 ${D}/firmware
install -m 0644 ${B}/${TFA_PLATFORM}/debug/tftf.bin ${D}/firmware/tftf.bin
install -m 0644 ${B}/${TFA_PLATFORM}/${TFTF_MODE}/tftf.bin ${D}/firmware/tftf.bin
}
do_deploy() {
@@ -0,0 +1,50 @@
From b70dd14eed59d7c5833ded8469cf99e631951e14 Mon Sep 17 00:00:00 2001
From: Emekcan Aras <emekcan.aras@arm.com>
Date: Wed, 15 Nov 2023 09:52:19 +0000
Subject: [PATCH] platform: corstone1000: fix synchronization issue on openamp
notification
This fixes a race that is observed rarely in the FVP. It occurs in FVP
when tfm sends the notication ack in openamp, and then reset the access
request which resets the mhu registers before received by the host
processor. This solution introduces polling on the status register of
mhu until the notificaiton is read by the host processor. (Inspired by
signal_and_wait_for_signal function in mhu_wrapper_v2_x.c in trusted-firmware-m
https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/target/arm/rss/common/native_drivers/mhu_wrapper_v2_x.c#n61)
Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
Upstream-Status: Pending [Not submitted to upstream yet]
---
.../corstone1000/openamp/platform_spe_dual_core_hal.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/platform/ext/target/arm/corstone1000/openamp/platform_spe_dual_core_hal.c b/platform/ext/target/arm/corstone1000/openamp/platform_spe_dual_core_hal.c
index 7613345ffc..b58088032f 100644
--- a/platform/ext/target/arm/corstone1000/openamp/platform_spe_dual_core_hal.c
+++ b/platform/ext/target/arm/corstone1000/openamp/platform_spe_dual_core_hal.c
@@ -83,7 +83,7 @@ enum tfm_plat_err_t tfm_dual_core_hal_init(void)
enum tfm_plat_err_t tfm_hal_notify_peer(void)
{
- uint32_t access_ready;
+ uint32_t access_ready,val;
enum mhu_v2_x_error_t status;
struct mhu_v2_x_dev_t* dev = &MHU1_SE_TO_HOST_DEV;
@@ -108,6 +108,13 @@ enum tfm_plat_err_t tfm_hal_notify_peer(void)
return TFM_PLAT_ERR_SYSTEM_ERR;
}
+ do {
+ status = mhu_v2_x_channel_poll(dev, MHU1_SEH_NOTIFY_CH, &val);
+ if (status != MHU_V_2_X_ERR_NONE) {
+ break;
+ }
+ } while(val != 0);
+
status = mhu_v2_x_reset_access_request(dev);
if (status != MHU_V_2_X_ERR_NONE) {
SPMLOG_ERRMSGVAL("mhu_v2_x_reset_access_request : ", status);
--
2.25.1
@@ -36,6 +36,7 @@ SRC_URI:append:corstone1000 = " \
file://0006-Platform-Corstone1000-Enable-Signed-Capsule.patch \
file://0007-platform-corstone1000-increase-ITS-max-asset-size.patch \
file://0008-platform-corstone1000-align-capsule-update-structs.patch \
file://0009-platform-corstone1000-fix-synchronization-issue-on-o.patch \
"
# TF-M ships patches for external dependencies that needs to be applied
@@ -49,6 +49,7 @@ SRC_URI:append = " \
file://0039-enables-ondisk-capsule-update-feature.patch \
file://0040-fix-runtime-capsule-update-flags-checks.patch \
file://0041-scatter-gather-flag-workaround.patch \
file://0042-corstone1000-enable-virtio-net-support.patch \
"
do_configure:append(){
@@ -0,0 +1,97 @@
From 2ddd34b6838e836cf94a9da2f65cd01a21252846 Mon Sep 17 00:00:00 2001
From: Emekcan Aras <emekcan.aras@arm.com>
Date: Wed, 15 Nov 2023 16:04:06 +0000
Subject: [PATCH] corstone1000: enable virtio-net support
Adds virtio-net support in corstone1000-fvp.
Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
Upstream-Status: Pending [Not submitted to upstream yet]
---
arch/arm/dts/corstone1000-fvp.dts | 6 ++++++
board/armltd/corstone1000/corstone1000.c | 24 +++++++++++++++++++++++-
configs/corstone1000_defconfig | 2 ++
3 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/corstone1000-fvp.dts b/arch/arm/dts/corstone1000-fvp.dts
index 26b0f1b3ce..8e54a40113 100644
--- a/arch/arm/dts/corstone1000-fvp.dts
+++ b/arch/arm/dts/corstone1000-fvp.dts
@@ -21,6 +21,12 @@
reg-io-width = <2>;
};
+ virtio: virtio-net@40400000 {
+ compatible = "virtio,mmio";
+ reg = <0x40400000 0x10000>;
+ interrupts = <145>;
+ };
+
vmmc_v3_3d: fixed_v3_3d {
compatible = "regulator-fixed";
regulator-name = "vmmc_supply";
diff --git a/board/armltd/corstone1000/corstone1000.c b/board/armltd/corstone1000/corstone1000.c
index e3c0e5bf50..ef74dc9032 100644
--- a/board/armltd/corstone1000/corstone1000.c
+++ b/board/armltd/corstone1000/corstone1000.c
@@ -18,6 +18,7 @@
#include <dm/platform_data/serial_pl01x.h>
#include <asm/armv8/mmu.h>
#include <asm/global_data.h>
+#include <generated/dt.h>
/* remove the DT nodes not needed in Linux */
DT_NON_COMPLIANT_PURGE_LIST(foo) = {
@@ -101,6 +102,14 @@ static struct mm_region corstone1000_mem_map[] = {
.size = 0x80000000UL,
.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
PTE_BLOCK_INNER_SHARE
+ }, {
+ /* ethernet */
+ .virt = 0x40400000UL,
+ .phys = 0x40400000UL,
+ .size = 0x00100000UL,
+ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+ PTE_BLOCK_NON_SHARE |
+ PTE_BLOCK_PXN | PTE_BLOCK_UXN
}, {
/* List terminator */
0,
@@ -150,10 +159,23 @@ void fwu_plat_get_bootidx(uint *boot_idx)
int board_late_init(void)
{
struct disk_partition part_info;
- struct udevice *dev, *bdev;
+ struct udevice *dev, *bdev,*virtio_bus, *virtio_child;;
struct nvmxip_plat *plat;
struct blk_desc *desc;
int ret;
+ const char *cmp_dtb = DEVICE_TREE;
+
+ if (!strcmp(cmp_dtb, "corstone1000-fvp")) {
+ ret = uclass_first_device_err(UCLASS_VIRTIO, &virtio_bus);
+ if (!virtio_bus){
+ log_err("Cannot find virtio device\n");
+ return ret;
+ }
+ while (virtio_bus) {
+ device_foreach_child_probe(virtio_child, virtio_bus);
+ uclass_next_device(&virtio_bus);
+ }
+ }
ret = uclass_first_device_err(UCLASS_NVMXIP, &dev);
if (ret < 0) {
diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig
index 2de3f5d7b3..8770b474e2 100644
--- a/configs/corstone1000_defconfig
+++ b/configs/corstone1000_defconfig
@@ -78,3 +78,5 @@ CONFIG_DM_GPIO=y
CONFIG_SYSRESET_PSCI=y
CONFIG_EFI_SET_TIME=y
CONFIG_EFI_GET_TIME=y
+CONFIG_VIRTIO_NET=y
+CONFIG_VIRTIO_MMIO=y
--
2.25.1
@@ -4,7 +4,7 @@ Date: Thu, 31 Aug 2023 10:51:54 +0100
Subject: [PATCH] Handle logging syscall
Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
Upstream-Status: Inappropriate [Other]
Upstream-Status: Pending [upstreamed differently in 280b6a3]
---
core/arch/arm/kernel/spmc_sp_handler.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
@@ -1,4 +1,4 @@
Upstream-Status: Pending [Not submitted to upstream yet]
Upstream-Status: Pending [upstreamed differently in 280b6a3]
Signed-off-by: Vishnu Banavath <vishnu.banavath@arm.com>
From b3fde6c2e1a950214f760ab9f194f3a6572292a8 Mon Sep 17 00:00:00 2001
@@ -20,10 +20,11 @@ change in TF-A ("feat(qemu): update abi between spmd and spmc") [2].
file. Used by Trusted OS (BL32), that is, OP-TEE in this case
Link: [2] https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/commit/?id=25ae7ad1878244f78206cc7c91f7bdbd267331a1
Upstream-Status: Accepted
Acked-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Upstream-Status: Backport [f1f431c7a92671b4fa397976d381cc5ad8adacc4]
Signed-off-by: Gyorgy Szing <Gyorgy.Szing@arm.com>
---
core/arch/arm/kernel/boot.c | 8 +++++++-
core/arch/arm/kernel/entry_a64.S | 17 ++++++++---------
@@ -9,10 +9,11 @@ This commit adds functionality to save the TOS_FW_CONFIG too, so we can
retrieve it later. This is necessary for the CFG_CORE_SEL1_SPMC use
case, because the SPMC manifest is passed in this DT.
Upstream-Status: Accepted
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Balint Dobszay <balint.dobszay@arm.com>
Upstream-Status: Backport [809fa817ae6331d98b55f7afaa3c20f8407822e4]
Signed-off-by: Gyorgy Szing <Gyorgy.Szing@arm.com>
---
core/arch/arm/kernel/boot.c | 60 ++++++++++++++++++++++-
core/arch/arm/kernel/entry_a32.S | 3 +-
@@ -0,0 +1,205 @@
From d75c42ff2847b090d5b1f11c49067cd41fcc2734 Mon Sep 17 00:00:00 2001
From: Loic Poulain <loic.poulain@linaro.org>
Date: Tue, 31 Oct 2023 11:07:00 +0100
Subject: [PATCH] ta: pkcs11: Improve PIN counter handling robustness
Make sure PIN check attempt is saved persistently before continuing with
the actual PIN verification, improving counter and flags coherency in
case of subsequent failure with persistent saving.
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Upstream-Status: Backport [https://github.com/OP-TEE/optee_os/pull/6445/commits/0a74733d9437d94a5b4b2db6c40c5755cabc5393]
---
ta/pkcs11/src/pkcs11_token.c | 126 +++++++++++++++++------------------
1 file changed, 62 insertions(+), 64 deletions(-)
diff --git a/ta/pkcs11/src/pkcs11_token.c b/ta/pkcs11/src/pkcs11_token.c
index ab0fc291e..c5271e449 100644
--- a/ta/pkcs11/src/pkcs11_token.c
+++ b/ta/pkcs11/src/pkcs11_token.c
@@ -1132,117 +1132,115 @@ static enum pkcs11_rc check_so_pin(struct pkcs11_session *session,
uint8_t *pin, size_t pin_size)
{
struct ck_token *token = session->token;
+ struct token_persistent_main *db = token->db_main;
enum pkcs11_rc rc = PKCS11_CKR_OK;
- assert(token->db_main->flags & PKCS11_CKFT_TOKEN_INITIALIZED);
+ assert(db->flags & PKCS11_CKFT_TOKEN_INITIALIZED);
if (IS_ENABLED(CFG_PKCS11_TA_AUTH_TEE_IDENTITY) &&
- token->db_main->flags & PKCS11_CKFT_PROTECTED_AUTHENTICATION_PATH)
+ db->flags & PKCS11_CKFT_PROTECTED_AUTHENTICATION_PATH)
return verify_identity_auth(token, PKCS11_CKU_SO);
- if (token->db_main->flags & PKCS11_CKFT_SO_PIN_LOCKED)
+ if (db->flags & PKCS11_CKFT_SO_PIN_LOCKED)
return PKCS11_CKR_PIN_LOCKED;
- rc = verify_pin(PKCS11_CKU_SO, pin, pin_size,
- token->db_main->so_pin_salt,
- token->db_main->so_pin_hash);
- if (rc) {
- unsigned int pin_count = 0;
+ /*
+ * Preset the counter and flags conservatively in the database so that
+ * the tentative is saved whatever happens next.
+ */
+ db->flags |= PKCS11_CKFT_SO_PIN_COUNT_LOW;
+ db->so_pin_count++;
- if (rc != PKCS11_CKR_PIN_INCORRECT)
- return rc;
+ if (db->so_pin_count == PKCS11_TOKEN_SO_PIN_COUNT_MAX - 1)
+ db->flags |= PKCS11_CKFT_SO_PIN_FINAL_TRY;
+ else if (db->so_pin_count == PKCS11_TOKEN_SO_PIN_COUNT_MAX)
+ db->flags |= PKCS11_CKFT_SO_PIN_LOCKED;
- token->db_main->flags |= PKCS11_CKFT_SO_PIN_COUNT_LOW;
- token->db_main->so_pin_count++;
-
- pin_count = token->db_main->so_pin_count;
- if (pin_count == PKCS11_TOKEN_SO_PIN_COUNT_MAX - 1)
- token->db_main->flags |= PKCS11_CKFT_SO_PIN_FINAL_TRY;
- if (pin_count == PKCS11_TOKEN_SO_PIN_COUNT_MAX)
- token->db_main->flags |= PKCS11_CKFT_SO_PIN_LOCKED;
-
- update_persistent_db(token);
+ update_persistent_db(token);
- if (token->db_main->flags & PKCS11_CKFT_SO_PIN_LOCKED)
+ rc = verify_pin(PKCS11_CKU_SO, pin, pin_size,
+ db->so_pin_salt,
+ db->so_pin_hash);
+ if (rc == PKCS11_CKR_PIN_INCORRECT) {
+ if (db->flags & PKCS11_CKFT_SO_PIN_LOCKED)
return PKCS11_CKR_PIN_LOCKED;
return PKCS11_CKR_PIN_INCORRECT;
}
- if (token->db_main->so_pin_count) {
- token->db_main->so_pin_count = 0;
+ if (rc)
+ db->so_pin_count--;
+ else
+ db->so_pin_count = 0;
- update_persistent_db(token);
+ db->flags &= ~PKCS11_CKFT_SO_PIN_LOCKED;
+ if (db->so_pin_count < PKCS11_TOKEN_SO_PIN_COUNT_MAX - 1) {
+ db->flags &= ~PKCS11_CKFT_SO_PIN_FINAL_TRY;
+ if (!db->so_pin_count)
+ db->flags &= ~PKCS11_CKFT_SO_PIN_COUNT_LOW;
}
- if (token->db_main->flags & (PKCS11_CKFT_SO_PIN_COUNT_LOW |
- PKCS11_CKFT_SO_PIN_FINAL_TRY)) {
- token->db_main->flags &= ~(PKCS11_CKFT_SO_PIN_COUNT_LOW |
- PKCS11_CKFT_SO_PIN_FINAL_TRY);
-
- update_persistent_db(token);
- }
+ update_persistent_db(token);
- return PKCS11_CKR_OK;
+ return rc;
}
static enum pkcs11_rc check_user_pin(struct pkcs11_session *session,
uint8_t *pin, size_t pin_size)
{
struct ck_token *token = session->token;
+ struct token_persistent_main *db = token->db_main;
enum pkcs11_rc rc = PKCS11_CKR_OK;
if (IS_ENABLED(CFG_PKCS11_TA_AUTH_TEE_IDENTITY) &&
- token->db_main->flags & PKCS11_CKFT_PROTECTED_AUTHENTICATION_PATH)
+ db->flags & PKCS11_CKFT_PROTECTED_AUTHENTICATION_PATH)
return verify_identity_auth(token, PKCS11_CKU_USER);
- if (!token->db_main->user_pin_salt)
+ if (!db->user_pin_salt)
return PKCS11_CKR_USER_PIN_NOT_INITIALIZED;
- if (token->db_main->flags & PKCS11_CKFT_USER_PIN_LOCKED)
+ if (db->flags & PKCS11_CKFT_USER_PIN_LOCKED)
return PKCS11_CKR_PIN_LOCKED;
- rc = verify_pin(PKCS11_CKU_USER, pin, pin_size,
- token->db_main->user_pin_salt,
- token->db_main->user_pin_hash);
- if (rc) {
- unsigned int pin_count = 0;
-
- if (rc != PKCS11_CKR_PIN_INCORRECT)
- return rc;
-
- token->db_main->flags |= PKCS11_CKFT_USER_PIN_COUNT_LOW;
- token->db_main->user_pin_count++;
+ /*
+ * Preset the counter and flags conservatively in the database so that
+ * the tentative is saved whatever happens next.
+ */
+ db->flags |= PKCS11_CKFT_USER_PIN_COUNT_LOW;
+ db->user_pin_count++;
- pin_count = token->db_main->user_pin_count;
- if (pin_count == PKCS11_TOKEN_USER_PIN_COUNT_MAX - 1)
- token->db_main->flags |= PKCS11_CKFT_USER_PIN_FINAL_TRY;
- if (pin_count == PKCS11_TOKEN_USER_PIN_COUNT_MAX)
- token->db_main->flags |= PKCS11_CKFT_USER_PIN_LOCKED;
+ if (db->user_pin_count == PKCS11_TOKEN_USER_PIN_COUNT_MAX - 1)
+ db->flags |= PKCS11_CKFT_USER_PIN_FINAL_TRY;
+ else if (db->user_pin_count == PKCS11_TOKEN_USER_PIN_COUNT_MAX)
+ db->flags |= PKCS11_CKFT_USER_PIN_LOCKED;
- update_persistent_db(token);
+ update_persistent_db(token);
- if (token->db_main->flags & PKCS11_CKFT_USER_PIN_LOCKED)
+ rc = verify_pin(PKCS11_CKU_USER, pin, pin_size,
+ db->user_pin_salt,
+ db->user_pin_hash);
+ if (rc == PKCS11_CKR_PIN_INCORRECT) {
+ if (db->flags & PKCS11_CKFT_USER_PIN_LOCKED)
return PKCS11_CKR_PIN_LOCKED;
return PKCS11_CKR_PIN_INCORRECT;
}
- if (token->db_main->user_pin_count) {
- token->db_main->user_pin_count = 0;
+ if (rc)
+ db->user_pin_count--;
+ else
+ db->user_pin_count = 0;
- update_persistent_db(token);
+ db->flags &= ~PKCS11_CKFT_USER_PIN_LOCKED;
+ if (db->user_pin_count < PKCS11_TOKEN_USER_PIN_COUNT_MAX - 1) {
+ db->flags &= ~PKCS11_CKFT_USER_PIN_FINAL_TRY;
+ if (!db->user_pin_count)
+ db->flags &= ~PKCS11_CKFT_USER_PIN_COUNT_LOW;
}
- if (token->db_main->flags & (PKCS11_CKFT_USER_PIN_COUNT_LOW |
- PKCS11_CKFT_USER_PIN_FINAL_TRY)) {
- token->db_main->flags &= ~(PKCS11_CKFT_USER_PIN_COUNT_LOW |
- PKCS11_CKFT_USER_PIN_FINAL_TRY);
-
- update_persistent_db(token);
- }
+ update_persistent_db(token);
- return PKCS11_CKR_OK;
+ return rc;
}
enum pkcs11_rc entry_ck_set_pin(struct pkcs11_client *client,
--
2.25.1
@@ -10,4 +10,5 @@ SRC_URI += " \
file://0002-core-Define-section-attributes-for-clang.patch \
file://0003-optee-enable-clang-support.patch \
file://0004-core-link-add-no-warn-rwx-segments.patch \
file://0005-ta-pkcs11-Improve-PIN-counter-handling-robustness.patch \
"
@@ -0,0 +1,105 @@
From 06c3e612cb0927d783f115077d83ed97841c5668 Mon Sep 17 00:00:00 2001
From: Emekcan Aras <emekcan.aras@arm.com>
Date: Tue, 14 Nov 2023 14:43:44 +0000
Subject: [PATCH] plat: corstone1000: fix synchronization issue on openamp notification
This fixes a race that is observed rarely in the FVP. It occurs in FVP
when Secure Enclave sends the notication ack in openamp, and then reset the access
request which resets the mhu registers before received by the SE-proxy-sp in the
host processort. This solution introduces polling on the status register of
mhu until the notificaiton is read by the host processor. (Inspired by
signal_and_wait_for_signal function in mhu_wrapper_v2_x.c in trusted-firmware-m
https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/tree/platform/ext/target/arm/rss/common/native_drivers/mhu_wrapper_v2_x.c#n61)
Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
Upstream-Status: Pending [Not submitted to upstream yet]
---
components/messaging/openamp/sp/openamp_mhu.c | 9 ++++++++-
platform/drivers/arm/mhu_driver/mhu_v2.h | 18 ++++++++++++++++++
platform/drivers/arm/mhu_driver/mhu_v2_x.c | 17 +++++++++++++++++
3 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/components/messaging/openamp/sp/openamp_mhu.c b/components/messaging/openamp/sp/openamp_mhu.c
index bafba3e3..0700b8b9 100644
--- a/components/messaging/openamp/sp/openamp_mhu.c
+++ b/components/messaging/openamp/sp/openamp_mhu.c
@@ -85,7 +85,7 @@ int openamp_mhu_notify_peer(struct openamp_messenger *openamp)
struct mhu_v2_x_dev_t *tx_dev;
enum mhu_v2_x_error_t ret;
struct openamp_mhu *mhu;
- uint32_t access_ready;
+ uint32_t access_ready,val;
if (!openamp->transport) {
EMSG("openamp: mhu: notify transport not initialized");
@@ -116,6 +116,13 @@ int openamp_mhu_notify_peer(struct openamp_messenger *openamp)
return -EPROTO;
}
+ do {
+ ret = mhu_v2_x_channel_poll(tx_dev, MHU_V_2_NOTIFY_CHANNEL, &val);
+ if (ret != MHU_V_2_X_ERR_NONE) {
+ break;
+ }
+ } while (val != 0);
+
ret = mhu_v2_x_reset_access_request(tx_dev);
if (ret != MHU_V_2_X_ERR_NONE) {
EMSG("openamp: mhu: failed reset access request");
diff --git a/platform/drivers/arm/mhu_driver/mhu_v2.h b/platform/drivers/arm/mhu_driver/mhu_v2.h
index 26b3a5d6..2b4d6fcb 100644
--- a/platform/drivers/arm/mhu_driver/mhu_v2.h
+++ b/platform/drivers/arm/mhu_driver/mhu_v2.h
@@ -384,6 +384,24 @@ enum mhu_v2_x_error_t mhu_v2_x_interrupt_clear(
enum mhu_v2_x_error_t mhu_v2_1_get_ch_interrupt_num(
const struct mhu_v2_x_dev_t *dev, uint32_t *channel);
+
+/**
+ * \brief Polls sender channel status.
+ *
+ * \param[in] dev MHU device struct \ref mhu_v2_x_dev_t
+ * \param[in] channel Channel to poll the status of.
+ * \param[out] value Pointer to variable that will store the value.
+ *
+ * Polls sender channel status.
+ *
+ * \return Returns mhu_v2_x_error_t error code
+ *
+ * \note This function doesn't check if dev is NULL.
+ * \note This function doesn't check if channel is implemented.
+ */
+enum mhu_v2_x_error_t mhu_v2_x_channel_poll(const struct mhu_v2_x_dev_t *dev,
+ uint32_t channel, uint32_t *value);
+
#ifdef __cplusplus
}
#endif
diff --git a/platform/drivers/arm/mhu_driver/mhu_v2_x.c b/platform/drivers/arm/mhu_driver/mhu_v2_x.c
index d7e70efa..022e287a 100644
--- a/platform/drivers/arm/mhu_driver/mhu_v2_x.c
+++ b/platform/drivers/arm/mhu_driver/mhu_v2_x.c
@@ -600,3 +600,20 @@ enum mhu_v2_x_error_t mhu_v2_1_get_ch_interrupt_num(
return MHU_V_2_X_ERR_GENERAL;
}
+
+enum mhu_v2_x_error_t mhu_v2_x_channel_poll(const struct mhu_v2_x_dev_t *dev,
+ uint32_t channel, uint32_t *value)
+{
+ union _mhu_v2_x_frame_t *p_mhu = (union _mhu_v2_x_frame_t *)dev->base;
+
+ if ( !(dev->is_initialized) ) {
+ return MHU_V_2_X_ERR_NOT_INIT;
+ }
+
+ if (dev->frame == MHU_V2_X_SENDER_FRAME) {
+ *value = (SEND_FRAME(p_mhu))->send_ch_window[channel].ch_st;
+ return MHU_V_2_X_ERR_NONE;
+ } else {
+ return MHU_V_2_X_ERR_INVALID_ARG;
+ }
+}
--
2.25.1
@@ -9,6 +9,7 @@ SRC_URI:append:corstone1000 = " \
file://0005-plat-corstone1000-add-compile-definitions-for-ECP_DP.patch \
file://0006-plat-corstone1000-Use-the-stateless-platform-service.patch \
file://0007-plat-corstone1000-Initialize-capsule-update-provider.patch \
file://0008-platform-corstone1000-fix-synchronization-issue.patch \
"
@@ -12,12 +12,11 @@
INHIBIT_DEFAULT_DEPS = "1"
COMPATIBLE_HOST = "aarch64-*"
PACKAGE_ARCH = "${MACHINE_ARCH}"
inherit nopackages deploy rootfs-postcommands ${IMAGE_CLASSES} python3native
inherit nopackages deploy rootfs-postcommands ${IMAGE_CLASSES} python3native testimage
do_configure[noexec] = "1"
do_compile[noexec] = "1"
do_install[noexec] = "1"
do_testimage[depends] += "mtools-native:do_populate_sysroot"
# Deploy with this suffix so it is picked up in the machine configuration
IMAGE_DEPLOY_SUFFIX ?= ".wic"
@@ -80,7 +79,9 @@ RM_WORK_EXCLUDE_ITEMS += "${@ os.path.basename(d.getVar('TEST_LOG_DIR')) }"
do_testimage[postfuncs] += "acs_logs_handle"
do_testimage[depends] += "edk2-test-parser-native:do_populate_sysroot \
arm-systemready-scripts-native:do_populate_sysroot"
arm-systemready-scripts-native:do_populate_sysroot \
mtools-native:do_populate_sysroot \
parted-native:do_populate_sysroot"
# Process the logs
python acs_logs_handle() {
@@ -2,11 +2,11 @@ require fvp-ecosystem.inc
MODEL = "Corstone-1000"
MODEL_CODE = "FVP_Corstone_1000"
PV = "11.22_35"
PV = "11.23_25"
SRC_URI = "https://developer.arm.com/-/media/Arm%20Developer%20Community/Downloads/OSS/FVP/${MODEL}/${MODEL_CODE}_${PV}_${FVP_ARCH}.tgz;subdir=${BP};name=fvp-${HOST_ARCH}"
SRC_URI[fvp-aarch64.sha256sum] = "40c76551ca73328d34513dbc5de2bd094c28da7e91b73fe0361ec8faef644b68"
SRC_URI[fvp-x86_64.sha256sum] = "30eb648d26827212faeb74b8c10070cbf8bf212d106ee609579f781a32aac6d9"
SRC_URI[fvp-aarch64.sha256sum] = "e299e81d5fa8b3d2afee0850fd03be31c1a1c3fad07f79849c63e46ee5e36acc"
SRC_URI[fvp-x86_64.sha256sum] = "ec34c9564ccb5b1eb62fc2757673343a353db1d116a7cb1b5f82f9d985d99cdf"
LIC_FILES_CHKSUM = "file://license_terms/license_agreement.txt;md5=1a33828e132ba71861c11688dbb0bd16 \
file://license_terms/third_party_licenses/third_party_licenses.txt;md5=0c32ac6f58ebff83065105042ab98211"
@@ -0,0 +1,46 @@
From 45b3fae4675dc1d4ee2d7aefa19d85ee4f891377 Mon Sep 17 00:00:00 2001
From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Date: Sat, 25 Nov 2023 15:33:58 -0600
Subject: [PATCH] neighbour: Fix __randomize_layout crash in struct neighbour
Previously, one-element and zero-length arrays were treated as true
flexible arrays, even though they are actually "fake" flex arrays.
The __randomize_layout would leave them untouched at the end of the
struct, similarly to proper C99 flex-array members.
However, this approach changed with commit 1ee60356c2dc ("gcc-plugins:
randstruct: Only warn about true flexible arrays"). Now, only C99
flexible-array members will remain untouched at the end of the struct,
while one-element and zero-length arrays will be subject to randomization.
Fix a `__randomize_layout` crash in `struct neighbour` by transforming
zero-length array `primary_key` into a proper C99 flexible-array member.
Fixes: 1ee60356c2dc ("gcc-plugins: randstruct: Only warn about true flexible arrays")
Closes: https://lore.kernel.org/linux-hardening/20231124102458.GB1503258@e124191.cambridge.arm.com/
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Tested-by: Joey Gouly <joey.gouly@arm.com>
Link: https://lore.kernel.org/r/ZWJoRsJGnCPdJ3+2@work
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Upstream-Status: Backport
Signed-off-by: Jon Mason <jon.mason@arm.com>
---
include/net/neighbour.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 07022bb0d44d..0d28172193fa 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -162,7 +162,7 @@ struct neighbour {
struct rcu_head rcu;
struct net_device *dev;
netdevice_tracker dev_tracker;
- u8 primary_key[0];
+ u8 primary_key[];
} __randomize_layout;
struct neigh_ops {
@@ -1,5 +1,8 @@
ARMFILESPATHS := "${THISDIR}/files:"
FILESEXTRAPATHS:prepend:aarch64 = "${ARMFILESPATHS}"
SRC_URI:append:aarch64 = " file://0001-neighbour-Fix-__randomize_layout-crash-in-struct-nei.patch"
COMPATIBLE_MACHINE:generic-arm64 = "generic-arm64"
FILESEXTRAPATHS:prepend:generic-arm64 = "${ARMFILESPATHS}"
SRC_URI:append:generic-arm64 = " \