refactor(smccc): move pmf to vendor el3 calls

Move pmf support to vendor-specific EL3 Monitor Service Calls. Remove
pmf call count as it's not supported in vendor-specific el3 as per
SMCCC Documentation 1.5:
https://developer.arm.com/documentation/den0028/latest

Add a deprecation notice to inform PMF is moved from arm-sip range to
vendor-specific EL3 range. PMF support from arm-sip range will be
removed and will not available after TF-A 2.12 release.

Change-Id: Ie1e14aa601d4fc3db352cd5621d842017a18e9ec
Signed-off-by: Govindraj Raja <govindraj.raja@arm.com>
This commit is contained in:
Govindraj Raja 2024-04-15 12:42:13 -05:00
parent 273b898388
commit f7679d437d
8 changed files with 65 additions and 21 deletions

View file

@ -15,18 +15,11 @@ services:
The Arm SiP implementation offers the following services:
- Performance Measurement Framework (PMF)
- Execution State Switching service
Source definitions for Arm SiP service are located in the ``arm_sip_svc.h`` header
file.
Performance Measurement Framework (PMF)
---------------------------------------
The :ref:`Performance Measurement Framework <firmware_design_pmf>`
allows callers to retrieve timestamps captured at various paths in TF-A
execution.
Execution State Switching service
---------------------------------

View file

@ -24,15 +24,26 @@ Vendor-specific EL3 monitor services are as follows:
+-----------------------------------+-----------------------+---------------------------------------------+
| SMC Function Identifier | Service Type | FID's Usage |
+===================================+=======================+=============================================+
| 0x87000010 - 0x8700001F (SMC32) | DebugFS Interface | | 0 - 11 are in use |
+-----------------------------------+ | | 12 - 15 are reserved for future expansion |
| 0x87000010 - 0x8700001F (SMC32) | DebugFS Interface | | 0 - 11 are in use. |
+-----------------------------------+ | | 12 - 15 are reserved for future expansion.|
| 0xC7000010 - 0xC700001F (SMC64) | | |
+-----------------------------------+-----------------------+---------------------------------------------+
| 0x87000020 - 0x8700002F (SMC32) | Performance | | 0 is in use. |
+-----------------------------------+ Measurement Framework | | 1 - 15 are reserved for future expansion. |
| 0xC7000020 - 0xC700002F (SMC64) | (PMF) | |
+-----------------------------------+-----------------------+---------------------------------------------+
Source definitions for vendor-specific EL3 Monitor Service Calls are located in
the ``ven_el3_svc.h`` header file.
Performance Measurement Framework (PMF)
---------------------------------------
The :ref:`Performance Measurement Framework <firmware_design_pmf>`
allows callers to retrieve timestamps captured at various paths in TF-A
execution.
DebugFS interface
-----------------

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2016-2024, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -36,19 +36,30 @@
#define PMF_NO_CACHE_MAINT U(0)
/*
* Defines for PMF SMC function ids.
* Defines for PMF SMC function ids used with arm-sip
* range, this is now deprecated and will be removed.
*/
#define PMF_SMC_GET_TIMESTAMP_32 U(0x82000010)
#define PMF_SMC_GET_TIMESTAMP_64 U(0xC2000010)
#define PMF_SMC_GET_TIMESTAMP_32_DEP U(0x82000010)
#define PMF_SMC_GET_TIMESTAMP_64_DEP U(0xC2000010)
#define PMF_FID_VALUE_DEPRECATED U(0x10)
#define is_pmf_fid_deprecated(_fid) \
(((_fid) & FUNCID_NUM_MASK) == PMF_FID_VALUE_DEPRECATED)
/*
* Defines for PMF SMC function ids used with Vendor-Specific
* EL3 range.
*/
#define PMF_SMC_GET_TIMESTAMP_32 U(0x87000020)
#define PMF_SMC_GET_TIMESTAMP_64 U(0xC7000020)
#define PMF_NUM_SMC_CALLS 2
/*
* The macros below are used to identify
* PMF calls from the SMC function ID.
*/
#define PMF_FID_MASK U(0xffe0)
#define PMF_FID_VALUE U(0)
#define is_pmf_fid(_fid) (((_fid) & PMF_FID_MASK) == PMF_FID_VALUE)
#define PMF_FID_VALUE U(0x20)
#define is_pmf_fid(_fid) (((_fid) & FUNCID_NUM_MASK) == PMF_FID_VALUE)
/* Following are the supported PMF service IDs */
#define PMF_PSCI_STAT_SVC_ID 0

View file

@ -16,6 +16,7 @@
/* U(0x8200ff02) is reserved */
#define ARM_SIP_SVC_VERSION U(0x8200ff03)
/* Deprecated FID's Range and will be removed */
/* PMF_SMC_GET_TIMESTAMP_32 0x82000010 */
/* PMF_SMC_GET_TIMESTAMP_64 0xC2000010 */

View file

@ -26,4 +26,7 @@
/* DEBUGFS_SMC_32 0x87000010U */
/* DEBUGFS_SMC_64 0xC7000010U */
/* PMF_SMC_GET_TIMESTAMP_32 0x87000020U */
/* PMF_SMC_GET_TIMESTAMP_64 0xC7000020U */
#endif /* VEN_EL3_SVC_H */

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2018, Arm Limited and Contributors. All rights reserved.
* Copyright (c) 2016-2024, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -36,7 +36,8 @@ uintptr_t pmf_smc_handler(unsigned int smc_fid,
x2 = (uint32_t)x2;
x3 = (uint32_t)x3;
if (smc_fid == PMF_SMC_GET_TIMESTAMP_32) {
if (smc_fid == PMF_SMC_GET_TIMESTAMP_32 ||
smc_fid == PMF_SMC_GET_TIMESTAMP_32_DEP) {
/*
* Return error code and the captured
* time-stamp to the caller.
@ -49,7 +50,8 @@ uintptr_t pmf_smc_handler(unsigned int smc_fid,
(uint32_t)(ts_value >> 32));
}
} else {
if (smc_fid == PMF_SMC_GET_TIMESTAMP_64) {
if (smc_fid == PMF_SMC_GET_TIMESTAMP_64 ||
smc_fid == PMF_SMC_GET_TIMESTAMP_64_DEP) {
/*
* Return error code and the captured
* time-stamp to the caller.

View file

@ -22,9 +22,11 @@ DEFINE_SVC_UUID2(arm_sip_svc_uid,
static int arm_sip_setup(void)
{
#if ENABLE_PMF
if (pmf_setup() != 0) {
return 1;
}
#endif /* ENABLE_PMF */
#if USE_DEBUGFS
@ -60,12 +62,13 @@ static uintptr_t arm_sip_handler(unsigned int smc_fid,
int call_count = 0;
#if ENABLE_PMF
/*
* Dispatch PMF calls to PMF SMC handler and return its return
* value
*/
if (is_pmf_fid(smc_fid)) {
if (is_pmf_fid_deprecated(smc_fid)) {
NOTICE("PMF Interface usage from arm-sip range is deprecated. \
Please migrate smc call to Vendor-specific el3 range.\n");
return pmf_smc_handler(smc_fid, x1, x2, x3, x4, cookie,
handle, flags);
}

View file

@ -9,6 +9,7 @@
#include <common/debug.h>
#include <common/runtime_svc.h>
#include <lib/debugfs.h>
#include <lib/pmf/pmf.h>
#include <services/ven_el3_svc.h>
#include <tools_share/uuid.h>
@ -25,6 +26,12 @@ static int ven_el3_svc_setup(void)
}
#endif /* USE_DEBUGFS */
#if ENABLE_PMF
if (pmf_setup() != 0) {
return 1;
}
#endif /* ENABLE_PMF */
return 0;
}
@ -51,6 +58,19 @@ static uintptr_t ven_el3_svc_handler(unsigned int smc_fid,
}
#endif /* USE_DEBUGFS */
#if ENABLE_PMF
/*
* Dispatch PMF calls to PMF SMC handler and return its return
* value
*/
if (is_pmf_fid(smc_fid)) {
return pmf_smc_handler(smc_fid, x1, x2, x3, x4, cookie,
handle, flags);
}
#endif /* ENABLE_PMF */
switch (smc_fid) {
case VEN_EL3_SVC_UID:
/* Return UID to the caller */