summaryrefslogtreecommitdiff
path: root/drivers/tee/optee/core.c
diff options
context:
space:
mode:
authorJens Wiklander <jens.wiklander@linaro.org>2021-07-21 17:45:21 +0200
committerJens Wiklander <jens.wiklander@linaro.org>2021-10-18 11:44:23 +0200
commit4615e5a34b95e0d81467f6d2176f19a5d184cb5d (patch)
tree2db8ba20e6b45468ae3ee7b79d97a92bdc2fe8f9 /drivers/tee/optee/core.c
parentc51a564a5b48355f30309b84cdffe3f96d1ae0d3 (diff)
optee: add FF-A support
Adds support for using FF-A [1] as transport to the OP-TEE driver. Introduces struct optee_msg_param_fmem which carries all information needed when OP-TEE is calling FFA_MEM_RETRIEVE_REQ to get the shared memory reference mapped by the hypervisor in S-EL2. Register usage is also updated to include the information needed. The FF-A part of this driver is enabled if CONFIG_ARM_FFA_TRANSPORT is enabled. [1] https://developer.arm.com/documentation/den0077/latest Acked-by: Sumit Garg <sumit.garg@linaro.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'drivers/tee/optee/core.c')
-rw-r--r--drivers/tee/optee/core.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c
index 27b855325b33..ab2edfcc6c70 100644
--- a/drivers/tee/optee/core.c
+++ b/drivers/tee/optee/core.c
@@ -172,6 +172,9 @@ void optee_remove_common(struct optee *optee)
mutex_destroy(&optee->call_queue.mutex);
}
+static int smc_abi_rc;
+static int ffa_abi_rc;
+
static int optee_core_init(void)
{
/*
@@ -184,13 +187,22 @@ static int optee_core_init(void)
if (is_kdump_kernel())
return -ENODEV;
- return optee_smc_abi_register();
+ smc_abi_rc = optee_smc_abi_register();
+ ffa_abi_rc = optee_ffa_abi_register();
+
+ /* If both failed there's no point with this module */
+ if (smc_abi_rc && ffa_abi_rc)
+ return smc_abi_rc;
+ return 0;
}
module_init(optee_core_init);
static void optee_core_exit(void)
{
- optee_smc_abi_unregister();
+ if (!smc_abi_rc)
+ optee_smc_abi_unregister();
+ if (!ffa_abi_rc)
+ optee_ffa_abi_unregister();
}
module_exit(optee_core_exit);