tee: indicate privileged dev in gen_caps
authorJens Wiklander <jens.wiklander@linaro.org>
Thu, 16 Feb 2017 08:07:02 +0000 (09:07 +0100)
committerNitin Garg <nitin.garg@nxp.com>
Mon, 19 Mar 2018 20:55:38 +0000 (15:55 -0500)
Mirrors the TEE_DESC_PRIVILEGED bit of struct tee_desc:flags into struct
tee_ioctl_version_data:gen_caps as TEE_GEN_CAP_PRIVILEGED in
tee_ioctl_version()

Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
From: https://github.com/linaro-swg/linux.git
(cherry picked from commit 627497c586eb6074f0241d772bd0b795b709f9ba)

drivers/tee/tee_core.c
include/uapi/linux/tee.h

index 6a128db..339787c 100644 (file)
@@ -103,8 +103,13 @@ static int tee_ioctl_version(struct tee_context *ctx,
        struct tee_ioctl_version_data vers;
 
        ctx->teedev->desc->ops->get_version(ctx->teedev, &vers);
+
+       if (ctx->teedev->desc->flags & TEE_DESC_PRIVILEGED)
+               vers.gen_caps |= TEE_GEN_CAP_PRIVILEGED;
+
        if (copy_to_user(uvers, &vers, sizeof(vers)))
                return -EFAULT;
+
        return 0;
 }
 
index 929afb4..81ee3ff 100644 (file)
@@ -49,6 +49,7 @@
 #define TEE_MAX_ARG_SIZE       1024
 
 #define TEE_GEN_CAP_GP         (1 << 0)/* GlobalPlatform compliant TEE */
+#define TEE_GEN_CAP_PRIVILEGED (1 << 1)/* Privileged device (for supplicant) */
 
 /*
  * TEE Implementation ID