mirror of
https://github.com/hardkernel/kernel_common_drivers.git
synced 2026-06-25 12:03:48 +09:00
tee: support hibernate mode for tee [1/1]
PD#SWPL-172131 Problem: optee crashed in hibernate mode Solution: register freeze and restore functions Verify: Android U + T7 Change-Id: I317891404d28a7cfa76a282a6f91ca4d736b8538 Signed-off-by: Wentao.Sun <wentao.sun@amlogic.com>
This commit is contained in:
committed by
gerrit autosubmit
parent
5a9c5df47e
commit
7dc193e9d7
@@ -45,6 +45,7 @@ struct loopbuffer_ctl_s {
|
||||
|
||||
static void *log_buf_va;
|
||||
static u8 line_buff[OPTEE_LOG_LINE_MAX];
|
||||
static bool logger_initialized;
|
||||
|
||||
struct delayed_work log_work;
|
||||
static struct workqueue_struct *log_workqueue;
|
||||
@@ -147,6 +148,9 @@ int optee_log_init(void)
|
||||
struct arm_smccc_res smccc = { 0 };
|
||||
struct loopbuffer_ctl_s *log_ctl = NULL;
|
||||
|
||||
if (logger_initialized)
|
||||
return 0;
|
||||
|
||||
arm_smccc_smc(OPTEE_SMC_GET_LOGGER_CONFIG, 0, 0, 0, 0, 0, 0, 0, &smccc);
|
||||
if (smccc.a0 == TEEC_SUCCESS) {
|
||||
/* v3, get log buffer config from BL32 */
|
||||
@@ -202,6 +206,8 @@ int optee_log_init(void)
|
||||
goto err;
|
||||
}
|
||||
|
||||
logger_initialized = true;
|
||||
|
||||
return rc;
|
||||
|
||||
err:
|
||||
@@ -214,10 +220,20 @@ void optee_log_uninit(void)
|
||||
{
|
||||
struct arm_smccc_res smccc;
|
||||
|
||||
if (!logger_initialized)
|
||||
return;
|
||||
|
||||
if (log_workqueue) {
|
||||
cancel_delayed_work_sync(&log_work);
|
||||
destroy_workqueue(log_workqueue);
|
||||
}
|
||||
|
||||
if (log_buf_va) {
|
||||
iounmap(log_buf_va);
|
||||
log_buf_va = NULL;
|
||||
}
|
||||
|
||||
arm_smccc_smc(OPTEE_SMC_ENABLE_LOGGER, 0, 0, 0, 0, 0, 0, 0, &smccc);
|
||||
|
||||
logger_initialized = false;
|
||||
}
|
||||
|
||||
@@ -1600,6 +1600,25 @@ err_free_pool:
|
||||
return rc;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int optee_restore(struct device *dev)
|
||||
{
|
||||
optee_log_init();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int optee_freeze(struct device *dev)
|
||||
{
|
||||
optee_log_uninit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops optee_pm_ops = {
|
||||
.freeze = optee_freeze,
|
||||
.restore = optee_restore,
|
||||
};
|
||||
#endif
|
||||
|
||||
static const struct of_device_id optee_dt_match[] = {
|
||||
{ .compatible = "linaro,optee-tz" },
|
||||
{},
|
||||
@@ -1613,6 +1632,9 @@ static struct platform_driver optee_driver = {
|
||||
.driver = {
|
||||
.name = "optee",
|
||||
.of_match_table = optee_dt_match,
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &optee_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user