summaryrefslogtreecommitdiff
path: root/drivers/tee/amdtee/core.c
diff options
context:
space:
mode:
authorRijo Thomas <Rijo-john.Thomas@amd.com>2019-12-27 10:54:02 +0530
committerHerbert Xu <herbert@gondor.apana.org.au>2020-01-04 13:49:51 +0800
commitbade7e1fbd34f46462e6eb1db5474832a4144ac2 (patch)
treec3c35b39cf2bdc10b841bc0ca21df3844ca74f09 /drivers/tee/amdtee/core.c
parent757cc3e9ff1d72d014096399d6e2bf03974d9da1 (diff)
tee: amdtee: check TEE status during driver initialization
The AMD-TEE driver should check if TEE is available before registering itself with TEE subsystem. This ensures that there is a TEE which the driver can talk to before proceeding with tee device node allocation. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Tom Lendacky <thomas.lendacky@amd.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org> Co-developed-by: Devaraj Rangasamy <Devaraj.Rangasamy@amd.com> Signed-off-by: Devaraj Rangasamy <Devaraj.Rangasamy@amd.com> Signed-off-by: Rijo Thomas <Rijo-john.Thomas@amd.com> Reviewed-by: Gary R Hook <gary.hook@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/tee/amdtee/core.c')
-rw-r--r--drivers/tee/amdtee/core.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/tee/amdtee/core.c b/drivers/tee/amdtee/core.c
index dd360f378ef0..9d0cee1c837f 100644
--- a/drivers/tee/amdtee/core.c
+++ b/drivers/tee/amdtee/core.c
@@ -16,6 +16,7 @@
#include <linux/firmware.h>
#include "amdtee_private.h"
#include "../tee_private.h"
+#include <linux/psp-tee.h>
static struct amdtee_driver_data *drv_data;
static DEFINE_MUTEX(session_list_mutex);
@@ -438,6 +439,10 @@ static int __init amdtee_driver_init(void)
struct tee_shm_pool *pool = ERR_PTR(-EINVAL);
int rc;
+ rc = psp_check_tee_status();
+ if (rc)
+ goto err_fail;
+
drv_data = kzalloc(sizeof(*drv_data), GFP_KERNEL);
if (IS_ERR(drv_data))
return -ENOMEM;
@@ -485,6 +490,7 @@ err_kfree_drv_data:
kfree(drv_data);
drv_data = NULL;
+err_fail:
pr_err("amd-tee driver initialization failed\n");
return rc;
}