aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/psp-tee.h
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 /include/linux/psp-tee.h
parenttee: add AMD-TEE driver (diff)
downloadwireguard-linux-bade7e1fbd34f46462e6eb1db5474832a4144ac2.tar.xz
wireguard-linux-bade7e1fbd34f46462e6eb1db5474832a4144ac2.zip
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 'include/linux/psp-tee.h')
-rw-r--r--include/linux/psp-tee.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/psp-tee.h b/include/linux/psp-tee.h
index 63bb2212fce0..cb0c95d6d76b 100644
--- a/include/linux/psp-tee.h
+++ b/include/linux/psp-tee.h
@@ -62,6 +62,19 @@ enum tee_cmd_id {
int psp_tee_process_cmd(enum tee_cmd_id cmd_id, void *buf, size_t len,
u32 *status);
+/**
+ * psp_check_tee_status() - Checks whether there is a TEE which a driver can
+ * talk to.
+ *
+ * This function can be used by AMD-TEE driver to query if there is TEE with
+ * which it can communicate.
+ *
+ * Returns:
+ * 0 if the device has TEE
+ * -%ENODEV if there is no TEE available
+ */
+int psp_check_tee_status(void);
+
#else /* !CONFIG_CRYPTO_DEV_SP_PSP */
static inline int psp_tee_process_cmd(enum tee_cmd_id cmd_id, void *buf,
@@ -69,5 +82,10 @@ static inline int psp_tee_process_cmd(enum tee_cmd_id cmd_id, void *buf,
{
return -ENODEV;
}
+
+static inline int psp_check_tee_status(void)
+{
+ return -ENODEV;
+}
#endif /* CONFIG_CRYPTO_DEV_SP_PSP */
#endif /* __PSP_TEE_H_ */