diff --git a/docs/about/features.rst b/docs/about/features.rst index 7c73952d3..964cb2570 100644 --- a/docs/about/features.rst +++ b/docs/about/features.rst @@ -108,8 +108,8 @@ Still to come - Refinements to Position Independent Executable (PIE) support. -- Continued support for the draft SPCI specification, to enable the use of - secure partition management in the secure world. +- Continued support for the PSA FF-A v1.0 (formally known as SPCI) specification, to enable the + use of secure partition management in the secure world. - Documentation enhancements. diff --git a/docs/components/index.rst b/docs/components/index.rst index e3ce61489..c5f6264e1 100644 --- a/docs/components/index.rst +++ b/docs/components/index.rst @@ -17,5 +17,5 @@ Components romlib-design sdei secure-partition-manager-design - spci-manifest-binding + psa-ffa-manifest-binding xlat-tables-lib-v2-design diff --git a/docs/components/spci-manifest-binding.rst b/docs/components/psa-ffa-manifest-binding.rst similarity index 90% rename from docs/components/spci-manifest-binding.rst rename to docs/components/psa-ffa-manifest-binding.rst index 584816911..7a1c1eb07 100644 --- a/docs/components/spci-manifest-binding.rst +++ b/docs/components/psa-ffa-manifest-binding.rst @@ -1,33 +1,33 @@ -SPCI manifest binding to device tree -==================================== +PSA FF-A manifest binding to device tree +======================================== This document defines the nodes and properties used to define a partition, -according to the SPCI specification. +according to the PSA FF-A specification. Version 1.0 ----------- -spci-manifest-partition -^^^^^^^^^^^^^^^^^^^^^^^ +psa-ffa-manifest-partition +^^^^^^^^^^^^^^^^^^^^^^^^^^ - compatible [mandatory] - value type: - - Must be the string "arm,spci-manifest-X.Y" which specifies the major and - minor versions fo the device tree binding for the SPCI manifest represented + - Must be the string "arm,ffa-manifest-X.Y" which specifies the major and + minor versions fo the device tree binding for the FFA manifest represented by this node. The minor number is incremented if the binding changes in a backwards compatible manner. - X is an integer representing the major version number of this document. - Y is an integer representing the minor version number of this document. -- spci-version [mandatory] +- ffa-version [mandatory] - value type: - Must be two 16 bits values (X, Y), concatenated as 31:16 -> X, 15:0 -> Y, where: - - X is the major version of PSA-FF-A expected by the partition at the SPCI + - X is the major version of PSA-FF-A expected by the partition at the FFA instance it will execute. - - Y is the minor version of PSA-FF-A expected by the partition at the SPCI + - Y is the minor version of PSA-FF-A expected by the partition at the FFA instance it will execute. - uuid [mandatory] @@ -40,7 +40,7 @@ spci-manifest-partition - If there are multiple instances of a Trusted OS, then the UUID can be shared by all instances. - The TEE driver in the HLOS can use the UUID with the - SPCI_PARTITION_INFO_GET interface to determine the: + FFA_PARTITION_INFO_GET interface to determine the: - Number of Trusted OSs - The partition ID of each instance of the Trusted OS @@ -116,7 +116,7 @@ spci-manifest-partition - value type: "memory-regions" node - Specific "memory-regions" nodes that describe the RX/TX buffers expected by the partition. - The "compatible" must be the string "arm,spci-manifest-rx_tx-buffer". + The "compatible" must be the string "arm,ffa-manifest-rx_tx-buffer". - messaging-method [mandatory] - value type: @@ -146,7 +146,7 @@ spci-manifest-partition - gp-register-num - value type: - Presence of this field indicates that the partition expects the - spci_init_info structure to be passed in via the specified general purpose + ffa_init_info structure to be passed in via the specified general purpose register. The field specifies the general purpose register number but not its width. The width is derived from the partition's execution state, as specified in @@ -164,7 +164,7 @@ memory-regions - compatible [mandatory] - value type: - - Must be the string "arm,spci-manifest-memory-regions". + - Must be the string "arm,ffa-manifest-memory-regions". - description - value type: @@ -184,7 +184,7 @@ memory-regions - Base address of the region. The address must be aligned to the translation granule size. The address given may be a Physical Address (PA), Virtual Address (VA), or - Intermediate Physical Address (IPA). Refer to the SPCI specification for + Intermediate Physical Address (IPA). Refer to the FFA specification for more information on the restrictions around the address type. If the base address is omitted then the partition manager must map a memory region of the specified size into the partition's translation regime and @@ -196,7 +196,7 @@ device-regions - compatible [mandatory] - value type: - - Must be the string "arm,spci-manifest-device-regions". + - Must be the string "arm,ffa-manifest-device-regions". - description - value type: diff --git a/docs/global_substitutions.txt b/docs/global_substitutions.txt index 4dda1dcd4..d33155b9a 100644 --- a/docs/global_substitutions.txt +++ b/docs/global_substitutions.txt @@ -14,6 +14,7 @@ .. |EHF| replace:: :term:`EHF` .. |FCONF| replace:: :term:`FCONF` .. |FDT| replace:: :term:`FDT` +.. |FFA| replace:: :term:`FFA` .. |FIP| replace:: :term:`FIP` .. |FVP| replace:: :term:`FVP` .. |FWU| replace:: :term:`FWU` @@ -44,7 +45,6 @@ .. |SMCCC| replace:: :term:`SMCCC` .. |SoC| replace:: :term:`SoC` .. |SP| replace:: :term:`SP` -.. |SPCI| replace:: :term:`SPCI` .. |SPD| replace:: :term:`SPD` .. |SPM| replace:: :term:`SPM` .. |SSBS| replace:: :term:`SSBS` diff --git a/docs/glossary.rst b/docs/glossary.rst index 3da30b02a..e08707946 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -57,6 +57,9 @@ You can find additional definitions in the `Arm Glossary`_. FDT Flattened Device Tree + FFA + Firmware Framework for A-class processors + FIP Firmware Image Package @@ -107,6 +110,9 @@ You can find additional definitions in the `Arm Glossary`_. PMF Performance Measurement Framework + PSA + Platform Security Architecture + PSCI Power State Coordination Interface @@ -149,9 +155,6 @@ You can find additional definitions in the `Arm Glossary`_. SP Secure Partition - SPCI - Secure Partition Client Interface - SPD Secure Payload Dispatcher diff --git a/include/services/ffa_svc.h b/include/services/ffa_svc.h new file mode 100644 index 000000000..fe321750a --- /dev/null +++ b/include/services/ffa_svc.h @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2020, Arm Limited. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef FFA_SVC_H +#define FFA_SVC_H + +#include +#include +#include + +/* FFA error codes. */ +#define FFA_ERROR_NOT_SUPPORTED -1 +#define FFA_ERROR_INVALID_PARAMETER -2 +#define FFA_ERROR_NO_MEMORY -3 +#define FFA_ERROR_BUSY -4 +#define FFA_ERROR_INTERRUPTED -5 +#define FFA_ERROR_DENIED -6 +#define FFA_ERROR_RETRY -7 + +/* The macros below are used to identify FFA calls from the SMC function ID */ +#define FFA_FNUM_MIN_VALUE U(0x60) +#define FFA_FNUM_MAX_VALUE U(0x7f) +#define is_ffa_fid(fid) __extension__ ({ \ + __typeof__(fid) _fid = (fid); \ + ((GET_SMC_NUM(_fid) >= FFA_FNUM_MIN_VALUE) && \ + (GET_SMC_NUM(_fid) <= FFA_FNUM_MAX_VALUE)); }) + +/* FFA_VERSION helpers */ +#define FFA_VERSION_MAJOR U(1) +#define FFA_VERSION_MAJOR_SHIFT 16 +#define FFA_VERSION_MAJOR_MASK U(0x7FFF) +#define FFA_VERSION_MINOR U(0) +#define FFA_VERSION_MINOR_SHIFT 0 +#define FFA_VERSION_MINOR_MASK U(0xFFFF) + +#define MAKE_FFA_VERSION(major, minor) \ + ((((major) & FFA_VERSION_MAJOR_MASK) << FFA_VERSION_MAJOR_SHIFT) | \ + (((minor) & FFA_VERSION_MINOR_MASK) << FFA_VERSION_MINOR_SHIFT)) +#define FFA_VERSION_COMPILED MAKE_FFA_VERSION(FFA_VERSION_MAJOR, \ + FFA_VERSION_MINOR) + +/* FFA_MSG_SEND helpers */ +#define FFA_MSG_SEND_ATTRS_BLK_SHIFT U(0) +#define FFA_MSG_SEND_ATTRS_BLK_MASK U(0x1) +#define FFA_MSG_SEND_ATTRS_BLK U(0) +#define FFA_MSG_SEND_ATTRS_BLK_NOT U(1) +#define FFA_MSG_SEND_ATTRS(blk) \ + (((blk) & FFA_MSG_SEND_ATTRS_BLK_MASK) \ + << FFA_MSG_SEND_ATTRS_BLK_SHIFT) + +/* Get FFA fastcall std FID from function number */ +#define FFA_FID(smc_cc, func_num) \ + ((SMC_TYPE_FAST << FUNCID_TYPE_SHIFT) | \ + ((smc_cc) << FUNCID_CC_SHIFT) | \ + (OEN_STD_START << FUNCID_OEN_SHIFT) | \ + ((func_num) << FUNCID_NUM_SHIFT)) + +/* FFA function numbers */ +#define FFA_FNUM_ERROR U(0x60) +#define FFA_FNUM_SUCCESS U(0x61) +#define FFA_FNUM_INTERRUPT U(0x62) +#define FFA_FNUM_VERSION U(0x63) +#define FFA_FNUM_FEATURES U(0x64) +#define FFA_FNUM_RX_RELEASE U(0x65) +#define FFA_FNUM_RXTX_MAP U(0x66) +#define FFA_FNUM_RXTX_UNMAP U(0x67) +#define FFA_FNUM_PARTITION_INFO_GET U(0x68) +#define FFA_FNUM_ID_GET U(0x69) +#define FFA_FNUM_MSG_POLL U(0x6A) +#define FFA_FNUM_MSG_WAIT U(0x6B) +#define FFA_FNUM_MSG_YIELD U(0x6C) +#define FFA_FNUM_MSG_RUN U(0x6D) +#define FFA_FNUM_MSG_SEND U(0x6E) +#define FFA_FNUM_MSG_SEND_DIRECT_REQ U(0x6F) +#define FFA_FNUM_MSG_SEND_DIRECT_RESP U(0x70) +#define FFA_FNUM_MEM_DONATE U(0x71) +#define FFA_FNUM_MEM_LEND U(0x72) +#define FFA_FNUM_MEM_SHARE U(0x73) +#define FFA_FNUM_MEM_RETRIEVE_REQ U(0x74) +#define FFA_FNUM_MEM_RETRIEVE_RESP U(0x75) +#define FFA_FNUM_MEM_RELINQUISH U(0x76) +#define FFA_FNUM_MEM_RECLAIM U(0x77) + +/* FFA SMC32 FIDs */ +#define FFA_ERROR FFA_FID(SMC_32, FFA_FNUM_ERROR) +#define FFA_SUCCESS_SMC32 FFA_FID(SMC_32, FFA_FNUM_SUCCESS) +#define FFA_INTERRUPT FFA_FID(SMC_32, FFA_FNUM_INTERRUPT) +#define FFA_VERSION FFA_FID(SMC_32, FFA_FNUM_VERSION) +#define FFA_FEATURES FFA_FID(SMC_32, FFA_FNUM_FEATURES) +#define FFA_RX_RELEASE FFA_FID(SMC_32, FFA_FNUM_RX_RELEASE) +#define FFA_RXTX_MAP_SMC32 FFA_FID(SMC_32, FFA_FNUM_RXTX_MAP) +#define FFA_RXTX_UNMAP FFA_FID(SMC_32, FFA_FNUM_RXTX_UNMAP) +#define FFA_PARTITION_INFO_GET FFA_FID(SMC_32, FFA_FNUM_PARTITION_INFO_GET) +#define FFA_ID_GET FFA_FID(SMC_32, FFA_FNUM_ID_GET) +#define FFA_MSG_POLL FFA_FID(SMC_32, FFA_FNUM_MSG_POLL) +#define FFA_MSG_WAIT FFA_FID(SMC_32, FFA_FNUM_MSG_WAIT) +#define FFA_MSG_YIELD FFA_FID(SMC_32, FFA_FNUM_MSG_YIELD) +#define FFA_MSG_RUN FFA_FID(SMC_32, FFA_FNUM_MSG_RUN) +#define FFA_MSG_SEND FFA_FID(SMC_32, FFA_FNUM_MSG_SEND) +#define FFA_MSG_SEND_DIRECT_REQ_SMC32 \ + FFA_FID(SMC_32, FFA_FNUM_MSG_SEND_DIRECT_REQ) +#define FFA_MSG_SEND_DIRECT_RESP_SMC32 \ + FFA_FID(SMC_32, FFA_FNUM_MSG_SEND_DIRECT_RESP) +#define FFA_MEM_DONATE_SMC32 FFA_FID(SMC_32, FFA_FNUM_MEM_DONATE) +#define FFA_MEM_LEND_SMC32 FFA_FID(SMC_32, FFA_FNUM_MEM_LEND) +#define FFA_MEM_SHARE_SMC32 FFA_FID(SMC_32, FFA_FNUM_MEM_SHARE) +#define FFA_MEM_RETRIEVE_REQ_SMC32 \ + FFA_FID(SMC_32, FFA_FNUM_MEM_RETRIEVE_REQ) +#define FFA_MEM_RETRIEVE_RESP FFA_FID(SMC_32, FFA_FNUM_MEM_RETRIEVE_RESP) +#define FFA_MEM_RELINQUISH FFA_FID(SMC_32, FFA_FNUM_MEM_RELINQUISH) +#define FFA_MEM_RECLAIM FFA_FID(SMC_32, FFA_FNUM_MEM_RECLAIM) + +/* FFA SMC64 FIDs */ +#define FFA_SUCCESS_SMC64 FFA_FID(SMC_64, FFA_FNUM_SUCCESS) +#define FFA_RXTX_MAP_SMC64 FFA_FID(SMC_64, FFA_FNUM_RXTX_MAP) +#define FFA_MSG_SEND_DIRECT_REQ_SMC64 \ + FFA_FID(SMC_64, FFA_FNUM_MSG_SEND_DIRECT_REQ) +#define FFA_MSG_SEND_DIRECT_RESP_SMC64 \ + FFA_FID(SMC_64, FFA_FNUM_MSG_SEND_DIRECT_RESP) +#define FFA_MEM_DONATE_SMC64 FFA_FID(SMC_64, FFA_FNUM_MEM_DONATE) +#define FFA_MEM_LEND_SMC64 FFA_FID(SMC_64, FFA_FNUM_MEM_LEND) +#define FFA_MEM_SHARE_SMC64 FFA_FID(SMC_64, FFA_FNUM_MEM_SHARE) +#define FFA_MEM_RETRIEVE_REQ_SMC64 \ + FFA_FID(SMC_64, FFA_FNUM_MEM_RETRIEVE_REQ) + +/* + * Reserve a special value for traffic targeted to the Hypervisor or SPM. + */ +#define FFA_TARGET_INFO_MBZ U(0x0) + +/* + * Reserve a special value for MBZ parameters. + */ +#define FFA_PARAM_MBZ U(0x0) + +#endif /* FFA_SVC_H */ diff --git a/include/services/spci_svc.h b/include/services/spci_svc.h deleted file mode 100644 index 49ba40858..000000000 --- a/include/services/spci_svc.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2019, Arm Limited. All rights reserved. - * - * SPDX-License-Identifier: BSD-3-Clause - */ - -#ifndef SPCI_SVC_H -#define SPCI_SVC_H - -#include -#include -#include - -/* SPCI error codes. */ -#define SPCI_ERROR_NOT_SUPPORTED -1 -#define SPCI_ERROR_INVALID_PARAMETER -2 -#define SPCI_ERROR_NO_MEMORY -3 -#define SPCI_ERROR_BUSY -4 -#define SPCI_ERROR_INTERRUPTED -5 -#define SPCI_ERROR_DENIED -6 -#define SPCI_ERROR_RETRY -7 - -/* The macros below are used to identify SPCI calls from the SMC function ID */ -#define SPCI_FNUM_MIN_VALUE U(0x60) -#define SPCI_FNUM_MAX_VALUE U(0x7f) -#define is_spci_fid(fid) __extension__ ({ \ - __typeof__(fid) _fid = (fid); \ - ((GET_SMC_NUM(_fid) >= SPCI_FNUM_MIN_VALUE) && \ - (GET_SMC_NUM(_fid) <= SPCI_FNUM_MAX_VALUE)); }) - -/* SPCI_VERSION helpers */ -#define SPCI_VERSION_MAJOR U(0) -#define SPCI_VERSION_MAJOR_SHIFT 16 -#define SPCI_VERSION_MAJOR_MASK U(0x7FFF) -#define SPCI_VERSION_MINOR U(9) -#define SPCI_VERSION_MINOR_SHIFT 0 -#define SPCI_VERSION_MINOR_MASK U(0xFFFF) - -#define MAKE_SPCI_VERSION(major, minor) \ - ((((major) & SPCI_VERSION_MAJOR_MASK) << SPCI_VERSION_MAJOR_SHIFT) | \ - (((minor) & SPCI_VERSION_MINOR_MASK) << SPCI_VERSION_MINOR_SHIFT)) -#define SPCI_VERSION_COMPILED MAKE_SPCI_VERSION(SPCI_VERSION_MAJOR, \ - SPCI_VERSION_MINOR) - -/* SPCI_MSG_SEND helpers */ -#define SPCI_MSG_SEND_ATTRS_BLK_SHIFT U(0) -#define SPCI_MSG_SEND_ATTRS_BLK_MASK U(0x1) -#define SPCI_MSG_SEND_ATTRS_BLK U(0) -#define SPCI_MSG_SEND_ATTRS_BLK_NOT U(1) -#define SPCI_MSG_SEND_ATTRS(blk) \ - (((blk) & SPCI_MSG_SEND_ATTRS_BLK_MASK) \ - << SPCI_MSG_SEND_ATTRS_BLK_SHIFT) - -/* Get SPCI fastcall std FID from function number */ -#define SPCI_FID(smc_cc, func_num) \ - ((SMC_TYPE_FAST << FUNCID_TYPE_SHIFT) | \ - ((smc_cc) << FUNCID_CC_SHIFT) | \ - (OEN_STD_START << FUNCID_OEN_SHIFT) | \ - ((func_num) << FUNCID_NUM_SHIFT)) - -/* SPCI function numbers */ -#define SPCI_FNUM_ERROR U(0x60) -#define SPCI_FNUM_SUCCESS U(0x61) -#define SPCI_FNUM_INTERRUPT U(0x62) -#define SPCI_FNUM_VERSION U(0x63) -#define SPCI_FNUM_FEATURES U(0x64) -#define SPCI_FNUM_RX_RELEASE U(0x65) -#define SPCI_FNUM_RXTX_MAP U(0x66) -#define SPCI_FNUM_RXTX_UNMAP U(0x67) -#define SPCI_FNUM_PARTITION_INFO_GET U(0x68) -#define SPCI_FNUM_ID_GET U(0x69) -#define SPCI_FNUM_MSG_POLL U(0x6A) -#define SPCI_FNUM_MSG_WAIT U(0x6B) -#define SPCI_FNUM_MSG_YIELD U(0x6C) -#define SPCI_FNUM_MSG_RUN U(0x6D) -#define SPCI_FNUM_MSG_SEND U(0x6E) -#define SPCI_FNUM_MSG_SEND_DIRECT_REQ U(0x6F) -#define SPCI_FNUM_MSG_SEND_DIRECT_RESP U(0x70) -#define SPCI_FNUM_MEM_DONATE U(0x71) -#define SPCI_FNUM_MEM_LEND U(0x72) -#define SPCI_FNUM_MEM_SHARE U(0x73) -#define SPCI_FNUM_MEM_RETRIEVE_REQ U(0x74) -#define SPCI_FNUM_MEM_RETRIEVE_RESP U(0x75) -#define SPCI_FNUM_MEM_RELINQUISH U(0x76) -#define SPCI_FNUM_MEM_RECLAIM U(0x77) - -/* SPCI SMC32 FIDs */ -#define SPCI_ERROR SPCI_FID(SMC_32, SPCI_FNUM_ERROR) -#define SPCI_SUCCESS_SMC32 SPCI_FID(SMC_32, SPCI_FNUM_SUCCESS) -#define SPCI_INTERRUPT SPCI_FID(SMC_32, SPCI_FNUM_INTERRUPT) -#define SPCI_VERSION SPCI_FID(SMC_32, SPCI_FNUM_VERSION) -#define SPCI_FEATURES SPCI_FID(SMC_32, SPCI_FNUM_FEATURES) -#define SPCI_RX_RELEASE SPCI_FID(SMC_32, SPCI_FNUM_RX_RELEASE) -#define SPCI_RXTX_MAP_SMC32 SPCI_FID(SMC_32, SPCI_FNUM_RXTX_MAP) -#define SPCI_RXTX_UNMAP SPCI_FID(SMC_32, SPCI_FNUM_RXTX_UNMAP) -#define SPCI_PARTITION_INFO_GET SPCI_FID(SMC_32, SPCI_FNUM_PARTITION_INFO_GET) -#define SPCI_ID_GET SPCI_FID(SMC_32, SPCI_FNUM_ID_GET) -#define SPCI_MSG_POLL SPCI_FID(SMC_32, SPCI_FNUM_MSG_POLL) -#define SPCI_MSG_WAIT SPCI_FID(SMC_32, SPCI_FNUM_MSG_WAIT) -#define SPCI_MSG_YIELD SPCI_FID(SMC_32, SPCI_FNUM_MSG_YIELD) -#define SPCI_MSG_RUN SPCI_FID(SMC_32, SPCI_FNUM_MSG_RUN) -#define SPCI_MSG_SEND SPCI_FID(SMC_32, SPCI_FNUM_MSG_SEND) -#define SPCI_MSG_SEND_DIRECT_REQ_SMC32 \ - SPCI_FID(SMC_32, SPCI_FNUM_MSG_SEND_DIRECT_REQ) -#define SPCI_MSG_SEND_DIRECT_RESP_SMC32 \ - SPCI_FID(SMC_32, SPCI_FNUM_MSG_SEND_DIRECT_RESP) -#define SPCI_MEM_DONATE_SMC32 SPCI_FID(SMC_32, SPCI_FNUM_MEM_DONATE) -#define SPCI_MEM_LEND_SMC32 SPCI_FID(SMC_32, SPCI_FNUM_MEM_LEND) -#define SPCI_MEM_SHARE_SMC32 SPCI_FID(SMC_32, SPCI_FNUM_MEM_SHARE) -#define SPCI_MEM_RETRIEVE_REQ_SMC32 \ - SPCI_FID(SMC_32, SPCI_FNUM_MEM_RETRIEVE_REQ) -#define SPCI_MEM_RETRIEVE_RESP SPCI_FID(SMC_32, SPCI_FNUM_MEM_RETRIEVE_RESP) -#define SPCI_MEM_RELINQUISH SPCI_FID(SMC_32, SPCI_FNUM_MEM_RELINQUISH) -#define SPCI_MEM_RECLAIM SPCI_FID(SMC_32, SPCI_FNUM_MEM_RECLAIM) - -/* SPCI SMC64 FIDs */ -#define SPCI_SUCCESS_SMC64 SPCI_FID(SMC_64, SPCI_FNUM_SUCCESS) -#define SPCI_RXTX_MAP_SMC64 SPCI_FID(SMC_64, SPCI_FNUM_RXTX_MAP) -#define SPCI_MSG_SEND_DIRECT_REQ_SMC64 \ - SPCI_FID(SMC_64, SPCI_FNUM_MSG_SEND_DIRECT_REQ) -#define SPCI_MSG_SEND_DIRECT_RESP_SMC64 \ - SPCI_FID(SMC_64, SPCI_FNUM_MSG_SEND_DIRECT_RESP) -#define SPCI_MEM_DONATE_SMC64 SPCI_FID(SMC_64, SPCI_FNUM_MEM_DONATE) -#define SPCI_MEM_LEND_SMC64 SPCI_FID(SMC_64, SPCI_FNUM_MEM_LEND) -#define SPCI_MEM_SHARE_SMC64 SPCI_FID(SMC_64, SPCI_FNUM_MEM_SHARE) -#define SPCI_MEM_RETRIEVE_REQ_SMC64 \ - SPCI_FID(SMC_64, SPCI_FNUM_MEM_RETRIEVE_REQ) - -/* - * Reserve a special value for traffic targeted to the Hypervisor or SPM. - */ -#define SPCI_TARGET_INFO_MBZ U(0x0) - -/* - * Reserve a special value for MBZ parameters. - */ -#define SPCI_PARAM_MBZ U(0x0) - -#endif /* SPCI_SVC_H */ diff --git a/include/services/spm_core_manifest.h b/include/services/spm_core_manifest.h index 0c4363691..64ecce005 100644 --- a/include/services/spm_core_manifest.h +++ b/include/services/spm_core_manifest.h @@ -15,7 +15,7 @@ typedef struct spm_core_manifest_sect_attribute { /* - * SPCI version (mandatory). + * FFA version (mandatory). */ uint32_t major_version; uint32_t minor_version; diff --git a/include/services/spmd_svc.h b/include/services/spmd_svc.h index a766dcf8f..1e7e6aa87 100644 --- a/include/services/spmd_svc.h +++ b/include/services/spmd_svc.h @@ -8,7 +8,7 @@ #define SPMD_SVC_H #ifndef __ASSEMBLER__ -#include +#include #include int spmd_setup(void); diff --git a/plat/arm/board/fvp/fdts/fvp_spmc_manifest.dts b/plat/arm/board/fvp/fdts/fvp_spmc_manifest.dts index ebfbe174b..a1c909449 100644 --- a/plat/arm/board/fvp/fdts/fvp_spmc_manifest.dts +++ b/plat/arm/board/fvp/fdts/fvp_spmc_manifest.dts @@ -6,12 +6,14 @@ /dts-v1/; / { - compatible = "arm,spci-core-manifest-1.0"; + compatible = "arm,ffa-core-manifest-1.0"; + #address-cells = <2>; + #size-cells = <1>; attribute { spmc_id = <0x8000>; - maj_ver = <0x0>; - min_ver = <0x9>; + maj_ver = <0x1>; + min_ver = <0x0>; exec_state = <0x0>; load_address = <0x0 0x6000000>; entrypoint = <0x0 0x6000000>; @@ -25,12 +27,12 @@ hypervisor { compatible = "hafnium,hafnium"; vm1 { - is_spci_partition; + is_ffa_partition; debug_name = "cactus-primary"; load_address = <0x7000000>; }; vm2 { - is_spci_partition; + is_ffa_partition; debug_name = "cactus-secondary"; load_address = <0x7100000>; vcpu_count = <2>; @@ -62,6 +64,6 @@ memory@60000000 { device_type = "memory"; - reg = <0x6000000 0x2000000>; /* Trusted DRAM */ + reg = <0x0 0x6000000 0x2000000>; /* Trusted DRAM */ }; }; diff --git a/plat/common/plat_spmd_manifest.c b/plat/common/plat_spmd_manifest.c index 109b001f0..455b9808b 100644 --- a/plat/common/plat_spmd_manifest.c +++ b/plat/common/plat_spmd_manifest.c @@ -31,14 +31,14 @@ static int manifest_parse_attribute(spmc_manifest_attribute_t *attr, rc = fdt_read_uint32(fdt, node, "maj_ver", &attr->major_version); if (rc != 0) { - ERROR("Missing SPCI %s version in SPM Core manifest.\n", + ERROR("Missing FFA %s version in SPM Core manifest.\n", "major"); return rc; } rc = fdt_read_uint32(fdt, node, "min_ver", &attr->minor_version); if (rc != 0) { - ERROR("Missing SPCI %s version in SPM Core manifest.\n", + ERROR("Missing FFA %s version in SPM Core manifest.\n", "minor"); return rc; } @@ -163,7 +163,7 @@ int plat_spm_core_manifest_load(spmc_manifest_attribute_t *manifest, VERBOSE("Reading SPM Core manifest at address %p\n", pm_addr); rc = fdt_node_offset_by_compatible(pm_addr, -1, - "arm,spci-core-manifest-1.0"); + "arm,ffa-core-manifest-1.0"); if (rc < 0) { ERROR("Unrecognized SPM Core manifest\n"); goto exit_unmap; diff --git a/services/std_svc/spmd/spmd_main.c b/services/std_svc/spmd/spmd_main.c index 501782ffb..a818037cb 100644 --- a/services/std_svc/spmd/spmd_main.c +++ b/services/std_svc/spmd/spmd_main.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include "spmd_private.h" @@ -56,7 +56,7 @@ spmd_spm_core_context_t *spmd_get_context(void) ******************************************************************************/ static int32_t spmd_init(void); static int spmd_spmc_init(void *pm_addr); -static uint64_t spmd_spci_error_return(void *handle, +static uint64_t spmd_ffa_error_return(void *handle, int error_code); static uint64_t spmd_smc_forward(uint32_t smc_fid, bool secure_origin, @@ -161,14 +161,14 @@ static int spmd_spmc_init(void *pm_addr) * Ensure that the SPM Core version is compatible with the SPM * Dispatcher version. */ - if ((spmc_attrs.major_version != SPCI_VERSION_MAJOR) || - (spmc_attrs.minor_version > SPCI_VERSION_MINOR)) { - WARN("Unsupported SPCI version (%u.%u)\n", + if ((spmc_attrs.major_version != FFA_VERSION_MAJOR) || + (spmc_attrs.minor_version > FFA_VERSION_MINOR)) { + WARN("Unsupported FFA version (%u.%u)\n", spmc_attrs.major_version, spmc_attrs.minor_version); return -EINVAL; } - VERBOSE("SPCI version (%u.%u)\n", spmc_attrs.major_version, + VERBOSE("FFA version (%u.%u)\n", spmc_attrs.major_version, spmc_attrs.minor_version); VERBOSE("SPM Core run time EL%x.\n", @@ -324,18 +324,18 @@ static uint64_t spmd_smc_forward(uint32_t smc_fid, } /******************************************************************************* - * Return SPCI_ERROR with specified error code + * Return FFA_ERROR with specified error code ******************************************************************************/ -static uint64_t spmd_spci_error_return(void *handle, int error_code) +static uint64_t spmd_ffa_error_return(void *handle, int error_code) { - SMC_RET8(handle, SPCI_ERROR, - SPCI_TARGET_INFO_MBZ, error_code, - SPCI_PARAM_MBZ, SPCI_PARAM_MBZ, SPCI_PARAM_MBZ, - SPCI_PARAM_MBZ, SPCI_PARAM_MBZ); + SMC_RET8(handle, FFA_ERROR, + FFA_TARGET_INFO_MBZ, error_code, + FFA_PARAM_MBZ, FFA_PARAM_MBZ, FFA_PARAM_MBZ, + FFA_PARAM_MBZ, FFA_PARAM_MBZ); } /******************************************************************************* - * This function handles all SMCs in the range reserved for SPCI. Each call is + * This function handles all SMCs in the range reserved for FFA. Each call is * either forwarded to the other security state or handled by the SPM dispatcher ******************************************************************************/ uint64_t spmd_smc_handler(uint32_t smc_fid, @@ -360,7 +360,7 @@ uint64_t spmd_smc_handler(uint32_t smc_fid, SMC_GET_GP(handle, CTX_GPREG_X7)); switch (smc_fid) { - case SPCI_ERROR: + case FFA_ERROR: /* * Check if this is the first invocation of this interface on * this CPU. If so, then indicate that the SPM Core initialised @@ -374,33 +374,33 @@ uint64_t spmd_smc_handler(uint32_t smc_fid, x1, x2, x3, x4, handle); break; /* not reached */ - case SPCI_VERSION: + case FFA_VERSION: /* * TODO: This is an optimization that the version information * provided by the SPM Core manifest is returned by the SPM * dispatcher. It might be a better idea to simply forward this * call to the SPM Core and wash our hands completely. */ - ret = MAKE_SPCI_VERSION(spmc_attrs.major_version, + ret = MAKE_FFA_VERSION(spmc_attrs.major_version, spmc_attrs.minor_version); - SMC_RET8(handle, SPCI_SUCCESS_SMC32, SPCI_TARGET_INFO_MBZ, ret, - SPCI_PARAM_MBZ, SPCI_PARAM_MBZ, SPCI_PARAM_MBZ, - SPCI_PARAM_MBZ, SPCI_PARAM_MBZ); + SMC_RET8(handle, FFA_SUCCESS_SMC32, FFA_TARGET_INFO_MBZ, ret, + FFA_PARAM_MBZ, FFA_PARAM_MBZ, FFA_PARAM_MBZ, + FFA_PARAM_MBZ, FFA_PARAM_MBZ); break; /* not reached */ - case SPCI_FEATURES: + case FFA_FEATURES: /* * This is an optional interface. Do the minimal checks and * forward to SPM Core which will handle it if implemented. */ /* - * Check if x1 holds a valid SPCI fid. This is an + * Check if x1 holds a valid FFA fid. This is an * optimization. */ - if (!is_spci_fid(x1)) { - return spmd_spci_error_return(handle, - SPCI_ERROR_NOT_SUPPORTED); + if (!is_ffa_fid(x1)) { + return spmd_ffa_error_return(handle, + FFA_ERROR_NOT_SUPPORTED); } /* Forward SMC from Normal world to the SPM Core */ @@ -411,68 +411,68 @@ uint64_t spmd_smc_handler(uint32_t smc_fid, /* * Return success if call was from secure world i.e. all - * SPCI functions are supported. This is essentially a + * FFA functions are supported. This is essentially a * nop. */ - SMC_RET8(handle, SPCI_SUCCESS_SMC32, x1, x2, x3, x4, + SMC_RET8(handle, FFA_SUCCESS_SMC32, x1, x2, x3, x4, SMC_GET_GP(handle, CTX_GPREG_X5), SMC_GET_GP(handle, CTX_GPREG_X6), SMC_GET_GP(handle, CTX_GPREG_X7)); break; /* not reached */ - case SPCI_ID_GET: + case FFA_ID_GET: /* - * Returns the ID of the calling SPCI component. + * Returns the ID of the calling FFA component. */ if (!secure_origin) { - SMC_RET8(handle, SPCI_SUCCESS_SMC32, - SPCI_TARGET_INFO_MBZ, SPCI_NS_ENDPOINT_ID, - SPCI_PARAM_MBZ, SPCI_PARAM_MBZ, - SPCI_PARAM_MBZ, SPCI_PARAM_MBZ, - SPCI_PARAM_MBZ); + SMC_RET8(handle, FFA_SUCCESS_SMC32, + FFA_TARGET_INFO_MBZ, FFA_NS_ENDPOINT_ID, + FFA_PARAM_MBZ, FFA_PARAM_MBZ, + FFA_PARAM_MBZ, FFA_PARAM_MBZ, + FFA_PARAM_MBZ); } - SMC_RET8(handle, SPCI_SUCCESS_SMC32, - SPCI_TARGET_INFO_MBZ, spmc_attrs.spmc_id, - SPCI_PARAM_MBZ, SPCI_PARAM_MBZ, - SPCI_PARAM_MBZ, SPCI_PARAM_MBZ, - SPCI_PARAM_MBZ); + SMC_RET8(handle, FFA_SUCCESS_SMC32, + FFA_TARGET_INFO_MBZ, spmc_attrs.spmc_id, + FFA_PARAM_MBZ, FFA_PARAM_MBZ, + FFA_PARAM_MBZ, FFA_PARAM_MBZ, + FFA_PARAM_MBZ); break; /* not reached */ - case SPCI_RX_RELEASE: - case SPCI_RXTX_MAP_SMC32: - case SPCI_RXTX_MAP_SMC64: - case SPCI_RXTX_UNMAP: - case SPCI_MSG_RUN: + case FFA_RX_RELEASE: + case FFA_RXTX_MAP_SMC32: + case FFA_RXTX_MAP_SMC64: + case FFA_RXTX_UNMAP: + case FFA_MSG_RUN: /* This interface must be invoked only by the Normal world */ if (secure_origin) { - return spmd_spci_error_return(handle, - SPCI_ERROR_NOT_SUPPORTED); + return spmd_ffa_error_return(handle, + FFA_ERROR_NOT_SUPPORTED); } /* Fall through to forward the call to the other world */ - case SPCI_PARTITION_INFO_GET: - case SPCI_MSG_SEND: - case SPCI_MSG_SEND_DIRECT_REQ_SMC32: - case SPCI_MSG_SEND_DIRECT_REQ_SMC64: - case SPCI_MSG_SEND_DIRECT_RESP_SMC32: - case SPCI_MSG_SEND_DIRECT_RESP_SMC64: - case SPCI_MEM_DONATE_SMC32: - case SPCI_MEM_DONATE_SMC64: - case SPCI_MEM_LEND_SMC32: - case SPCI_MEM_LEND_SMC64: - case SPCI_MEM_SHARE_SMC32: - case SPCI_MEM_SHARE_SMC64: - case SPCI_MEM_RETRIEVE_REQ_SMC32: - case SPCI_MEM_RETRIEVE_REQ_SMC64: - case SPCI_MEM_RETRIEVE_RESP: - case SPCI_MEM_RELINQUISH: - case SPCI_MEM_RECLAIM: - case SPCI_SUCCESS_SMC32: - case SPCI_SUCCESS_SMC64: + case FFA_PARTITION_INFO_GET: + case FFA_MSG_SEND: + case FFA_MSG_SEND_DIRECT_REQ_SMC32: + case FFA_MSG_SEND_DIRECT_REQ_SMC64: + case FFA_MSG_SEND_DIRECT_RESP_SMC32: + case FFA_MSG_SEND_DIRECT_RESP_SMC64: + case FFA_MEM_DONATE_SMC32: + case FFA_MEM_DONATE_SMC64: + case FFA_MEM_LEND_SMC32: + case FFA_MEM_LEND_SMC64: + case FFA_MEM_SHARE_SMC32: + case FFA_MEM_SHARE_SMC64: + case FFA_MEM_RETRIEVE_REQ_SMC32: + case FFA_MEM_RETRIEVE_REQ_SMC64: + case FFA_MEM_RETRIEVE_RESP: + case FFA_MEM_RELINQUISH: + case FFA_MEM_RECLAIM: + case FFA_SUCCESS_SMC32: + case FFA_SUCCESS_SMC64: /* * TODO: Assume that no requests originate from EL3 at the * moment. This will change if a SP service is required in @@ -484,7 +484,7 @@ uint64_t spmd_smc_handler(uint32_t smc_fid, x1, x2, x3, x4, handle); break; /* not reached */ - case SPCI_MSG_WAIT: + case FFA_MSG_WAIT: /* * Check if this is the first invocation of this interface on * this CPU from the Secure world. If so, then indicate that the @@ -496,11 +496,11 @@ uint64_t spmd_smc_handler(uint32_t smc_fid, /* Fall through to forward the call to the other world */ - case SPCI_MSG_YIELD: + case FFA_MSG_YIELD: /* This interface must be invoked only by the Secure world */ if (!secure_origin) { - return spmd_spci_error_return(handle, - SPCI_ERROR_NOT_SUPPORTED); + return spmd_ffa_error_return(handle, + FFA_ERROR_NOT_SUPPORTED); } return spmd_smc_forward(smc_fid, secure_origin, @@ -509,6 +509,6 @@ uint64_t spmd_smc_handler(uint32_t smc_fid, default: WARN("SPM: Unsupported call 0x%08x\n", smc_fid); - return spmd_spci_error_return(handle, SPCI_ERROR_NOT_SUPPORTED); + return spmd_ffa_error_return(handle, FFA_ERROR_NOT_SUPPORTED); } } diff --git a/services/std_svc/spmd/spmd_private.h b/services/std_svc/spmd/spmd_private.h index 232031bb3..494630907 100644 --- a/services/std_svc/spmd/spmd_private.h +++ b/services/std_svc/spmd/spmd_private.h @@ -30,7 +30,7 @@ #define SPMD_C_RT_CTX_ENTRIES (SPMD_C_RT_CTX_SIZE >> DWORD_SHIFT) #ifndef __ASSEMBLER__ -#include +#include #include typedef enum spmc_state { @@ -49,11 +49,11 @@ typedef struct spmd_spm_core_context { } spmd_spm_core_context_t; /* - * Reserve ID for NS physical SPCI Endpoint. + * Reserve ID for NS physical FFA Endpoint. */ -#define SPCI_NS_ENDPOINT_ID U(0) +#define FFA_NS_ENDPOINT_ID U(0) -/* Mask and shift to check valid secure SPCI Endpoint ID. */ +/* Mask and shift to check valid secure FFA Endpoint ID. */ #define SPMC_SECURE_ID_MASK U(1) #define SPMC_SECURE_ID_SHIFT U(15) diff --git a/services/std_svc/std_svc_setup.c b/services/std_svc/std_svc_setup.c index 895fd292f..cdd17bc1d 100644 --- a/services/std_svc/std_svc_setup.c +++ b/services/std_svc/std_svc_setup.c @@ -123,10 +123,10 @@ static uintptr_t std_svc_smc_handler(uint32_t smc_fid, #if defined(SPD_spmd) /* - * Dispatch SPCI calls to the SPCI SMC handler implemented by the SPM + * Dispatch FFA calls to the FFA SMC handler implemented by the SPM * dispatcher and return its return value */ - if (is_spci_fid(smc_fid)) { + if (is_ffa_fid(smc_fid)) { return spmd_smc_handler(smc_fid, x1, x2, x3, x4, cookie, handle, flags); }