blob: f5de54966109c4c4330589a1c241cc338a4084e9 [file] [log] [blame]
Achin Gupta86f23532019-10-11 15:41:16 +01001/*
Olivier Deprezeae45962021-01-19 15:06:47 +01002 * Copyright (c) 2020-2021, ARM Limited and Contributors. All rights reserved.
Achin Gupta86f23532019-10-11 15:41:16 +01003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <assert.h>
8#include <errno.h>
Scott Brandene5dcf982020-08-25 13:49:32 -07009#include <inttypes.h>
10#include <stdint.h>
Achin Gupta86f23532019-10-11 15:41:16 +010011#include <string.h>
12
13#include <arch_helpers.h>
Olivier Deprez2bae35f2020-04-16 13:39:06 +020014#include <arch/aarch64/arch_features.h>
Achin Gupta86f23532019-10-11 15:41:16 +010015#include <bl31/bl31.h>
Olivier Depreza664c492020-08-05 11:27:42 +020016#include <bl31/interrupt_mgmt.h>
Achin Gupta86f23532019-10-11 15:41:16 +010017#include <common/debug.h>
18#include <common/runtime_svc.h>
19#include <lib/el3_runtime/context_mgmt.h>
20#include <lib/smccc.h>
21#include <lib/spinlock.h>
22#include <lib/utils.h>
Achin Gupta86f23532019-10-11 15:41:16 +010023#include <plat/common/common_def.h>
24#include <plat/common/platform.h>
25#include <platform_def.h>
J-Alves2672cde2020-05-07 18:42:25 +010026#include <services/ffa_svc.h>
Achin Gupta86f23532019-10-11 15:41:16 +010027#include <services/spmd_svc.h>
28#include <smccc_helpers.h>
29#include "spmd_private.h"
30
31/*******************************************************************************
32 * SPM Core context information.
33 ******************************************************************************/
Olivier Deprez2bae35f2020-04-16 13:39:06 +020034static spmd_spm_core_context_t spm_core_context[PLATFORM_CORE_COUNT];
Achin Gupta86f23532019-10-11 15:41:16 +010035
36/*******************************************************************************
37 * SPM Core attribute information read from its manifest.
38 ******************************************************************************/
Olivier Deprez2bae35f2020-04-16 13:39:06 +020039static spmc_manifest_attribute_t spmc_attrs;
Achin Gupta86f23532019-10-11 15:41:16 +010040
41/*******************************************************************************
Max Shvetsov745889c2020-02-27 14:54:21 +000042 * SPM Core entry point information. Discovered on the primary core and reused
43 * on secondary cores.
44 ******************************************************************************/
45static entry_point_info_t *spmc_ep_info;
46
47/*******************************************************************************
Olivier Deprez73ef0dc2020-06-19 15:33:41 +020048 * SPM Core context on CPU based on mpidr.
49 ******************************************************************************/
50spmd_spm_core_context_t *spmd_get_context_by_mpidr(uint64_t mpidr)
51{
Max Shvetsovf80c64d2020-08-25 11:50:18 +010052 int core_idx = plat_core_pos_by_mpidr(mpidr);
53
54 if (core_idx < 0) {
Scott Brandene5dcf982020-08-25 13:49:32 -070055 ERROR("Invalid mpidr: %" PRIx64 ", returned ID: %d\n", mpidr, core_idx);
Max Shvetsovf80c64d2020-08-25 11:50:18 +010056 panic();
57 }
58
59 return &spm_core_context[core_idx];
Olivier Deprez73ef0dc2020-06-19 15:33:41 +020060}
61
62/*******************************************************************************
Olivier Deprez2bae35f2020-04-16 13:39:06 +020063 * SPM Core context on current CPU get helper.
64 ******************************************************************************/
65spmd_spm_core_context_t *spmd_get_context(void)
66{
Olivier Deprez73ef0dc2020-06-19 15:33:41 +020067 return spmd_get_context_by_mpidr(read_mpidr());
Olivier Deprez2bae35f2020-04-16 13:39:06 +020068}
69
70/*******************************************************************************
Olivier Deprezc7631a52020-03-23 09:53:06 +010071 * SPM Core ID getter.
72 ******************************************************************************/
73uint16_t spmd_spmc_id_get(void)
74{
75 return spmc_attrs.spmc_id;
76}
77
78/*******************************************************************************
Max Shvetsov745889c2020-02-27 14:54:21 +000079 * Static function declaration.
80 ******************************************************************************/
Olivier Deprez2bae35f2020-04-16 13:39:06 +020081static int32_t spmd_init(void);
Olivier Deprez69ca84a2020-02-07 15:44:43 +010082static int spmd_spmc_init(void *pm_addr);
J-Alves2672cde2020-05-07 18:42:25 +010083static uint64_t spmd_ffa_error_return(void *handle,
Olivier Deprez2bae35f2020-04-16 13:39:06 +020084 int error_code);
85static uint64_t spmd_smc_forward(uint32_t smc_fid,
86 bool secure_origin,
87 uint64_t x1,
88 uint64_t x2,
89 uint64_t x3,
90 uint64_t x4,
91 void *handle);
Max Shvetsov745889c2020-02-27 14:54:21 +000092
93/*******************************************************************************
Olivier Deprez2bae35f2020-04-16 13:39:06 +020094 * This function takes an SPMC context pointer and performs a synchronous
95 * SPMC entry.
Achin Gupta86f23532019-10-11 15:41:16 +010096 ******************************************************************************/
97uint64_t spmd_spm_core_sync_entry(spmd_spm_core_context_t *spmc_ctx)
98{
99 uint64_t rc;
100
101 assert(spmc_ctx != NULL);
102
103 cm_set_context(&(spmc_ctx->cpu_ctx), SECURE);
104
105 /* Restore the context assigned above */
Max Shvetsove7fd80e2020-02-25 13:55:00 +0000106#if SPMD_SPM_AT_SEL2
Max Shvetsovbdf502d2020-02-25 13:56:19 +0000107 cm_el2_sysregs_context_restore(SECURE);
Olivier Deprez9a2e5be2021-05-21 18:00:04 +0200108#else
109 cm_el1_sysregs_context_restore(SECURE);
Max Shvetsove7fd80e2020-02-25 13:55:00 +0000110#endif
Achin Gupta86f23532019-10-11 15:41:16 +0100111 cm_set_next_eret_context(SECURE);
112
Max Shvetsove7fd80e2020-02-25 13:55:00 +0000113 /* Enter SPMC */
Achin Gupta86f23532019-10-11 15:41:16 +0100114 rc = spmd_spm_core_enter(&spmc_ctx->c_rt_ctx);
115
116 /* Save secure state */
Max Shvetsove7fd80e2020-02-25 13:55:00 +0000117#if SPMD_SPM_AT_SEL2
Max Shvetsovbdf502d2020-02-25 13:56:19 +0000118 cm_el2_sysregs_context_save(SECURE);
Olivier Deprez9a2e5be2021-05-21 18:00:04 +0200119#else
120 cm_el1_sysregs_context_save(SECURE);
Max Shvetsove7fd80e2020-02-25 13:55:00 +0000121#endif
Achin Gupta86f23532019-10-11 15:41:16 +0100122
123 return rc;
124}
125
126/*******************************************************************************
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200127 * This function returns to the place where spmd_spm_core_sync_entry() was
Achin Gupta86f23532019-10-11 15:41:16 +0100128 * called originally.
129 ******************************************************************************/
130__dead2 void spmd_spm_core_sync_exit(uint64_t rc)
131{
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200132 spmd_spm_core_context_t *ctx = spmd_get_context();
Achin Gupta86f23532019-10-11 15:41:16 +0100133
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200134 /* Get current CPU context from SPMC context */
Achin Gupta86f23532019-10-11 15:41:16 +0100135 assert(cm_get_context(SECURE) == &(ctx->cpu_ctx));
136
137 /*
138 * The SPMD must have initiated the original request through a
139 * synchronous entry into SPMC. Jump back to the original C runtime
140 * context with the value of rc in x0;
141 */
142 spmd_spm_core_exit(ctx->c_rt_ctx, rc);
143
144 panic();
145}
146
147/*******************************************************************************
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200148 * Jump to the SPM Core for the first time.
Achin Gupta86f23532019-10-11 15:41:16 +0100149 ******************************************************************************/
150static int32_t spmd_init(void)
151{
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200152 spmd_spm_core_context_t *ctx = spmd_get_context();
153 uint64_t rc;
Achin Gupta86f23532019-10-11 15:41:16 +0100154
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200155 VERBOSE("SPM Core init start.\n");
Olivier Deprez7c016332019-10-28 09:03:13 +0000156
Olivier Deprez4ab7a4a2021-06-21 09:47:13 +0200157 /* Primary boot core enters the SPMC for initialization. */
158 ctx->state = SPMC_STATE_ON_PENDING;
Achin Gupta86f23532019-10-11 15:41:16 +0100159
160 rc = spmd_spm_core_sync_entry(ctx);
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200161 if (rc != 0ULL) {
Scott Brandene5dcf982020-08-25 13:49:32 -0700162 ERROR("SPMC initialisation failed 0x%" PRIx64 "\n", rc);
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200163 return 0;
Achin Gupta86f23532019-10-11 15:41:16 +0100164 }
165
Olivier Deprez7c016332019-10-28 09:03:13 +0000166 ctx->state = SPMC_STATE_ON;
167
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200168 VERBOSE("SPM Core init end.\n");
Achin Gupta86f23532019-10-11 15:41:16 +0100169
170 return 1;
171}
172
173/*******************************************************************************
Olivier Depreza664c492020-08-05 11:27:42 +0200174 * spmd_secure_interrupt_handler
175 * Enter the SPMC for further handling of the secure interrupt by the SPMC
176 * itself or a Secure Partition.
177 ******************************************************************************/
178static uint64_t spmd_secure_interrupt_handler(uint32_t id,
179 uint32_t flags,
180 void *handle,
181 void *cookie)
182{
183 spmd_spm_core_context_t *ctx = spmd_get_context();
184 gp_regs_t *gpregs = get_gpregs_ctx(&ctx->cpu_ctx);
185 unsigned int linear_id = plat_my_core_pos();
186 int64_t rc;
187
188 /* Sanity check the security state when the exception was generated */
189 assert(get_interrupt_src_ss(flags) == NON_SECURE);
190
191 /* Sanity check the pointer to this cpu's context */
192 assert(handle == cm_get_context(NON_SECURE));
193
194 /* Save the non-secure context before entering SPMC */
195 cm_el1_sysregs_context_save(NON_SECURE);
196#if SPMD_SPM_AT_SEL2
197 cm_el2_sysregs_context_save(NON_SECURE);
198#endif
199
200 /* Convey the event to the SPMC through the FFA_INTERRUPT interface. */
201 write_ctx_reg(gpregs, CTX_GPREG_X0, FFA_INTERRUPT);
202 write_ctx_reg(gpregs, CTX_GPREG_X1, 0);
203 write_ctx_reg(gpregs, CTX_GPREG_X2, 0);
204 write_ctx_reg(gpregs, CTX_GPREG_X3, 0);
205 write_ctx_reg(gpregs, CTX_GPREG_X4, 0);
206 write_ctx_reg(gpregs, CTX_GPREG_X5, 0);
207 write_ctx_reg(gpregs, CTX_GPREG_X6, 0);
208 write_ctx_reg(gpregs, CTX_GPREG_X7, 0);
209
210 /* Mark current core as handling a secure interrupt. */
211 ctx->secure_interrupt_ongoing = true;
212
213 rc = spmd_spm_core_sync_entry(ctx);
214 if (rc != 0ULL) {
Olivier Deprezba100f22021-11-09 12:37:20 +0100215 ERROR("%s failed (%" PRId64 ") on CPU%u\n", __func__, rc, linear_id);
Olivier Depreza664c492020-08-05 11:27:42 +0200216 }
217
218 ctx->secure_interrupt_ongoing = false;
219
220 cm_el1_sysregs_context_restore(NON_SECURE);
221#if SPMD_SPM_AT_SEL2
222 cm_el2_sysregs_context_restore(NON_SECURE);
223#endif
224 cm_set_next_eret_context(NON_SECURE);
225
226 SMC_RET0(&ctx->cpu_ctx);
227}
228
229/*******************************************************************************
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200230 * Loads SPMC manifest and inits SPMC.
Achin Gupta86f23532019-10-11 15:41:16 +0100231 ******************************************************************************/
Olivier Deprez69ca84a2020-02-07 15:44:43 +0100232static int spmd_spmc_init(void *pm_addr)
Achin Gupta86f23532019-10-11 15:41:16 +0100233{
Olivier Deprez4ab7a4a2021-06-21 09:47:13 +0200234 cpu_context_t *cpu_ctx;
235 unsigned int core_id;
Olivier Depreza664c492020-08-05 11:27:42 +0200236 uint32_t ep_attr, flags;
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200237 int rc;
Achin Gupta86f23532019-10-11 15:41:16 +0100238
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200239 /* Load the SPM Core manifest */
Olivier Deprez69ca84a2020-02-07 15:44:43 +0100240 rc = plat_spm_core_manifest_load(&spmc_attrs, pm_addr);
Max Shvetsov745889c2020-02-27 14:54:21 +0000241 if (rc != 0) {
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200242 WARN("No or invalid SPM Core manifest image provided by BL2\n");
243 return rc;
Achin Gupta86f23532019-10-11 15:41:16 +0100244 }
245
246 /*
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200247 * Ensure that the SPM Core version is compatible with the SPM
248 * Dispatcher version.
Achin Gupta86f23532019-10-11 15:41:16 +0100249 */
J-Alves2672cde2020-05-07 18:42:25 +0100250 if ((spmc_attrs.major_version != FFA_VERSION_MAJOR) ||
251 (spmc_attrs.minor_version > FFA_VERSION_MINOR)) {
252 WARN("Unsupported FFA version (%u.%u)\n",
Achin Gupta86f23532019-10-11 15:41:16 +0100253 spmc_attrs.major_version, spmc_attrs.minor_version);
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200254 return -EINVAL;
Achin Gupta86f23532019-10-11 15:41:16 +0100255 }
256
J-Alves2672cde2020-05-07 18:42:25 +0100257 VERBOSE("FFA version (%u.%u)\n", spmc_attrs.major_version,
Achin Gupta86f23532019-10-11 15:41:16 +0100258 spmc_attrs.minor_version);
259
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200260 VERBOSE("SPM Core run time EL%x.\n",
Max Shvetsove7fd80e2020-02-25 13:55:00 +0000261 SPMD_SPM_AT_SEL2 ? MODE_EL2 : MODE_EL1);
Achin Gupta86f23532019-10-11 15:41:16 +0100262
Max Shvetsove79062e2020-03-12 15:16:40 +0000263 /* Validate the SPMC ID, Ensure high bit is set */
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200264 if (((spmc_attrs.spmc_id >> SPMC_SECURE_ID_SHIFT) &
265 SPMC_SECURE_ID_MASK) == 0U) {
266 WARN("Invalid ID (0x%x) for SPMC.\n", spmc_attrs.spmc_id);
267 return -EINVAL;
Max Shvetsove79062e2020-03-12 15:16:40 +0000268 }
269
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200270 /* Validate the SPM Core execution state */
Achin Gupta86f23532019-10-11 15:41:16 +0100271 if ((spmc_attrs.exec_state != MODE_RW_64) &&
272 (spmc_attrs.exec_state != MODE_RW_32)) {
Olivier Deprez69ca84a2020-02-07 15:44:43 +0100273 WARN("Unsupported %s%x.\n", "SPM Core execution state 0x",
Achin Gupta86f23532019-10-11 15:41:16 +0100274 spmc_attrs.exec_state);
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200275 return -EINVAL;
Achin Gupta86f23532019-10-11 15:41:16 +0100276 }
277
Olivier Deprez69ca84a2020-02-07 15:44:43 +0100278 VERBOSE("%s%x.\n", "SPM Core execution state 0x",
279 spmc_attrs.exec_state);
Achin Gupta86f23532019-10-11 15:41:16 +0100280
Max Shvetsove7fd80e2020-02-25 13:55:00 +0000281#if SPMD_SPM_AT_SEL2
282 /* Ensure manifest has not requested AArch32 state in S-EL2 */
283 if (spmc_attrs.exec_state == MODE_RW_32) {
284 WARN("AArch32 state at S-EL2 is not supported.\n");
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200285 return -EINVAL;
Achin Gupta86f23532019-10-11 15:41:16 +0100286 }
287
288 /*
289 * Check if S-EL2 is supported on this system if S-EL2
290 * is required for SPM
291 */
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200292 if (!is_armv8_4_sel2_present()) {
293 WARN("SPM Core run time S-EL2 is not supported.\n");
294 return -EINVAL;
Achin Gupta86f23532019-10-11 15:41:16 +0100295 }
Max Shvetsove7fd80e2020-02-25 13:55:00 +0000296#endif /* SPMD_SPM_AT_SEL2 */
Achin Gupta86f23532019-10-11 15:41:16 +0100297
298 /* Initialise an entrypoint to set up the CPU context */
299 ep_attr = SECURE | EP_ST_ENABLE;
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200300 if ((read_sctlr_el3() & SCTLR_EE_BIT) != 0ULL) {
Achin Gupta86f23532019-10-11 15:41:16 +0100301 ep_attr |= EP_EE_BIG;
Max Shvetsov745889c2020-02-27 14:54:21 +0000302 }
303
Achin Gupta86f23532019-10-11 15:41:16 +0100304 SET_PARAM_HEAD(spmc_ep_info, PARAM_EP, VERSION_1, ep_attr);
Achin Gupta86f23532019-10-11 15:41:16 +0100305
306 /*
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200307 * Populate SPSR for SPM Core based upon validated parameters from the
308 * manifest.
Achin Gupta86f23532019-10-11 15:41:16 +0100309 */
310 if (spmc_attrs.exec_state == MODE_RW_32) {
311 spmc_ep_info->spsr = SPSR_MODE32(MODE32_svc, SPSR_T_ARM,
312 SPSR_E_LITTLE,
313 DAIF_FIQ_BIT |
314 DAIF_IRQ_BIT |
315 DAIF_ABT_BIT);
316 } else {
Max Shvetsove7fd80e2020-02-25 13:55:00 +0000317
318#if SPMD_SPM_AT_SEL2
319 static const uint32_t runtime_el = MODE_EL2;
320#else
321 static const uint32_t runtime_el = MODE_EL1;
322#endif
323 spmc_ep_info->spsr = SPSR_64(runtime_el,
Achin Gupta86f23532019-10-11 15:41:16 +0100324 MODE_SP_ELX,
325 DISABLE_ALL_EXCEPTIONS);
326 }
327
Olivier Deprez4ab7a4a2021-06-21 09:47:13 +0200328 /* Set an initial SPMC context state for all cores. */
329 for (core_id = 0U; core_id < PLATFORM_CORE_COUNT; core_id++) {
330 spm_core_context[core_id].state = SPMC_STATE_OFF;
Max Shvetsov745889c2020-02-27 14:54:21 +0000331
Olivier Deprez4ab7a4a2021-06-21 09:47:13 +0200332 /* Setup an initial cpu context for the SPMC. */
333 cpu_ctx = &spm_core_context[core_id].cpu_ctx;
334 cm_setup_context(cpu_ctx, spmc_ep_info);
Achin Gupta86f23532019-10-11 15:41:16 +0100335
Olivier Deprez4ab7a4a2021-06-21 09:47:13 +0200336 /*
337 * Pass the core linear ID to the SPMC through x4.
338 * (TF-A implementation defined behavior helping
339 * a legacy TOS migration to adopt FF-A).
340 */
341 write_ctx_reg(get_gpregs_ctx(cpu_ctx), CTX_GPREG_X4, core_id);
342 }
Achin Gupta86f23532019-10-11 15:41:16 +0100343
Olivier Deprez9afca122019-10-28 09:15:52 +0000344 /* Register power management hooks with PSCI */
345 psci_register_spd_pm_hook(&spmd_pm);
346
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200347 /* Register init function for deferred init. */
Achin Gupta86f23532019-10-11 15:41:16 +0100348 bl31_register_bl32_init(&spmd_init);
349
Olivier Deprez4ab7a4a2021-06-21 09:47:13 +0200350 INFO("SPM Core setup done.\n");
351
Olivier Depreza664c492020-08-05 11:27:42 +0200352 /*
353 * Register an interrupt handler routing secure interrupts to SPMD
354 * while the NWd is running.
355 */
356 flags = 0;
357 set_interrupt_rm_flag(flags, NON_SECURE);
358 rc = register_interrupt_type_handler(INTR_TYPE_S_EL1,
359 spmd_secure_interrupt_handler,
360 flags);
361 if (rc != 0) {
362 panic();
363 }
364
Achin Gupta86f23532019-10-11 15:41:16 +0100365 return 0;
Max Shvetsov745889c2020-02-27 14:54:21 +0000366}
Achin Gupta86f23532019-10-11 15:41:16 +0100367
Max Shvetsov745889c2020-02-27 14:54:21 +0000368/*******************************************************************************
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200369 * Initialize context of SPM Core.
Max Shvetsov745889c2020-02-27 14:54:21 +0000370 ******************************************************************************/
371int spmd_setup(void)
372{
Olivier Deprez69ca84a2020-02-07 15:44:43 +0100373 void *spmc_manifest;
Max Shvetsov745889c2020-02-27 14:54:21 +0000374 int rc;
Achin Gupta86f23532019-10-11 15:41:16 +0100375
Max Shvetsov745889c2020-02-27 14:54:21 +0000376 spmc_ep_info = bl31_plat_get_next_image_ep_info(SECURE);
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200377 if (spmc_ep_info == NULL) {
378 WARN("No SPM Core image provided by BL2 boot loader.\n");
379 return -EINVAL;
Max Shvetsov745889c2020-02-27 14:54:21 +0000380 }
381
382 /* Under no circumstances will this parameter be 0 */
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200383 assert(spmc_ep_info->pc != 0ULL);
Max Shvetsov745889c2020-02-27 14:54:21 +0000384
385 /*
386 * Check if BL32 ep_info has a reference to 'tos_fw_config'. This will
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200387 * be used as a manifest for the SPM Core at the next lower EL/mode.
Max Shvetsov745889c2020-02-27 14:54:21 +0000388 */
Olivier Deprez69ca84a2020-02-07 15:44:43 +0100389 spmc_manifest = (void *)spmc_ep_info->args.arg0;
390 if (spmc_manifest == NULL) {
391 ERROR("Invalid or absent SPM Core manifest.\n");
392 return -EINVAL;
Max Shvetsov745889c2020-02-27 14:54:21 +0000393 }
394
395 /* Load manifest, init SPMC */
Olivier Deprez69ca84a2020-02-07 15:44:43 +0100396 rc = spmd_spmc_init(spmc_manifest);
Max Shvetsov745889c2020-02-27 14:54:21 +0000397 if (rc != 0) {
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200398 WARN("Booting device without SPM initialization.\n");
Max Shvetsov745889c2020-02-27 14:54:21 +0000399 }
400
Olivier Deprez69ca84a2020-02-07 15:44:43 +0100401 return rc;
Max Shvetsov745889c2020-02-27 14:54:21 +0000402}
403
404/*******************************************************************************
405 * Forward SMC to the other security state
406 ******************************************************************************/
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200407static uint64_t spmd_smc_forward(uint32_t smc_fid,
408 bool secure_origin,
409 uint64_t x1,
410 uint64_t x2,
411 uint64_t x3,
412 uint64_t x4,
413 void *handle)
Max Shvetsov745889c2020-02-27 14:54:21 +0000414{
Olivier Deprezebc34772020-04-16 16:59:21 +0200415 unsigned int secure_state_in = (secure_origin) ? SECURE : NON_SECURE;
416 unsigned int secure_state_out = (!secure_origin) ? SECURE : NON_SECURE;
Olivier Deprez41ff36a2019-12-23 16:21:12 +0100417
Max Shvetsov745889c2020-02-27 14:54:21 +0000418 /* Save incoming security state */
Max Shvetsove7fd80e2020-02-25 13:55:00 +0000419#if SPMD_SPM_AT_SEL2
Olivier Deprez9a2e5be2021-05-21 18:00:04 +0200420 if (secure_state_in == NON_SECURE) {
421 cm_el1_sysregs_context_save(secure_state_in);
422 }
Olivier Deprez41ff36a2019-12-23 16:21:12 +0100423 cm_el2_sysregs_context_save(secure_state_in);
Olivier Deprez9a2e5be2021-05-21 18:00:04 +0200424#else
425 cm_el1_sysregs_context_save(secure_state_in);
Max Shvetsove7fd80e2020-02-25 13:55:00 +0000426#endif
Max Shvetsov745889c2020-02-27 14:54:21 +0000427
428 /* Restore outgoing security state */
Max Shvetsove7fd80e2020-02-25 13:55:00 +0000429#if SPMD_SPM_AT_SEL2
Olivier Deprez9a2e5be2021-05-21 18:00:04 +0200430 if (secure_state_out == NON_SECURE) {
431 cm_el1_sysregs_context_restore(secure_state_out);
432 }
Olivier Deprez41ff36a2019-12-23 16:21:12 +0100433 cm_el2_sysregs_context_restore(secure_state_out);
Olivier Deprez9a2e5be2021-05-21 18:00:04 +0200434#else
435 cm_el1_sysregs_context_restore(secure_state_out);
Max Shvetsove7fd80e2020-02-25 13:55:00 +0000436#endif
Olivier Deprez41ff36a2019-12-23 16:21:12 +0100437 cm_set_next_eret_context(secure_state_out);
Max Shvetsov745889c2020-02-27 14:54:21 +0000438
Olivier Deprez41ff36a2019-12-23 16:21:12 +0100439 SMC_RET8(cm_get_context(secure_state_out), smc_fid, x1, x2, x3, x4,
Max Shvetsov745889c2020-02-27 14:54:21 +0000440 SMC_GET_GP(handle, CTX_GPREG_X5),
441 SMC_GET_GP(handle, CTX_GPREG_X6),
442 SMC_GET_GP(handle, CTX_GPREG_X7));
443}
444
445/*******************************************************************************
J-Alves2672cde2020-05-07 18:42:25 +0100446 * Return FFA_ERROR with specified error code
Max Shvetsov745889c2020-02-27 14:54:21 +0000447 ******************************************************************************/
J-Alves2672cde2020-05-07 18:42:25 +0100448static uint64_t spmd_ffa_error_return(void *handle, int error_code)
Max Shvetsov745889c2020-02-27 14:54:21 +0000449{
J-Alves64ff9932021-03-01 10:26:59 +0000450 SMC_RET8(handle, (uint32_t) FFA_ERROR,
451 FFA_TARGET_INFO_MBZ, (uint32_t)error_code,
J-Alves2672cde2020-05-07 18:42:25 +0100452 FFA_PARAM_MBZ, FFA_PARAM_MBZ, FFA_PARAM_MBZ,
453 FFA_PARAM_MBZ, FFA_PARAM_MBZ);
Achin Gupta86f23532019-10-11 15:41:16 +0100454}
455
Olivier Deprez33e44122020-04-16 17:54:27 +0200456/*******************************************************************************
457 * spmd_check_address_in_binary_image
458 ******************************************************************************/
459bool spmd_check_address_in_binary_image(uint64_t address)
460{
461 assert(!check_uptr_overflow(spmc_attrs.load_address, spmc_attrs.binary_size));
462
463 return ((address >= spmc_attrs.load_address) &&
464 (address < (spmc_attrs.load_address + spmc_attrs.binary_size)));
465}
466
Olivier Deprezebc34772020-04-16 16:59:21 +0200467/******************************************************************************
468 * spmd_is_spmc_message
469 *****************************************************************************/
470static bool spmd_is_spmc_message(unsigned int ep)
471{
472 return ((ffa_endpoint_destination(ep) == SPMD_DIRECT_MSG_ENDPOINT_ID)
473 && (ffa_endpoint_source(ep) == spmc_attrs.spmc_id));
474}
475
Olivier Deprez33e44122020-04-16 17:54:27 +0200476/******************************************************************************
477 * spmd_handle_spmc_message
478 *****************************************************************************/
Olivier Deprezc7631a52020-03-23 09:53:06 +0100479static int spmd_handle_spmc_message(unsigned long long msg,
480 unsigned long long parm1, unsigned long long parm2,
481 unsigned long long parm3, unsigned long long parm4)
Olivier Deprez33e44122020-04-16 17:54:27 +0200482{
483 VERBOSE("%s %llx %llx %llx %llx %llx\n", __func__,
484 msg, parm1, parm2, parm3, parm4);
485
Olivier Deprez33e44122020-04-16 17:54:27 +0200486 return -EINVAL;
487}
488
Achin Gupta86f23532019-10-11 15:41:16 +0100489/*******************************************************************************
J-Alves2672cde2020-05-07 18:42:25 +0100490 * This function handles all SMCs in the range reserved for FFA. Each call is
Achin Gupta86f23532019-10-11 15:41:16 +0100491 * either forwarded to the other security state or handled by the SPM dispatcher
492 ******************************************************************************/
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200493uint64_t spmd_smc_handler(uint32_t smc_fid,
494 uint64_t x1,
495 uint64_t x2,
496 uint64_t x3,
497 uint64_t x4,
498 void *cookie,
499 void *handle,
Achin Gupta86f23532019-10-11 15:41:16 +0100500 uint64_t flags)
501{
Olivier Deprezeae45962021-01-19 15:06:47 +0100502 unsigned int linear_id = plat_my_core_pos();
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200503 spmd_spm_core_context_t *ctx = spmd_get_context();
Olivier Deprez41ff36a2019-12-23 16:21:12 +0100504 bool secure_origin;
505 int32_t ret;
J-Alves4c95c702020-05-26 14:03:05 +0100506 uint32_t input_version;
Achin Gupta86f23532019-10-11 15:41:16 +0100507
508 /* Determine which security state this SMC originated from */
Olivier Deprez41ff36a2019-12-23 16:21:12 +0100509 secure_origin = is_caller_secure(flags);
Achin Gupta86f23532019-10-11 15:41:16 +0100510
Scott Brandene5dcf982020-08-25 13:49:32 -0700511 VERBOSE("SPM(%u): 0x%x 0x%" PRIx64 " 0x%" PRIx64 " 0x%" PRIx64 " 0x%" PRIx64
512 " 0x%" PRIx64 " 0x%" PRIx64 " 0x%" PRIx64 "\n",
513 linear_id, smc_fid, x1, x2, x3, x4,
514 SMC_GET_GP(handle, CTX_GPREG_X5),
515 SMC_GET_GP(handle, CTX_GPREG_X6),
516 SMC_GET_GP(handle, CTX_GPREG_X7));
Achin Gupta86f23532019-10-11 15:41:16 +0100517
518 switch (smc_fid) {
J-Alves2672cde2020-05-07 18:42:25 +0100519 case FFA_ERROR:
Achin Gupta86f23532019-10-11 15:41:16 +0100520 /*
521 * Check if this is the first invocation of this interface on
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200522 * this CPU. If so, then indicate that the SPM Core initialised
Achin Gupta86f23532019-10-11 15:41:16 +0100523 * unsuccessfully.
524 */
Olivier Deprez7c016332019-10-28 09:03:13 +0000525 if (secure_origin && (ctx->state == SPMC_STATE_ON_PENDING)) {
Achin Gupta86f23532019-10-11 15:41:16 +0100526 spmd_spm_core_sync_exit(x2);
Max Shvetsov745889c2020-02-27 14:54:21 +0000527 }
Achin Gupta86f23532019-10-11 15:41:16 +0100528
Olivier Deprez41ff36a2019-12-23 16:21:12 +0100529 return spmd_smc_forward(smc_fid, secure_origin,
Max Shvetsov745889c2020-02-27 14:54:21 +0000530 x1, x2, x3, x4, handle);
Achin Gupta86f23532019-10-11 15:41:16 +0100531 break; /* not reached */
532
J-Alves2672cde2020-05-07 18:42:25 +0100533 case FFA_VERSION:
J-Alves4c95c702020-05-26 14:03:05 +0100534 input_version = (uint32_t)(0xFFFFFFFF & x1);
Achin Gupta86f23532019-10-11 15:41:16 +0100535 /*
J-Alves4c95c702020-05-26 14:03:05 +0100536 * If caller is secure and SPMC was initialized,
537 * return FFA_VERSION of SPMD.
538 * If caller is non secure and SPMC was initialized,
539 * return SPMC's version.
540 * Sanity check to "input_version".
Achin Gupta86f23532019-10-11 15:41:16 +0100541 */
J-Alves4c95c702020-05-26 14:03:05 +0100542 if ((input_version & FFA_VERSION_BIT31_MASK) ||
543 (ctx->state == SPMC_STATE_RESET)) {
544 ret = FFA_ERROR_NOT_SUPPORTED;
545 } else if (!secure_origin) {
J-Alves64ff9932021-03-01 10:26:59 +0000546 ret = MAKE_FFA_VERSION(spmc_attrs.major_version,
547 spmc_attrs.minor_version);
J-Alves4c95c702020-05-26 14:03:05 +0100548 } else {
J-Alves64ff9932021-03-01 10:26:59 +0000549 ret = MAKE_FFA_VERSION(FFA_VERSION_MAJOR,
550 FFA_VERSION_MINOR);
J-Alves4c95c702020-05-26 14:03:05 +0100551 }
552
J-Alves64ff9932021-03-01 10:26:59 +0000553 SMC_RET8(handle, (uint32_t)ret, FFA_TARGET_INFO_MBZ,
554 FFA_TARGET_INFO_MBZ, FFA_PARAM_MBZ, FFA_PARAM_MBZ,
555 FFA_PARAM_MBZ, FFA_PARAM_MBZ, FFA_PARAM_MBZ);
Achin Gupta86f23532019-10-11 15:41:16 +0100556 break; /* not reached */
557
J-Alves2672cde2020-05-07 18:42:25 +0100558 case FFA_FEATURES:
Achin Gupta86f23532019-10-11 15:41:16 +0100559 /*
560 * This is an optional interface. Do the minimal checks and
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200561 * forward to SPM Core which will handle it if implemented.
Achin Gupta86f23532019-10-11 15:41:16 +0100562 */
563
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200564 /* Forward SMC from Normal world to the SPM Core */
Olivier Deprez41ff36a2019-12-23 16:21:12 +0100565 if (!secure_origin) {
566 return spmd_smc_forward(smc_fid, secure_origin,
Max Shvetsov745889c2020-02-27 14:54:21 +0000567 x1, x2, x3, x4, handle);
Achin Gupta86f23532019-10-11 15:41:16 +0100568 }
Max Shvetsov745889c2020-02-27 14:54:21 +0000569
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200570 /*
571 * Return success if call was from secure world i.e. all
J-Alves2672cde2020-05-07 18:42:25 +0100572 * FFA functions are supported. This is essentially a
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200573 * nop.
574 */
J-Alves2672cde2020-05-07 18:42:25 +0100575 SMC_RET8(handle, FFA_SUCCESS_SMC32, x1, x2, x3, x4,
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200576 SMC_GET_GP(handle, CTX_GPREG_X5),
577 SMC_GET_GP(handle, CTX_GPREG_X6),
578 SMC_GET_GP(handle, CTX_GPREG_X7));
579
Achin Gupta86f23532019-10-11 15:41:16 +0100580 break; /* not reached */
581
J-Alves2672cde2020-05-07 18:42:25 +0100582 case FFA_ID_GET:
Max Shvetsove79062e2020-03-12 15:16:40 +0000583 /*
J-Alves2672cde2020-05-07 18:42:25 +0100584 * Returns the ID of the calling FFA component.
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200585 */
Max Shvetsove79062e2020-03-12 15:16:40 +0000586 if (!secure_origin) {
J-Alves2672cde2020-05-07 18:42:25 +0100587 SMC_RET8(handle, FFA_SUCCESS_SMC32,
588 FFA_TARGET_INFO_MBZ, FFA_NS_ENDPOINT_ID,
589 FFA_PARAM_MBZ, FFA_PARAM_MBZ,
590 FFA_PARAM_MBZ, FFA_PARAM_MBZ,
591 FFA_PARAM_MBZ);
Max Shvetsove79062e2020-03-12 15:16:40 +0000592 }
593
J-Alves2672cde2020-05-07 18:42:25 +0100594 SMC_RET8(handle, FFA_SUCCESS_SMC32,
595 FFA_TARGET_INFO_MBZ, spmc_attrs.spmc_id,
596 FFA_PARAM_MBZ, FFA_PARAM_MBZ,
597 FFA_PARAM_MBZ, FFA_PARAM_MBZ,
598 FFA_PARAM_MBZ);
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200599
Max Shvetsove79062e2020-03-12 15:16:40 +0000600 break; /* not reached */
601
Olivier Deprezeae45962021-01-19 15:06:47 +0100602 case FFA_SECONDARY_EP_REGISTER_SMC64:
603 if (secure_origin) {
604 ret = spmd_pm_secondary_ep_register(x1);
605
606 if (ret < 0) {
607 SMC_RET8(handle, FFA_ERROR_SMC64,
608 FFA_TARGET_INFO_MBZ, ret,
609 FFA_PARAM_MBZ, FFA_PARAM_MBZ,
610 FFA_PARAM_MBZ, FFA_PARAM_MBZ,
611 FFA_PARAM_MBZ);
612 } else {
613 SMC_RET8(handle, FFA_SUCCESS_SMC64,
614 FFA_TARGET_INFO_MBZ, FFA_PARAM_MBZ,
615 FFA_PARAM_MBZ, FFA_PARAM_MBZ,
616 FFA_PARAM_MBZ, FFA_PARAM_MBZ,
617 FFA_PARAM_MBZ);
618 }
619 }
620
621 return spmd_ffa_error_return(handle, FFA_ERROR_NOT_SUPPORTED);
622 break; /* Not reached */
623
Daniel Boulby27f35df2021-02-03 12:13:19 +0000624 case FFA_SPM_ID_GET:
625 if (MAKE_FFA_VERSION(1, 1) > FFA_VERSION_COMPILED) {
626 return spmd_ffa_error_return(handle,
627 FFA_ERROR_NOT_SUPPORTED);
628 }
629 /*
630 * Returns the ID of the SPMC or SPMD depending on the FF-A
631 * instance where this function is invoked
632 */
633 if (!secure_origin) {
634 SMC_RET8(handle, FFA_SUCCESS_SMC32,
635 FFA_TARGET_INFO_MBZ, spmc_attrs.spmc_id,
636 FFA_PARAM_MBZ, FFA_PARAM_MBZ,
637 FFA_PARAM_MBZ, FFA_PARAM_MBZ,
638 FFA_PARAM_MBZ);
639 }
640 SMC_RET8(handle, FFA_SUCCESS_SMC32,
641 FFA_TARGET_INFO_MBZ, SPMD_DIRECT_MSG_ENDPOINT_ID,
642 FFA_PARAM_MBZ, FFA_PARAM_MBZ,
643 FFA_PARAM_MBZ, FFA_PARAM_MBZ,
644 FFA_PARAM_MBZ);
645
646 break; /* not reached */
647
Olivier Deprez33e44122020-04-16 17:54:27 +0200648 case FFA_MSG_SEND_DIRECT_REQ_SMC32:
649 if (secure_origin && spmd_is_spmc_message(x1)) {
650 ret = spmd_handle_spmc_message(x3, x4,
651 SMC_GET_GP(handle, CTX_GPREG_X5),
652 SMC_GET_GP(handle, CTX_GPREG_X6),
653 SMC_GET_GP(handle, CTX_GPREG_X7));
654
655 SMC_RET8(handle, FFA_SUCCESS_SMC32,
656 FFA_TARGET_INFO_MBZ, ret,
657 FFA_PARAM_MBZ, FFA_PARAM_MBZ,
658 FFA_PARAM_MBZ, FFA_PARAM_MBZ,
659 FFA_PARAM_MBZ);
660 } else {
661 /* Forward direct message to the other world */
662 return spmd_smc_forward(smc_fid, secure_origin,
663 x1, x2, x3, x4, handle);
664 }
665 break; /* Not reached */
666
667 case FFA_MSG_SEND_DIRECT_RESP_SMC32:
668 if (secure_origin && spmd_is_spmc_message(x1)) {
Olivier Depreza664c492020-08-05 11:27:42 +0200669 spmd_spm_core_sync_exit(0ULL);
Olivier Deprez33e44122020-04-16 17:54:27 +0200670 } else {
671 /* Forward direct message to the other world */
672 return spmd_smc_forward(smc_fid, secure_origin,
673 x1, x2, x3, x4, handle);
674 }
675 break; /* Not reached */
676
J-Alves2672cde2020-05-07 18:42:25 +0100677 case FFA_RX_RELEASE:
678 case FFA_RXTX_MAP_SMC32:
679 case FFA_RXTX_MAP_SMC64:
680 case FFA_RXTX_UNMAP:
Ruari Phipps93dff702020-07-28 10:33:35 +0100681 case FFA_PARTITION_INFO_GET:
J-Alves2621cfd2021-03-11 17:46:47 +0000682#if MAKE_FFA_VERSION(1, 1) <= FFA_VERSION_COMPILED
683 case FFA_NOTIFICATION_BITMAP_CREATE:
684 case FFA_NOTIFICATION_BITMAP_DESTROY:
685 case FFA_NOTIFICATION_BIND:
686 case FFA_NOTIFICATION_UNBIND:
687 case FFA_NOTIFICATION_SET:
688 case FFA_NOTIFICATION_GET:
689 case FFA_NOTIFICATION_INFO_GET:
690 case FFA_NOTIFICATION_INFO_GET_SMC64:
691#endif
Ruari Phipps93dff702020-07-28 10:33:35 +0100692 /*
J-Alves2621cfd2021-03-11 17:46:47 +0000693 * Above calls should not be forwarded from Secure world to
694 * Normal world.
Ruari Phipps93dff702020-07-28 10:33:35 +0100695 *
696 * Fall through to forward the call to the other world
697 */
J-Alves2672cde2020-05-07 18:42:25 +0100698 case FFA_MSG_RUN:
Achin Gupta86f23532019-10-11 15:41:16 +0100699 /* This interface must be invoked only by the Normal world */
Ruari Phipps93dff702020-07-28 10:33:35 +0100700
Olivier Deprez41ff36a2019-12-23 16:21:12 +0100701 if (secure_origin) {
J-Alves2672cde2020-05-07 18:42:25 +0100702 return spmd_ffa_error_return(handle,
Ruari Phipps93dff702020-07-28 10:33:35 +0100703 FFA_ERROR_NOT_SUPPORTED);
Achin Gupta86f23532019-10-11 15:41:16 +0100704 }
705
706 /* Fall through to forward the call to the other world */
J-Alves2672cde2020-05-07 18:42:25 +0100707 case FFA_MSG_SEND:
J-Alves2672cde2020-05-07 18:42:25 +0100708 case FFA_MSG_SEND_DIRECT_REQ_SMC64:
J-Alves2672cde2020-05-07 18:42:25 +0100709 case FFA_MSG_SEND_DIRECT_RESP_SMC64:
710 case FFA_MEM_DONATE_SMC32:
711 case FFA_MEM_DONATE_SMC64:
712 case FFA_MEM_LEND_SMC32:
713 case FFA_MEM_LEND_SMC64:
714 case FFA_MEM_SHARE_SMC32:
715 case FFA_MEM_SHARE_SMC64:
716 case FFA_MEM_RETRIEVE_REQ_SMC32:
717 case FFA_MEM_RETRIEVE_REQ_SMC64:
718 case FFA_MEM_RETRIEVE_RESP:
719 case FFA_MEM_RELINQUISH:
720 case FFA_MEM_RECLAIM:
721 case FFA_SUCCESS_SMC32:
722 case FFA_SUCCESS_SMC64:
Achin Gupta86f23532019-10-11 15:41:16 +0100723 /*
724 * TODO: Assume that no requests originate from EL3 at the
725 * moment. This will change if a SP service is required in
726 * response to secure interrupts targeted to EL3. Until then
727 * simply forward the call to the Normal world.
728 */
729
Olivier Deprez41ff36a2019-12-23 16:21:12 +0100730 return spmd_smc_forward(smc_fid, secure_origin,
Max Shvetsov745889c2020-02-27 14:54:21 +0000731 x1, x2, x3, x4, handle);
Achin Gupta86f23532019-10-11 15:41:16 +0100732 break; /* not reached */
733
J-Alves2672cde2020-05-07 18:42:25 +0100734 case FFA_MSG_WAIT:
Achin Gupta86f23532019-10-11 15:41:16 +0100735 /*
736 * Check if this is the first invocation of this interface on
737 * this CPU from the Secure world. If so, then indicate that the
Olivier Deprez2bae35f2020-04-16 13:39:06 +0200738 * SPM Core initialised successfully.
Achin Gupta86f23532019-10-11 15:41:16 +0100739 */
Olivier Deprez7c016332019-10-28 09:03:13 +0000740 if (secure_origin && (ctx->state == SPMC_STATE_ON_PENDING)) {
Olivier Depreza664c492020-08-05 11:27:42 +0200741 spmd_spm_core_sync_exit(0ULL);
Achin Gupta86f23532019-10-11 15:41:16 +0100742 }
743
Max Shvetsov745889c2020-02-27 14:54:21 +0000744 /* Fall through to forward the call to the other world */
Olivier Deprezae18caf2021-04-02 11:09:10 +0200745 case FFA_INTERRUPT:
J-Alves2672cde2020-05-07 18:42:25 +0100746 case FFA_MSG_YIELD:
Achin Gupta86f23532019-10-11 15:41:16 +0100747 /* This interface must be invoked only by the Secure world */
Olivier Deprez41ff36a2019-12-23 16:21:12 +0100748 if (!secure_origin) {
J-Alves2672cde2020-05-07 18:42:25 +0100749 return spmd_ffa_error_return(handle,
750 FFA_ERROR_NOT_SUPPORTED);
Achin Gupta86f23532019-10-11 15:41:16 +0100751 }
752
Olivier Deprez41ff36a2019-12-23 16:21:12 +0100753 return spmd_smc_forward(smc_fid, secure_origin,
Max Shvetsov745889c2020-02-27 14:54:21 +0000754 x1, x2, x3, x4, handle);
Achin Gupta86f23532019-10-11 15:41:16 +0100755 break; /* not reached */
756
Olivier Depreza664c492020-08-05 11:27:42 +0200757 case FFA_NORMAL_WORLD_RESUME:
758 if (secure_origin && ctx->secure_interrupt_ongoing) {
759 spmd_spm_core_sync_exit(0ULL);
760 } else {
761 return spmd_ffa_error_return(handle, FFA_ERROR_DENIED);
762 }
763 break; /* Not reached */
764
Achin Gupta86f23532019-10-11 15:41:16 +0100765 default:
766 WARN("SPM: Unsupported call 0x%08x\n", smc_fid);
J-Alves2672cde2020-05-07 18:42:25 +0100767 return spmd_ffa_error_return(handle, FFA_ERROR_NOT_SUPPORTED);
Achin Gupta86f23532019-10-11 15:41:16 +0100768 }
769}