How to run a SCMI server / SCP-firmware ?

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 Arm v8. OP-TEE documentation provides detailed information to build a qemu Arm v8 dev environment here.

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

$ mkdir <project-dir>

$ cd <project-dir>

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

$ repo sync

$ cd build

$ make toolchains

$ make run WITH_SCMI=y

When booting with SCMI server, we add an overlay DT to the one that is built on the fly by Qemu in order to provide a scmi node. The qemu-v8-scmi-overlay.dtso file is available in the build/qemu_v8 directory if someone needs to change it and is 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:

  • clock protocol

  • performance domain protocol with one domain connected to cpufreq

  • power domain protocol

  • sensor protocol

The logs are enabled by default so you should see SCMI requests in the secure world console.

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 and 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 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

...

 

 

 

 

 

 

Â