18aa05055SPaul BeesleyArm SiP Services 28aa05055SPaul Beesley================ 340d553cfSPaul Beesley 440d553cfSPaul BeesleyThis document enumerates and describes the Arm SiP (Silicon Provider) services. 540d553cfSPaul Beesley 640d553cfSPaul BeesleySiP services are non-standard, platform-specific services offered by the silicon 740d553cfSPaul Beesleyimplementer or platform provider. They are accessed via ``SMC`` ("SMC calls") 840d553cfSPaul Beesleyinstruction executed from Exception Levels below EL3. SMC calls for SiP 940d553cfSPaul Beesleyservices: 1040d553cfSPaul Beesley 1140d553cfSPaul Beesley- Follow `SMC Calling Convention`_; 1240d553cfSPaul Beesley- Use SMC function IDs that fall in the SiP range, which are ``0xc2000000`` - 1340d553cfSPaul Beesley ``0xc200ffff`` for 64-bit calls, and ``0x82000000`` - ``0x8200ffff`` for 32-bit 1440d553cfSPaul Beesley calls. 1540d553cfSPaul Beesley 1640d553cfSPaul BeesleyThe Arm SiP implementation offers the following services: 1740d553cfSPaul Beesley 1840d553cfSPaul Beesley- Execution State Switching service 1940d553cfSPaul Beesley 2040d553cfSPaul BeesleySource definitions for Arm SiP service are located in the ``arm_sip_svc.h`` header 2140d553cfSPaul Beesleyfile. 2240d553cfSPaul Beesley 23*320fb293SGovindraj Raja+----------------------------+----------------------------+---------------------------------------+ 24*320fb293SGovindraj Raja| ARM_SIP_SVC_VERSION_MAJOR | ARM_SIP_SVC_VERSION_MINOR | Changes | 25*320fb293SGovindraj Raja+============================+============================+=======================================+ 26*320fb293SGovindraj Raja| 1 | 0 | Move DebugFS and PMF to the new vendor| 27*320fb293SGovindraj Raja| | | specific FID range. The old FID range | 28*320fb293SGovindraj Raja| | | for these services are deprecated | 29*320fb293SGovindraj Raja+----------------------------+----------------------------+---------------------------------------+ 30*320fb293SGovindraj Raja 31*320fb293SGovindraj Raja*Table 1: Showing different versions of arm-sip-service and changes done with each version* 3240d553cfSPaul Beesley 3340d553cfSPaul BeesleyExecution State Switching service 3440d553cfSPaul Beesley--------------------------------- 3540d553cfSPaul Beesley 3640d553cfSPaul BeesleyExecution State Switching service provides a mechanism for a non-secure lower 3740d553cfSPaul BeesleyException Level (either EL2, or NS EL1 if EL2 isn't implemented) to request to 3840d553cfSPaul Beesleyswitch its execution state (a.k.a. Register Width), either from AArch64 to 3940d553cfSPaul BeesleyAArch32, or from AArch32 to AArch64, for the calling CPU. This service is only 4040d553cfSPaul Beesleyavailable when Trusted Firmware-A (TF-A) is built for AArch64 (i.e. when build 4140d553cfSPaul Beesleyoption ``ARCH`` is set to ``aarch64``). 4240d553cfSPaul Beesley 4340d553cfSPaul Beesley``ARM_SIP_SVC_EXE_STATE_SWITCH`` 4440d553cfSPaul Beesley~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4540d553cfSPaul Beesley 4640d553cfSPaul Beesley:: 4740d553cfSPaul Beesley 4840d553cfSPaul Beesley Arguments: 4940d553cfSPaul Beesley uint32_t Function ID 5040d553cfSPaul Beesley uint32_t PC hi 5140d553cfSPaul Beesley uint32_t PC lo 5240d553cfSPaul Beesley uint32_t Cookie hi 5340d553cfSPaul Beesley uint32_t Cookie lo 5440d553cfSPaul Beesley 5540d553cfSPaul Beesley Return: 5640d553cfSPaul Beesley uint32_t 5740d553cfSPaul Beesley 5840d553cfSPaul BeesleyThe function ID parameter must be ``0x82000020``. It uniquely identifies the 5940d553cfSPaul BeesleyExecution State Switching service being requested. 6040d553cfSPaul Beesley 6140d553cfSPaul BeesleyThe parameters *PC hi* and *PC lo* defines upper and lower words, respectively, 6240d553cfSPaul Beesleyof the entry point (physical address) at which execution should start, after 6340d553cfSPaul BeesleyExecution State has been switched. When calling from AArch64, *PC hi* must be 0. 6440d553cfSPaul Beesley 6540d553cfSPaul BeesleyWhen execution starts at the supplied entry point after Execution State has been 6640d553cfSPaul Beesleyswitched, the parameters *Cookie hi* and *Cookie lo* are passed in CPU registers 6740d553cfSPaul Beesley0 and 1, respectively. When calling from AArch64, *Cookie hi* must be 0. 6840d553cfSPaul Beesley 6940d553cfSPaul BeesleyThis call can only be made on the primary CPU, before any secondaries were 7040d553cfSPaul Beesleybrought up with ``CPU_ON`` PSCI call. Otherwise, the call will always fail. 7140d553cfSPaul Beesley 7240d553cfSPaul BeesleyThe effect of switching execution state is as if the Exception Level were 7340d553cfSPaul Beesleyentered for the first time, following power on. This means CPU registers that 7440d553cfSPaul Beesleyhave a defined reset value by the Architecture will assume that value. Other 7540d553cfSPaul Beesleyregisters should not be expected to hold their values before the call was made. 7640d553cfSPaul BeesleyCPU endianness, however, is preserved from the previous execution state. Note 7740d553cfSPaul Beesleythat this switches the execution state of the calling CPU only. This is not a 7840d553cfSPaul Beesleysubstitute for PSCI ``SYSTEM_RESET``. 7940d553cfSPaul Beesley 8040d553cfSPaul BeesleyThe service may return the following error codes: 8140d553cfSPaul Beesley 8240d553cfSPaul Beesley- ``STATE_SW_E_PARAM``: If any of the parameters were deemed invalid for 8340d553cfSPaul Beesley a specific request. 8440d553cfSPaul Beesley- ``STATE_SW_E_DENIED``: If the call is not successful, or when TF-A is 8540d553cfSPaul Beesley built for AArch32. 8640d553cfSPaul Beesley 8740d553cfSPaul BeesleyIf the call is successful, the caller wouldn't observe the SMC returning. 8840d553cfSPaul BeesleyInstead, execution starts at the supplied entry point, with the CPU registers 0 8940d553cfSPaul Beesleyand 1 populated with the supplied *Cookie hi* and *Cookie lo* values, 9040d553cfSPaul Beesleyrespectively. 9140d553cfSPaul Beesley 9240d553cfSPaul Beesley-------------- 9340d553cfSPaul Beesley 94273b8983SGovindraj Raja*Copyright (c) 2017-2024, Arm Limited and Contributors. All rights reserved.* 9540d553cfSPaul Beesley 963ba55a3cSlaurenw-arm.. _SMC Calling Convention: https://developer.arm.com/docs/den0028/latest 97