feat(stm32mp2): add a runtime service for STGEN configuration
Other component such as OP-TEE may have the responsibility for
STGEN configuration but updating Arm CNTFRQ can only be done from
EL3. Therefore, implement a SiP SMC handler for this purpose and
a runtime service to catch SIP SMCs.
Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
Signed-off-by: Maxime Méré <maxime.mere@foss.st.com>
Change-Id: I7854e1ae6328f149798b43d52bb1ecdf71a5aa69
diff --git a/plat/st/stm32mp2/services/stm32mp2_svc_setup.c b/plat/st/stm32mp2/services/stm32mp2_svc_setup.c
index 6ead5af..1162757 100644
--- a/plat/st/stm32mp2/services/stm32mp2_svc_setup.c
+++ b/plat/st/stm32mp2/services/stm32mp2_svc_setup.c
@@ -14,6 +14,8 @@
#include <stm32mp2_smc.h>
#include <stm32mp_svc_setup.h>
+#include "stgen_svc.h"
+
/*
* Platform-level Standard Service SIP SMC handler. This handler will dispatch
* the SMC to the correct feature handler.
@@ -28,6 +30,14 @@
case STM32_SIP_SVC_CALL_COUNT:
*ret1 = STM32_COMMON_SIP_NUM_CALLS;
break;
+ case STM32_SIP_SMC_STGEN_SET_RATE:
+ if (!is_caller_secure(flags)) {
+ *ret1 = STM32_SMC_FAILED;
+ break;
+ }
+
+ *ret1 = stgen_svc_handler();
+ break;
default:
WARN("Unimplemented STM32MP2 Service Call: 0x%x\n", smc_fid);
*ret1 = STM32_SMC_NOT_SUPPORTED;