arm-sip-service.rst 3.83 KB
Newer Older
Paul Beesley's avatar
Paul Beesley committed
1
2
Arm SiP Services
================
3

Dan Handley's avatar
Dan Handley committed
4
This document enumerates and describes the Arm SiP (Silicon Provider) services.
5
6

SiP services are non-standard, platform-specific services offered by the silicon
7
implementer or platform provider. They are accessed via ``SMC`` ("SMC calls")
8
9
10
11
12
13
14
15
instruction executed from Exception Levels below EL3. SMC calls for SiP
services:

-  Follow `SMC Calling Convention`_;
-  Use SMC function IDs that fall in the SiP range, which are ``0xc2000000`` -
   ``0xc200ffff`` for 64-bit calls, and ``0x82000000`` - ``0x8200ffff`` for 32-bit
   calls.

Dan Handley's avatar
Dan Handley committed
16
The Arm SiP implementation offers the following services:
17
18
19
20

-  Performance Measurement Framework (PMF)
-  Execution State Switching service

Dan Handley's avatar
Dan Handley committed
21
Source definitions for Arm SiP service are located in the ``arm_sip_svc.h`` header
22
23
24
25
26
27
file.

Performance Measurement Framework (PMF)
---------------------------------------

The `Performance Measurement Framework`_
Dan Handley's avatar
Dan Handley committed
28
29
allows callers to retrieve timestamps captured at various paths in TF-A
execution. It's described in detail in `Firmware Design document`_.
30
31
32
33
34
35
36
37

Execution State Switching service
---------------------------------

Execution State Switching service provides a mechanism for a non-secure lower
Exception Level (either EL2, or NS EL1 if EL2 isn't implemented) to request to
switch its execution state (a.k.a. Register Width), either from AArch64 to
AArch32, or from AArch32 to AArch64, for the calling CPU. This service is only
Dan Handley's avatar
Dan Handley committed
38
39
available when Trusted Firmware-A (TF-A) is built for AArch64 (i.e. when build
option ``ARCH`` is set to ``aarch64``).
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81

``ARM_SIP_SVC_EXE_STATE_SWITCH``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

::

    Arguments:
        uint32_t Function ID
        uint32_t PC hi
        uint32_t PC lo
        uint32_t Cookie hi
        uint32_t Cookie lo

    Return:
        uint32_t

The function ID parameter must be ``0x82000020``. It uniquely identifies the
Execution State Switching service being requested.

The parameters *PC hi* and *PC lo* defines upper and lower words, respectively,
of the entry point (physical address) at which execution should start, after
Execution State has been switched. When calling from AArch64, *PC hi* must be 0.

When execution starts at the supplied entry point after Execution State has been
switched, the parameters *Cookie hi* and *Cookie lo* are passed in CPU registers
0 and 1, respectively. When calling from AArch64, *Cookie hi* must be 0.

This call can only be made on the primary CPU, before any secondaries were
brought up with ``CPU_ON`` PSCI call. Otherwise, the call will always fail.

The effect of switching execution state is as if the Exception Level were
entered for the first time, following power on. This means CPU registers that
have a defined reset value by the Architecture will assume that value. Other
registers should not be expected to hold their values before the call was made.
CPU endianness, however, is preserved from the previous execution state. Note
that this switches the execution state of the calling CPU only. This is not a
substitute for PSCI ``SYSTEM_RESET``.

The service may return the following error codes:

-  ``STATE_SW_E_PARAM``: If any of the parameters were deemed invalid for
   a specific request.
Dan Handley's avatar
Dan Handley committed
82
83
-  ``STATE_SW_E_DENIED``: If the call is not successful, or when TF-A is
   built for AArch32.
84
85
86
87
88
89
90
91

If the call is successful, the caller wouldn't observe the SMC returning.
Instead, execution starts at the supplied entry point, with the CPU registers 0
and 1 populated with the supplied *Cookie hi* and *Cookie lo* values,
respectively.

--------------

Dan Handley's avatar
Dan Handley committed
92
*Copyright (c) 2017-2018, Arm Limited and Contributors. All rights reserved.*
93
94

.. _SMC Calling Convention: http://infocenter.arm.com/help/topic/com.arm.doc.den0028a/index.html
95
96
.. _Performance Measurement Framework: ../design/firmware-design.rst#user-content-performance-measurement-framework
.. _Firmware Design document: ../design/firmware-design.rst