Commit d59a6acc authored by Edison Ai's avatar Edison Ai
Browse files

Support paging function for OPTEE.



ARM TF need transfer information about pageable image load address
and memory limit to OPTEE. OPTEE will relocate the pageable image
to where it's needed.
The legacy OP-TEE images that do not include header information
are not affected.

Change-Id: Id057efbbc894de7c36b2209b391febea4729c455
Signed-off-by: default avatarEdison Ai <edison.ai@arm.com>
parent 54661cd2
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
******************************************************************************/ ******************************************************************************/
void opteed_init_optee_ep_state(struct entry_point_info *optee_entry_point, void opteed_init_optee_ep_state(struct entry_point_info *optee_entry_point,
uint32_t rw, uint64_t pc, uint32_t rw, uint64_t pc,
uint64_t pageable_part, uint64_t mem_limit,
optee_context_t *optee_ctx) optee_context_t *optee_ctx)
{ {
uint32_t ep_attr; uint32_t ep_attr;
...@@ -51,6 +52,8 @@ void opteed_init_optee_ep_state(struct entry_point_info *optee_entry_point, ...@@ -51,6 +52,8 @@ void opteed_init_optee_ep_state(struct entry_point_info *optee_entry_point,
DAIF_IRQ_BIT | DAIF_IRQ_BIT |
DAIF_ABT_BIT); DAIF_ABT_BIT);
zeromem(&optee_entry_point->args, sizeof(optee_entry_point->args)); zeromem(&optee_entry_point->args, sizeof(optee_entry_point->args));
optee_entry_point->args.arg0 = pageable_part;
optee_entry_point->args.arg1 = mem_limit;
} }
/******************************************************************************* /*******************************************************************************
......
...@@ -42,8 +42,6 @@ optee_vectors_t *optee_vectors; ...@@ -42,8 +42,6 @@ optee_vectors_t *optee_vectors;
optee_context_t opteed_sp_context[OPTEED_CORE_COUNT]; optee_context_t opteed_sp_context[OPTEED_CORE_COUNT];
uint32_t opteed_rw; uint32_t opteed_rw;
static int32_t opteed_init(void); static int32_t opteed_init(void);
/******************************************************************************* /*******************************************************************************
...@@ -96,6 +94,8 @@ int32_t opteed_setup(void) ...@@ -96,6 +94,8 @@ int32_t opteed_setup(void)
{ {
entry_point_info_t *optee_ep_info; entry_point_info_t *optee_ep_info;
uint32_t linear_id; uint32_t linear_id;
uint64_t opteed_pageable_part;
uint64_t opteed_mem_limit;
linear_id = plat_my_core_pos(); linear_id = plat_my_core_pos();
...@@ -122,13 +122,17 @@ int32_t opteed_setup(void) ...@@ -122,13 +122,17 @@ int32_t opteed_setup(void)
/* /*
* We could inspect the SP image and determine it's execution * We could inspect the SP image and determine it's execution
* state i.e whether AArch32 or AArch64. Assuming it's AArch32 * state i.e whether AArch32 or AArch64.
* for the time being.
*/ */
opteed_rw = OPTEE_AARCH64; opteed_rw = optee_ep_info->args.arg0;
opteed_pageable_part = optee_ep_info->args.arg1;
opteed_mem_limit = optee_ep_info->args.arg2;
opteed_init_optee_ep_state(optee_ep_info, opteed_init_optee_ep_state(optee_ep_info,
opteed_rw, opteed_rw,
optee_ep_info->pc, optee_ep_info->pc,
opteed_pageable_part,
opteed_mem_limit,
&opteed_sp_context[linear_id]); &opteed_sp_context[linear_id]);
/* /*
......
/* /*
* Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved.
* *
* SPDX-License-Identifier: BSD-3-Clause * SPDX-License-Identifier: BSD-3-Clause
*/ */
...@@ -99,7 +99,7 @@ static void opteed_cpu_on_finish_handler(uint64_t unused) ...@@ -99,7 +99,7 @@ static void opteed_cpu_on_finish_handler(uint64_t unused)
opteed_init_optee_ep_state(&optee_on_entrypoint, opteed_rw, opteed_init_optee_ep_state(&optee_on_entrypoint, opteed_rw,
(uint64_t)&optee_vectors->cpu_on_entry, (uint64_t)&optee_vectors->cpu_on_entry,
optee_ctx); 0, 0, optee_ctx);
/* Initialise this cpu's secure context */ /* Initialise this cpu's secure context */
cm_init_my_context(&optee_on_entrypoint); cm_init_my_context(&optee_on_entrypoint);
...@@ -216,4 +216,3 @@ const spd_pm_ops_t opteed_pm = { ...@@ -216,4 +216,3 @@ const spd_pm_ops_t opteed_pm = {
.svc_system_off = opteed_system_off, .svc_system_off = opteed_system_off,
.svc_system_reset = opteed_system_reset, .svc_system_reset = opteed_system_reset,
}; };
...@@ -147,6 +147,8 @@ void __dead2 opteed_synchronous_sp_exit(optee_context_t *optee_ctx, uint64_t ret ...@@ -147,6 +147,8 @@ void __dead2 opteed_synchronous_sp_exit(optee_context_t *optee_ctx, uint64_t ret
void opteed_init_optee_ep_state(struct entry_point_info *optee_ep, void opteed_init_optee_ep_state(struct entry_point_info *optee_ep,
uint32_t rw, uint32_t rw,
uint64_t pc, uint64_t pc,
uint64_t pageable_part,
uint64_t mem_limit,
optee_context_t *optee_ctx); optee_context_t *optee_ctx);
extern optee_context_t opteed_sp_context[OPTEED_CORE_COUNT]; extern optee_context_t opteed_sp_context[OPTEED_CORE_COUNT];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment