2019-03-29 14:12:17 +08:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2019-01-23 17:39:12 +08:00
|
|
|
From: =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= <arve@android.com>
|
|
|
|
Date: Thu, 11 Jun 2015 19:51:54 -0700
|
2019-03-29 14:12:17 +08:00
|
|
|
Subject: [PATCH] trusty: Handle fiqs without calling notifier and enabling
|
|
|
|
interrupts
|
2019-01-23 17:39:12 +08:00
|
|
|
|
|
|
|
Change-Id: I9c147376bd1596f4ecd1e932b30140c87410c860
|
|
|
|
---
|
|
|
|
drivers/trusty/trusty.c | 2 ++
|
|
|
|
include/linux/trusty/sm_err.h | 1 +
|
|
|
|
include/linux/trusty/smcall.h | 15 ++++++++++++++-
|
|
|
|
3 files changed, 17 insertions(+), 1 deletion(-)
|
|
|
|
|
|
|
|
diff --git a/drivers/trusty/trusty.c b/drivers/trusty/trusty.c
|
2020-10-27 02:14:06 +08:00
|
|
|
index fcdbba518797..4b5d3552720b 100644
|
2019-01-23 17:39:12 +08:00
|
|
|
--- a/drivers/trusty/trusty.c
|
|
|
|
+++ b/drivers/trusty/trusty.c
|
|
|
|
@@ -108,6 +108,8 @@ static ulong trusty_std_call_inner(struct device *dev, ulong smcnr,
|
|
|
|
__func__, smcnr, a0, a1, a2);
|
|
|
|
while (true) {
|
|
|
|
ret = smc(smcnr, a0, a1, a2);
|
|
|
|
+ while ((s32)ret == SM_ERR_FIQ_INTERRUPTED)
|
|
|
|
+ ret = smc(SMC_SC_RESTART_FIQ, 0, 0, 0);
|
|
|
|
if ((int)ret != SM_ERR_BUSY || !retry)
|
|
|
|
break;
|
|
|
|
|
|
|
|
diff --git a/include/linux/trusty/sm_err.h b/include/linux/trusty/sm_err.h
|
2020-10-27 02:14:06 +08:00
|
|
|
index 4ee67589ce63..7de09b46fddb 100644
|
2019-01-23 17:39:12 +08:00
|
|
|
--- a/include/linux/trusty/sm_err.h
|
|
|
|
+++ b/include/linux/trusty/sm_err.h
|
|
|
|
@@ -35,5 +35,6 @@
|
|
|
|
#define SM_ERR_NOT_ALLOWED -9 /* SMC call not allowed */
|
|
|
|
#define SM_ERR_END_OF_INPUT -10
|
|
|
|
#define SM_ERR_PANIC -11 /* Secure OS crashed */
|
|
|
|
+#define SM_ERR_FIQ_INTERRUPTED -12 /* Got interrupted by FIQ. Call back with SMC_SC_RESTART_FIQ on same CPU */
|
|
|
|
|
|
|
|
#endif
|
|
|
|
diff --git a/include/linux/trusty/smcall.h b/include/linux/trusty/smcall.h
|
2020-10-27 02:14:06 +08:00
|
|
|
index cdb4eccd7bc3..7d8950a8890e 100644
|
2019-01-23 17:39:12 +08:00
|
|
|
--- a/include/linux/trusty/smcall.h
|
|
|
|
+++ b/include/linux/trusty/smcall.h
|
|
|
|
@@ -58,6 +58,18 @@
|
|
|
|
#define SMC_SC_RESTART_LAST SMC_STDCALL_NR (SMC_ENTITY_SECURE_MONITOR, 0)
|
|
|
|
#define SMC_SC_NOP SMC_STDCALL_NR (SMC_ENTITY_SECURE_MONITOR, 1)
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * SMC_SC_RESTART_FIQ - Re-enter trusty after it was interrupted by an fiq
|
|
|
|
+ *
|
|
|
|
+ * No arguments, no return value.
|
|
|
|
+ *
|
|
|
|
+ * Re-enter trusty after returning to ns to process an fiq. Must be called iff
|
|
|
|
+ * trusty returns SM_ERR_FIQ_INTERRUPTED.
|
|
|
|
+ *
|
|
|
|
+ * Enable by selecting api version TRUSTY_API_VERSION_RESTART_FIQ (1) or later.
|
|
|
|
+ */
|
|
|
|
+#define SMC_SC_RESTART_FIQ SMC_STDCALL_NR (SMC_ENTITY_SECURE_MONITOR, 2)
|
|
|
|
+
|
|
|
|
/*
|
|
|
|
* Return from secure os to non-secure os with return value in r1
|
|
|
|
*/
|
|
|
|
@@ -94,7 +106,8 @@
|
|
|
|
*
|
|
|
|
* This call must be made before any calls that are affected by the api version.
|
|
|
|
*/
|
|
|
|
-#define TRUSTY_API_VERSION_CURRENT (0)
|
|
|
|
+#define TRUSTY_API_VERSION_RESTART_FIQ (1)
|
|
|
|
+#define TRUSTY_API_VERSION_CURRENT (1)
|
|
|
|
#define SMC_FC_API_VERSION SMC_FASTCALL_NR (SMC_ENTITY_SECURE_MONITOR, 11)
|
|
|
|
|
|
|
|
/* TRUSTED_OS entity calls */
|
|
|
|
--
|
2019-04-08 18:08:36 +08:00
|
|
|
https://clearlinux.org
|
2019-01-23 17:39:12 +08:00
|
|
|
|