blob: cf07a8c02a3026dd04e5b7bebee66b69b4b43de1 [file] [log] [blame]
Jamie Fox278c0382024-10-01 18:01:46 +01001####################
2SCMI Comms Partition
3####################
4
5The SCMI Comms partition provides a minimal implementation of the SCMI [1]_
6protocol for the purpose of subscribing to system power state notifications from
7SCP.
8
9It currently supports only the shared memory based transport protocol.
10
11***********************
12Supported message types
13***********************
14
15The partition supports the System power management protocol [1]_. It can send
16the following message types:
17
18- SYSTEM_POWER_STATE_NOTIFY
19
20It can receive the following message types:
21
22- SYSTEM_POWER_STATE_SET
23- SYSTEM_POWER_STATE_NOTIFIER
24
25**************
26Code structure
27**************
28
29Partition source files:
30
31- ``scmi_comms.c``: Implements the core SCMI message handling.
32- ``scmi_comms.h``: Common definitions used within the partition.
33- ``scmi_hal.h``: Hardware abstraction layer that must be implemented by the
34 platform to support the SCMI Comms partition.
35- ``scmi_protocol.h``: Defines values from the SCMI spec.
36
37Build options for out of tree build
38===================================
39
40- ``TFM_PARTITION_SCMI_COMMS``: To build the SCMI Comms secure partition its
41 value should be ``ON``. By default, it is switched ``OFF``.
42
43- ``TFM_EXTRA_MANIFEST_LIST_FILES``: ``<tf-m-extras-repo>/partitions/scmi/scmi_comms_manifest_list.yaml``
44
45- ``TFM_EXTRA_PARTITION_PATHS``: ``<tf-m-extras-repo>/partitions/scmi``
46
47****************
48Platform porting
49****************
50
51To use the SCMI Comms partition, a platform must supply an interface library
52called ``scmi_hal`` for the partition to link against. The library must contain
53implementations of all of the functions declared in ``scmi_hal.h``. It must also
54contain a header called ``scmi_hal_defs.h``, with the following definitions:
55
56- ``SCP_SHARED_MEMORY_BASE``: The base address of a memory area shared between
57 SCP and the CPU running TF-M, which is used to pass messages via the SCMI
58 shared memory transport protocol.
59- ``SCP_SHARED_MEMORY_SIZE``: The size of the SCP shared memory area. The
60 maximum SCMI message length that can be transported is the size of this area
61 minus the ``24`` bytes used by the transport protocol.
62
63Additionally, the platform must define ``SCP_DOORBELL_IRQ`` to be the IRQ number
64triggered by the SCP doorbell in its ``config_tfm_target.h`` header. It must
65also implement that IRQ's handler function to route the request to the SCMI
66comms partition (see
67:doc:`TF-M Secure IRQ integration guide<TF-M:integration_guide/tfm_secure_irq_integration_guide>`
68for more details).
69
Jamie Fox9076ca62024-11-18 18:47:29 +000070*******
71Testing
72*******
73
74A regression test suite for the Secure processing environment is provided in
75``test/secure/scmi_s_testsuite.c``. To test the partition locally, the tests
76rely on modifying the partition to use the ``TFM_TIMER0_IRQ`` IRQ source to
77trigger its interrupt handler. The tests then use the ``tfm_plat_test.h`` APIs
78to trigger the timer interrupt and cause the partition to handle an SCMI
79message. They also reimplement the HAL so that the shared memory and doorbell
80state are in local memory.
81
82To run the tests, all of the following build options need to be supplied:
83
84- ``TFM_EXTRA_MANIFEST_LIST_FILES``: Change to use
85 ``<tf-m-extras-repo>/partitions/scmi/test/secure/scmi_comms_manifest_list.yaml``
86 instead of the standard manifest.
87- ``EXTRA_S_TEST_SUITE_PATH``: ``<tfm_extras_dir>/partitions/scmi/test/secure``
88- ``TEST_S_SCMI_COMMS``: Set to ``ON`` to enable the tests and test HAL.
89
Jamie Fox278c0382024-10-01 18:01:46 +010090**********
91References
92**********
93
94.. [1] `Arm System Control and Management Interface (SCMI) <https://developer.arm.com/documentation/den0056/latest/>`_
95
96--------------
97
98*SPDX-License-Identifier: BSD-3-Clause*
99
100*SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors*