[FOSS_TLK]security: tlk_driver: remove legacy IRQ/SS support
Varun Wadekar [Mon, 21 Jul 2014 06:57:43 +0000 (11:57 +0530)]
- Delete the legacy IRQ handler registration
- Delete the legacy SS handler registration

Change-Id: I852ed100ebe8257d922645ae53824ba885ab4436
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/754997
Reviewed-by: Automatic_Commit_Validation_User

security/tlk_driver/ote_asm.S
security/tlk_driver/ote_comms.c
security/tlk_driver/ote_device.c
security/tlk_driver/ote_fs.c
security/tlk_driver/ote_protocol.h

index 2c5563b..8353258 100644 (file)
 
 #ifdef CONFIG_ARM64
 
-ENTRY(tlk_irq_handler)
-       mov     x0, #0x5
-       movk    x0, #0x3200, lsl #16    // TE_SMC_NS_IRQ_DONE
-       smc     #0
-       ret
-ENDPROC(tlk_irq_handler)
-
 /* uint32_t tlk_generic_smc(uint32_t arg0, uint32_t arg1, uint32_t arg2) */
 ENTRY(_tlk_generic_smc)
        smc     #0
@@ -50,14 +43,6 @@ ENDPROC(_tlk_extended_smc)
 
 #else
 
-ENTRY(tlk_irq_handler)
-       movw    r0, #0x5
-       movt    r0, #0x3200     @ TE_SMC_NS_IRQ_DONE
-       mov     r1, #0
-       mov     r2, #0
-       smc     #0
-ENDPROC(tlk_irq_handler)
-
 ENTRY(_tlk_generic_smc)
        smc     #0
        mov     pc, lr
index 186c189..d7fa733 100644 (file)
@@ -293,12 +293,9 @@ uint32_t tlk_generic_smc(uint32_t arg0, uintptr_t arg1, uintptr_t arg2)
        retval = _tlk_generic_smc(arg0, arg1, arg2);
        while (retval == TE_ERROR_PREEMPT_BY_IRQ ||
               retval == TE_ERROR_PREEMPT_BY_FS) {
-               if (retval == TE_ERROR_PREEMPT_BY_IRQ) {
-                       retval = _tlk_generic_smc((60 << 24), 0, 0);
-               } else {
+               if (retval == TE_ERROR_PREEMPT_BY_FS)
                        tlk_ss_op();
-                       retval = _tlk_generic_smc(TE_SMC_SS_REQ_COMPLETE, 0, 0);
-               }
+               retval = _tlk_generic_smc(TE_SMC_RESTART, 0, 0);
        }
 
        restore_cpumask();
@@ -316,8 +313,8 @@ uint32_t tlk_extended_smc(uintptr_t *regs)
        switch_cpumask_to_cpu0();
 
        retval = _tlk_extended_smc(regs);
-       while (retval == 0xFFFFFFFD)
-               retval = _tlk_generic_smc((60 << 24), 0, 0);
+       while (retval == TE_ERROR_PREEMPT_BY_IRQ)
+               retval = _tlk_generic_smc(TE_SMC_RESTART, 0, 0);
 
        restore_cpumask();
 
@@ -383,8 +380,8 @@ static long tlk_generic_smc_on_cpu0(void *args)
 
        work = (struct tlk_smc_work_args *)args;
        retval = _tlk_generic_smc(work->arg0, work->arg1, work->arg2);
-       while (retval == 0xFFFFFFFD)
-               retval = _tlk_generic_smc((60 << 24), 0, 0);
+       while (retval == TE_ERROR_PREEMPT_BY_IRQ)
+               retval = _tlk_generic_smc(TE_SMC_RESTART, 0, 0);
        return retval;
 }
 
@@ -625,12 +622,3 @@ void te_launch_operation_compat(struct te_launchop_compat *cmd,
                te_update_persist_mem_buffers(request->session_id, context);
        }
 }
-
-static int __init tlk_register_irq_handler(void)
-{
-       tlk_generic_smc(TE_SMC_REGISTER_IRQ_HANDLER,
-               (uintptr_t)tlk_irq_handler, 0);
-       return 0;
-}
-
-arch_initcall(tlk_register_irq_handler);
index cd0ff58..4746491 100644 (file)
@@ -713,11 +713,6 @@ static long tlk_device_ioctl(struct file *file, unsigned int ioctl_num,
                mutex_unlock(&smc_lock);
                break;
 
-       case TE_IOCTL_SS_NEW_REQ_LEGACY:
-       case TE_IOCTL_SS_REQ_COMPLETE_LEGACY:
-               err = te_handle_ss_ioctl_legacy(file, ioctl_num, ioctl_param);
-               break;
-
        case TE_IOCTL_SS_NEW_REQ:
        case TE_IOCTL_SS_REQ_COMPLETE:
        case TE_IOCTL_SS_CMD:
index ddcf2b6..2d59779 100644 (file)
 static DECLARE_COMPLETION(req_ready);
 static DECLARE_COMPLETION(req_complete);
 
-static struct te_ss_op_legacy *ss_op_shmem_legacy;
 static struct te_ss_op *ss_op_shmem;
-static uint32_t ss_op_size;
-
-static void indicate_ss_op_complete(void)
-{
-       tlk_generic_smc(TE_SMC_SS_REQ_COMPLETE, 0, 0);
-}
-
-int te_handle_ss_ioctl_legacy(struct file *file, unsigned int ioctl_num,
-       unsigned long ioctl_param)
-{
-       switch (ioctl_num) {
-       case TE_IOCTL_SS_NEW_REQ_LEGACY:
-               /* wait for a new request */
-               if (wait_for_completion_interruptible(&req_ready))
-                       return -ENODATA;
-
-               /* transfer pending request to daemon's buffer */
-               if (copy_to_user((void __user *)ioctl_param, ss_op_shmem_legacy,
-                                       ss_op_size)) {
-                       pr_err("copy_to_user failed for new request\n");
-                       return -EFAULT;
-               }
-               break;
-
-       case TE_IOCTL_SS_REQ_COMPLETE_LEGACY: /* request complete */
-               if (copy_from_user(ss_op_shmem_legacy,
-                       (void __user *)ioctl_param, ss_op_size)) {
-                       pr_err("copy_from_user failed for request\n");
-                       return -EFAULT;
-               }
-
-               /* signal the producer */
-               complete(&req_complete);
-               break;
-       }
-
-       return 0;
-}
-
-void tlk_ss_op_legacy(uint32_t size)
-{
-       /* store size of request */
-       ss_op_size = size;
-
-       /* signal consumer */
-       complete(&req_ready);
-
-       /* wait for the consumer's signal */
-       wait_for_completion(&req_complete);
-
-       /* signal completion to the secure world */
-       indicate_ss_op_complete();
-}
-
-static int __init tlk_ss_init_legacy(void)
-{
-       dma_addr_t ss_op_shmem_dma;
-
-       /* allocate shared memory buffer */
-       ss_op_shmem_legacy = dma_alloc_coherent(NULL,
-               sizeof(struct te_ss_op_legacy), &ss_op_shmem_dma, GFP_KERNEL);
-       if (!ss_op_shmem_legacy) {
-               pr_err("%s: no memory available for fs operations\n", __func__);
-               return -ENOMEM;
-       }
-
-       tlk_generic_smc(TE_SMC_SS_REGISTER_HANDLER_LEGACY,
-               (uintptr_t)tlk_ss_op_legacy, (uintptr_t)ss_op_shmem_legacy);
-
-       return 0;
-}
-
-arch_initcall(tlk_ss_init_legacy);
 
 int te_handle_ss_ioctl(struct file *file, unsigned int ioctl_num,
        unsigned long ioctl_param)
index e86c63d..145febb 100644 (file)
@@ -136,12 +136,10 @@ enum {
 
        /* Trusted OS calls */
        TE_SMC_REGISTER_REQ_BUF         = 0x32000002,
-       TE_SMC_REGISTER_IRQ_HANDLER     = 0x32000004,
-       TE_SMC_NS_IRQ_DONE              = 0x32000005,
        TE_SMC_INIT_LOGGER              = 0x32000007,
-       TE_SMC_SS_REGISTER_HANDLER_LEGACY       = 0x32000008,
        TE_SMC_SS_REQ_COMPLETE          = 0x32000009,
        TE_SMC_SS_REGISTER_HANDLER      = 0x32000010,
+       TE_SMC_RESTART                  = 0x3C000000,
 
        /* SIP (SOC specific) calls.  */
        TE_SMC_PROGRAM_VPR              = 0x82000003,
@@ -343,12 +341,8 @@ struct te_ss_op_legacy {
        uint8_t         data[SS_OP_MAX_DATA_SIZE];
 };
 
-int te_handle_ss_ioctl_legacy(struct file *file, unsigned int ioctl_num,
-               unsigned long ioctl_param);
 int te_handle_ss_ioctl(struct file *file, unsigned int ioctl_num,
                unsigned long ioctl_param);
-int te_handle_fs_ioctl(struct file *file, unsigned int ioctl_num,
-               unsigned long ioctl_param);
 void ote_print_logs(void);
 void tlk_ss_op(void);