TEE-349 RPC Busfreq High

Call request/release busfreq HIGH each time a SMC
   is called.
   This ensure that OPTEE is running in HIGH frequency mode
   until no more SMC running

Signed-off-by: Cedric Neveux <cedric.neveux@nxp.com>
Acked-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit 41604a3382)
This commit is contained in:
Cedric Neveux
2018-12-17 11:33:10 +01:00
committed by Silvano di Ninno
parent 2fc7c702e1
commit 6814a47113

View File

@ -14,6 +14,11 @@
#include "optee_private.h"
#include "optee_smc.h"
#if defined(CONFIG_SOC_IMX6) || defined(CONFIG_SOC_IMX7) \
|| (CONFIG_HAVE_IMX8_SOC)
#include <linux/busfreq-imx.h>
#endif
struct optee_call_waiter {
struct list_head list_node;
struct completion c;
@ -132,8 +137,19 @@ u32 optee_do_call_with_arg(struct tee_context *ctx, phys_addr_t parg)
param.a0 = OPTEE_SMC_CALL_WITH_ARG;
reg_pair_from_64(&param.a1, &param.a2, parg);
/* Initialize waiter */
optee_cq_wait_init(&optee->call_queue, &w);
#if defined(CONFIG_SOC_IMX6) || defined(CONFIG_SOC_IMX7) \
|| (CONFIG_HAVE_IMX8_SOC)
/*
* Request Busfreq to HIGH to prevent DDR self-refresh while
* executing Secure stuff
*/
request_bus_freq(BUS_FREQ_HIGH);
#endif
while (true) {
struct arm_smccc_res res;
@ -161,6 +177,15 @@ u32 optee_do_call_with_arg(struct tee_context *ctx, phys_addr_t parg)
}
optee_rpc_finalize_call(&call_ctx);
#if defined(CONFIG_SOC_IMX6) || defined(CONFIG_SOC_IMX7) \
|| (CONFIG_HAVE_IMX8_SOC)
/*
* Release Busfreq from HIGH
*/
release_bus_freq(BUS_FREQ_HIGH);
#endif
/*
* We're done with our thread in secure world, if there's any
* thread waiters wake up one.