security: tlk: enable logging only if secure firmware supports it
Varun Wadekar [Wed, 9 Apr 2014 05:34:10 +0000 (10:34 +0530)]
We send an SMC to the secure firmware to see if it supports logging.
If it returns failure, then we disable it from the kernel too.

Change-Id: Icc59fc221f6f59d1806815333f3e71a35a45ea90
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/393217
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

security/tlk_driver/ote_log.c

index 9a70077..0e8f6b2 100644 (file)
@@ -186,9 +186,11 @@ static int __init ote_logger_init(void)
 
        smc_args[0] = TE_SMC_INIT_LOGGER;
        smc_args[1] = (uintptr_t)cb;
-       tlk_generic_smc(smc_args[0], smc_args[1], 0);
 
-       ote_logging_enabled = 1;
+       /* enable logging only if secure firmware supports it */
+       if (!tlk_generic_smc(smc_args[0], smc_args[1], 0))
+               ote_logging_enabled = 1;
+
        ote_print_logs();
 #else
        smc_args[0] = TE_SMC_INIT_LOGGER;