feat(smcc): introduce a new vendor_el3 service for ACS SMC handler
In preparation to add support for the Architecture Compliance Suite
SMC services, reserve a SMC ID and introduce a handler function.
Currently, an empty placeholder function is added and future support
will be introduced for the handler support.
More info on System ACS, please refer below link,
https://developer.arm.com/Architectures/Architectural%20Compliance%20Suite
Signed-off-by: Nandan J <Nandan.J@arm.com>
Change-Id: Ib13ccae9d3829e3dcd1cd33c4a7f27efe1436d03
diff --git a/docs/components/ven-el3-service.rst b/docs/components/ven-el3-service.rst
index 13449ba..8be1b39 100644
--- a/docs/components/ven-el3-service.rst
+++ b/docs/components/ven-el3-service.rst
@@ -32,9 +32,13 @@
+-----------------------------------+ Measurement Framework | | 2 - 15 are reserved for future expansion. |
| 0xC7000020 - 0xC700002F (SMC64) | (PMF) | |
+-----------------------------------+-----------------------+---------------------------------------------+
-| 0x87000030 - 0x8700FFFF (SMC32) | Reserved | | reserved for future expansion |
+| 0x87000030 - 0x8700003F (SMC32) | ACS (Architecture | | 0 in use. |
++-----------------------------------+ Compliance Suite) SMC | | 1 - 15 are reserved for future expansion. |
+| 0xC7000030 - 0xC700003F (SMC64) | handler | |
++-----------------------------------+-----------------------+---------------------------------------------+
+| 0x87000040 - 0x8700FFFF (SMC32) | Reserved | | reserved for future expansion |
+-----------------------------------+ | |
-| 0xC7000030 - 0xC700FFFF (SMC64) | | |
+| 0xC7000040 - 0xC700FFFF (SMC64) | | |
+-----------------------------------+-----------------------+---------------------------------------------+
Source definitions for vendor-specific EL3 Monitor Service Calls used by TF-A are located in
@@ -45,6 +49,8 @@
+============================+============================+================================+
| 1 | 0 | Added Debugfs and PMF services.|
+----------------------------+----------------------------+--------------------------------+
+| 1 | 1 | Added ACS SMC handler services.|
++----------------------------+----------------------------+--------------------------------+
*Table 1: Showing different versions of Vendor-specific service and changes done with each version*
@@ -71,8 +77,16 @@
The optional DebugFS interface is accessed through Vendor specific EL3 service. Refer
to :ref:`DebugFS interface` documentation for further details and usage.
+Architecture Compliance Suite (ACS) SMC handler
+-----------------------------------------------
+
+The Architecture Compliance Suite (ACS) SMC handler allows callers to branch
+to their ACS EL3 code based on their respective use-cases.
+For more details on System ACS, `System ACS`_.
+
--------------
-*Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.*
+*Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved.*
+.. _System ACS: https://developer.arm.com/Architectures/Architectural%20Compliance%20Suite
.. _SMC Calling Convention: https://developer.arm.com/docs/den0028/latest
diff --git a/docs/getting_started/build-options.rst b/docs/getting_started/build-options.rst
index 32daf1e..1b3568e 100644
--- a/docs/getting_started/build-options.rst
+++ b/docs/getting_started/build-options.rst
@@ -1509,6 +1509,11 @@
information using HOB defined in `Platform Initialization specification`_.
This defaults to ``0``.
+- ``ENABLE_ACS_SMC``: When set to ``1``, this enables support for ACS SMC
+ handler code to handle SMC calls from the Architecture Compliance Suite. The
+ handler is intentionally empty to reserve the SMC section and allow
+ project-specific implementations in future ACS use cases.
+
Firmware update options
~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/include/plat/arm/common/plat_acs_smc_handler.h b/include/plat/arm/common/plat_acs_smc_handler.h
new file mode 100644
index 0000000..4d337cb
--- /dev/null
+++ b/include/plat/arm/common/plat_acs_smc_handler.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2025, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+#ifndef ACS_SMC_HANDLER_H
+#define ACS_SMC_HANDLER_H
+
+#include <common/runtime_svc.h>
+#include <lib/utils_def.h>
+
+/* ARM ACS SMC service call */
+#define ARM_VEN_EL3_ACS_SMC_HANDLER U(0xC7000030)
+#define is_acs_fid(smc_fid) (smc_fid == ARM_VEN_EL3_ACS_SMC_HANDLER)
+
+uintptr_t plat_arm_acs_smc_handler(unsigned int smc_fid,
+ uint64_t services,
+ uint64_t arg0,
+ uint64_t arg1,
+ uint64_t arg2,
+ void *handle);
+#endif /* ACS_SMC_HANDLER_H */
diff --git a/include/services/ven_el3_svc.h b/include/services/ven_el3_svc.h
index e030b68..0336059 100644
--- a/include/services/ven_el3_svc.h
+++ b/include/services/ven_el3_svc.h
@@ -21,7 +21,7 @@
#define VEN_EL3_SVC_VERSION 0x8700ff03
#define VEN_EL3_SVC_VERSION_MAJOR 1
-#define VEN_EL3_SVC_VERSION_MINOR 0
+#define VEN_EL3_SVC_VERSION_MINOR 1
/* DEBUGFS_SMC_32 0x87000010U */
/* DEBUGFS_SMC_64 0xC7000010U */
@@ -29,4 +29,7 @@
/* PMF_SMC_GET_TIMESTAMP_32 0x87000020U */
/* PMF_SMC_GET_TIMESTAMP_64 0xC7000020U */
+/* ACS_SMC_HANDLER_32 0x87000030U */
+/* ACS_SMC_HANDLER_64 0xC7000030U */
+
#endif /* VEN_EL3_SVC_H */
diff --git a/plat/arm/common/arm_common.mk b/plat/arm/common/arm_common.mk
index 418a9d8..0532ba2 100644
--- a/plat/arm/common/arm_common.mk
+++ b/plat/arm/common/arm_common.mk
@@ -79,6 +79,15 @@
$(eval $(call assert_boolean,ARM_BL31_IN_DRAM))
$(eval $(call add_define,ARM_BL31_IN_DRAM))
+# Macro to enable ACS SMC handler
+PLAT_ARM_ACS_SMC_HANDLER := 0
+ifeq (${ENABLE_ACS_SMC}, 1)
+PLAT_ARM_ACS_SMC_HANDLER := 1
+endif
+
+# Build macro necessary for branching to ACS tests
+$(eval $(call add_define,PLAT_ARM_ACS_SMC_HANDLER))
+
# As per CCA security model, all root firmware must execute from on-chip secure
# memory. This means we must not run BL31 from TZC-protected DRAM.
ifeq (${ARM_BL31_IN_DRAM},1)
@@ -305,6 +314,11 @@
plat/arm/common/arm_topology.c \
plat/common/plat_psci_common.c
+ifeq (${PLAT_ARM_ACS_SMC_HANDLER},1)
+BL31_SOURCES += plat/arm/common/plat_acs_smc_handler.c \
+ ${VENDOR_EL3_SRCS}
+endif
+
ifeq (${TRANSFER_LIST}, 1)
include lib/transfer_list/transfer_list.mk
TRANSFER_LIST_SOURCES += plat/arm/common/arm_transfer_list.c
diff --git a/plat/arm/common/plat_acs_smc_handler.c b/plat/arm/common/plat_acs_smc_handler.c
new file mode 100644
index 0000000..6f96874
--- /dev/null
+++ b/plat/arm/common/plat_acs_smc_handler.c
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2025, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+#include <stdint.h>
+#include <plat/arm/common/plat_acs_smc_handler.h>
+
+/*
+ * Placeholder function for handling ACS SMC calls.
+ * return 0 till the handling is done.
+ */
+uintptr_t plat_arm_acs_smc_handler(unsigned int smc_fid, uint64_t services,
+ uint64_t arg0, uint64_t arg1, uint64_t arg2, void *handle)
+{
+ WARN("Unimplemented ACS Call: 0x%x\n", smc_fid);
+ SMC_RET1(handle, SMC_UNK);
+}
diff --git a/services/el3/ven_el3_svc.c b/services/el3/ven_el3_svc.c
index 32a3dc2..431bfbf 100644
--- a/services/el3/ven_el3_svc.c
+++ b/services/el3/ven_el3_svc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2024, Arm Limited and Contributors. All rights reserved.
+ * Copyright (c) 2024-2025, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -10,6 +10,9 @@
#include <common/runtime_svc.h>
#include <lib/debugfs.h>
#include <lib/pmf/pmf.h>
+#if PLAT_ARM_ACS_SMC_HANDLER
+#include <plat/arm/common/plat_acs_smc_handler.h>
+#endif /* PLAT_ARM_ACS_SMC_HANDLER */
#include <services/ven_el3_svc.h>
#include <tools_share/uuid.h>
@@ -71,6 +74,15 @@
#endif /* ENABLE_PMF */
+#if PLAT_ARM_ACS_SMC_HANDLER
+ /*
+ * Dispatch ACS calls to ACS SMC handler and return its return value
+ */
+ if (is_acs_fid(smc_fid)) {
+ return plat_arm_acs_smc_handler(smc_fid, x1, x2, x3, x4, handle);
+ }
+#endif /* PLAT_ARM_ACS_SMC_HANDLER */
+
switch (smc_fid) {
case VEN_EL3_SVC_UID:
/* Return UID to the caller */