From 5d5542e8fe65bf4e9e88e8e64dd7fda266c40334 Mon Sep 17 00:00:00 2001 From: Zhang Zhijie Date: Fri, 15 Jun 2018 11:19:13 +0800 Subject: [PATCH] OPTEE: check psci state when driver init Kernel is running in secure mode on some platforms(e.g. rk3128/rv1108), which has no secure OS to support TEE service. Change-Id: I275413230b2a8ec3864fc5a5ba043a155d724ced Signed-off-by: Zhang Zhijie --- security/optee_linuxdriver/armtz/tee_tz_drv.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/security/optee_linuxdriver/armtz/tee_tz_drv.c b/security/optee_linuxdriver/armtz/tee_tz_drv.c index 56386a0521f3..fd6e069c2cb0 100644 --- a/security/optee_linuxdriver/armtz/tee_tz_drv.c +++ b/security/optee_linuxdriver/armtz/tee_tz_drv.c @@ -40,6 +40,10 @@ #include "tee_tz_priv.h" #include "handle.h" +#ifdef CONFIG_ARM +#include +#endif + #ifdef CONFIG_OUTER_CACHE #undef CONFIG_OUTER_CACHE #endif @@ -1431,6 +1435,13 @@ static int __init tee_tz_init(void) { int rc; +#ifdef CONFIG_ARM + if (!psci_smp_available()) { + pr_info("tee: kernel is running in secure mode, tee service unavailable.\n"); + return -EACCES; + } +#endif + pr_info("TEE armv7 Driver initialization\n"); #ifdef _TEE_DEBUG