Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

How to easily run a SCMI server in various Execution Environments

Under construction

Running SCMI server with OP-TEE

The easiest way to test the SCMI server in OP-TEE is to built it for qemu Armv8Arm v8. OP-TEE documentation provides detailed information to build a qemu Armv8 Arm v8 dev environment here.

The SCP-firmware is not yet part of the manifest but a PR is under review to add it : https://github.com/OP-TEE/manifest/pull/252

Similarly, SCMI server is not enabled by default for qemu_v8 platform but a PR is under review to enable compiling OP-TEE os with SCMI server: https://github.com/OP-TEE/build/pull/695. In the meantime, a manifest using the PR has been created https://github.com/vingu-linaro/manifest/tree/optee-with-scmi .

You just need to add WITH_SCMI=y option in the make command to enable the SCMI server. The whole sequence to use the pending PRs setup a dev environment with a SCMI server can be summarized:

$ mkdir <project-dir>

...

$ repo init -u https://github.com/vingu-linaro/manifest.git -m qemu_v8.xml -b optee-with-scmi -m qemu_v8.xml

$ repo sync

$ cd build

$ make toolchains

...

When booting with SCMI server, we use a dedicated DT instead of add an overlay DT to the one that is built on the fly by Qemu in order to provide a scmi node. The dts qemu-v8-scmi-overlay.dtso file is available in the build/qemu_v8 directory if someone needs to change it and is based applied on the dtb generated by Qemu.

The configuration of the scmi server is located in the directory : <project-dir>/SCP-firmware/product/optee-/fvp/fw/. The following scmi protocols have been enable with mock devices:

...

Running SCMI server in Secure partition

The easiest way to test the SCMI server in a dedicated Secure Partition with hafnium and FFA is to built it for FVP Armv8. shrinkwrap provides a easy way to build a FVP Armv8 dev environment with hafnium and default secure partitions. This fork adds a config for building SCP-firmware in a secure partition and update several components' config to point to the right repos and branches. All this is still under development and should be considered as a PoC. The compiled SCP-firmware boots in a secure partition

...

TBFand use FFA as a transport layer. The FFA transport layer for Linux is available here

After downloading and installing schrinkwrap as described in the Quickstart :

shrinkwrap -I docker.io/shrinkwraptool/base-full:latest build ffa-tftf.yaml

You will have to build a kernel image using the branch above and to prepare a rootfs with your favorite tool. Then start the FVP with:

shrinkwrap -I docker.io/shrinkwraptool/base-full:latest run --rtvar=KERNEL=<path-to-Image> --rtvar=ROOTFS=<path-to-rootfs> ffa-tftf.yaml

FVP will start and the SCMI server log will be output on [ term2 ]:

[ fvp ] terminal_0: Listening for serial connection on port 5000

[ fvp ] terminal_1: Listening for serial connection on port 5001

[ fvp ] terminal_2: Listening for serial connection on port 5002

[ fvp ] terminal_3: Listening for serial connection on port 5003

[ fvp ]

[ fvp ] Info: FVP_Base_RevC_2xAEMvA: FVP_Base_RevC_2xAEMvA.bp.flashloader1: FlashLoader: Loaded 64 MB from file '/home/vingu/.shrinkwrap/package/ffa-tftf/edk2-flash.img'

[ fvp ]

[ fvp ] Info: FVP_Base_RevC_2xAEMvA: FVP_Base_RevC_2xAEMvA.bp.flashloader0: FlashLoader: Loaded 3226 kB from file '/home/vingu/.shrinkwrap/package/ffa-tftf/fip.bin'

[ fvp ]

[ fvp ] Info: FVP_Base_RevC_2xAEMvA: FVP_Base_RevC_2xAEMvA.bp.secureflashloader: FlashLoader: Loaded 30 kB from file '/home/vingu/.shrinkwrap/package/ffa-tftf/bl1.bin'

[ fvp ]

...

[ term2 ] NOTICE: Booting Secure Partition (ID: 8003)

[ term2 ] INFO: Secure Partition memory layout:

[ term2 ] INFO: Text region : 0x7204000 - 0x7219000

[ term2 ] INFO: Read-only data region : 0x7219000 - 0x721e000

[ term2 ] INFO: Data region : 0x721f000 - 0x7221000

[ term2 ] INFO: BSS region : 0x7225000 - 0x72b5000

[ term2 ] INFO: RX : 0x7304000 - 0x7305000

[ term2 ] INFO: TX : 0x7305000 - 0x7306000

[ term2 ] VERBOSE: Discovered managed exit interrupt ID: 4

[ term2 ] VERBOSE: SCMI server init start

[ term2 ] [FWK] Module initialization complete!

[ term2 ] VERBOSE: SCMI server init end

...

[ term2 ] VERBOSE: Woke up with func id: 8400006f

[ term2 ] VERBOSE: cmd 0; args: 0, 0, 0, 0

[ 1.859451] ffa-scmi arm-ffa-3: Probed with vm_id 8003 uuid 735cb579-8c1d-b944-8593-61e1770ad8d2

[ term2 ] VERBOSE: Woke up with func id: 8400006f

[ term2 ] VERBOSE: cmd 1; args: 1, 0, 0, 0

[ term2 ] NOTICE: scmi_get_channel VM id: 8003 chnl: 1 mem hdl: 0

[ term2 ] VERBOSE: Memory Retrieved!

[ term2 ] NOTICE: scmi_get_channel VM id: 8003 ptr: 0x880fa2000

[ 1.868186] scmi_protocol scmi_dev.1: Enabled polling mode TX channel - prot_id:16

[ term2 ] VERBOSE: Woke up with func id: 8400006f

[ term2 ] VERBOSE: cmd 1; args: 2, 1, 0, 0

[ term2 ] NOTICE: scmi_get_channel VM id: 8003 chnl: 2 mem hdl: 1

[ term2 ] VERBOSE: Memory Retrieved!

[ term2 ] NOTICE: scmi_get_channel VM id: 8003 ptr: 0x880fa4000

[ 1.875634] scmi_protocol scmi_dev.2: Enabled polling mode TX channel - prot_id:19

[ 1.876464] arm-scmi firmware:scmi0: SCMI Notifications - Core Enabled.

[ 1.876576] ffa-scmi arm-ffa-3: invoke_ffa_direct_msg_channel channel_id 0x1003 size 4

[ term2 ] VERBOSE: Woke up with func id: 8400006f

[ term2 ] VERBOSE: cmd 2; args: 1003, 4, 0, 0

[ term2 ] NOTICE: scmi_process_msg VM id: 8003 chnl: 1003 size: 4

...

[ 1.878372] ffa-scmi arm-ffa-3: invoke_ffa_direct_msg_channel channel_id 0x1003 size 8

[ term2 ] VERBOSE: Woke up with func id: 8400006f

[ term2 ] VERBOSE: cmd 2; args: 1003, 8, 0, 0

[ term2 ] NOTICE: scmi_process_msg VM id: 8003 chnl: 1003 size: 8

[ 1.878723] arm-scmi firmware:scmi0: SCMI Protocol v2.0 'Linaro:PMWG' Firmware version 0x20d0000

...