blob: 4445fb18d4fd5b616f782cd4abeafff505ec417a [file] [log] [blame]
Paul Beesley8aa05052019-03-07 15:47:15 +00001Arm SiP Services
2================
Douglas Raillard6f625742017-06-28 15:23:03 +01003
Dan Handley4def07d2018-03-01 18:44:00 +00004This document enumerates and describes the Arm SiP (Silicon Provider) services.
Douglas Raillard6f625742017-06-28 15:23:03 +01005
6SiP services are non-standard, platform-specific services offered by the silicon
Antonio Nino Diaz73308612019-02-28 13:35:21 +00007implementer or platform provider. They are accessed via ``SMC`` ("SMC calls")
Douglas Raillard6f625742017-06-28 15:23:03 +01008instruction executed from Exception Levels below EL3. SMC calls for SiP
9services:
10
11- Follow `SMC Calling Convention`_;
12- Use SMC function IDs that fall in the SiP range, which are ``0xc2000000`` -
13 ``0xc200ffff`` for 64-bit calls, and ``0x82000000`` - ``0x8200ffff`` for 32-bit
14 calls.
15
Dan Handley4def07d2018-03-01 18:44:00 +000016The Arm SiP implementation offers the following services:
Douglas Raillard6f625742017-06-28 15:23:03 +010017
Douglas Raillard6f625742017-06-28 15:23:03 +010018- Execution State Switching service
19
Dan Handley4def07d2018-03-01 18:44:00 +000020Source definitions for Arm SiP service are located in the ``arm_sip_svc.h`` header
Douglas Raillard6f625742017-06-28 15:23:03 +010021file.
22
Douglas Raillard6f625742017-06-28 15:23:03 +010023
24Execution State Switching service
25---------------------------------
26
27Execution State Switching service provides a mechanism for a non-secure lower
28Exception Level (either EL2, or NS EL1 if EL2 isn't implemented) to request to
29switch its execution state (a.k.a. Register Width), either from AArch64 to
30AArch32, or from AArch32 to AArch64, for the calling CPU. This service is only
Dan Handley4def07d2018-03-01 18:44:00 +000031available when Trusted Firmware-A (TF-A) is built for AArch64 (i.e. when build
32option ``ARCH`` is set to ``aarch64``).
Douglas Raillard6f625742017-06-28 15:23:03 +010033
34``ARM_SIP_SVC_EXE_STATE_SWITCH``
35~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36
37::
38
39 Arguments:
40 uint32_t Function ID
41 uint32_t PC hi
42 uint32_t PC lo
43 uint32_t Cookie hi
44 uint32_t Cookie lo
45
46 Return:
47 uint32_t
48
49The function ID parameter must be ``0x82000020``. It uniquely identifies the
50Execution State Switching service being requested.
51
52The parameters *PC hi* and *PC lo* defines upper and lower words, respectively,
53of the entry point (physical address) at which execution should start, after
54Execution State has been switched. When calling from AArch64, *PC hi* must be 0.
55
56When execution starts at the supplied entry point after Execution State has been
57switched, the parameters *Cookie hi* and *Cookie lo* are passed in CPU registers
580 and 1, respectively. When calling from AArch64, *Cookie hi* must be 0.
59
60This call can only be made on the primary CPU, before any secondaries were
61brought up with ``CPU_ON`` PSCI call. Otherwise, the call will always fail.
62
63The effect of switching execution state is as if the Exception Level were
64entered for the first time, following power on. This means CPU registers that
65have a defined reset value by the Architecture will assume that value. Other
66registers should not be expected to hold their values before the call was made.
67CPU endianness, however, is preserved from the previous execution state. Note
68that this switches the execution state of the calling CPU only. This is not a
69substitute for PSCI ``SYSTEM_RESET``.
70
71The service may return the following error codes:
72
73- ``STATE_SW_E_PARAM``: If any of the parameters were deemed invalid for
74 a specific request.
Dan Handley4def07d2018-03-01 18:44:00 +000075- ``STATE_SW_E_DENIED``: If the call is not successful, or when TF-A is
76 built for AArch32.
Douglas Raillard6f625742017-06-28 15:23:03 +010077
78If the call is successful, the caller wouldn't observe the SMC returning.
79Instead, execution starts at the supplied entry point, with the CPU registers 0
80and 1 populated with the supplied *Cookie hi* and *Cookie lo* values,
81respectively.
82
83--------------
84
Govindraj Raja273b8982024-03-07 15:24:19 -060085*Copyright (c) 2017-2024, Arm Limited and Contributors. All rights reserved.*
Douglas Raillard6f625742017-06-28 15:23:03 +010086
laurenw-arm3ba55a32020-04-16 10:02:17 -050087.. _SMC Calling Convention: https://developer.arm.com/docs/den0028/latest