linuxdriver: revert g12b binding a53 [1/1]
authorChao Liu <chao.liu@amlogic.com>
Thu, 25 Oct 2018 06:37:56 +0000 (14:37 +0800)
committerChao Liu <chao.liu@amlogic.com>
Thu, 25 Oct 2018 06:37:56 +0000 (14:37 +0800)
PD#SWPL-981

Problem:
kernel 3.14 compile failed. and these commits are not required

Solution:
revert g12b binging a53
android o tdk commit: f07bf39d83405d29158fe59f7df6e4d5c9a77e43

Verify:
Android O + g12b_skt

Change-Id: Id30f271a8f858f50be5355d8002fe3d0dc95e2dc
Signed-off-by: Chao Liu <chao.liu@amlogic.com>
optee/call.c
optee/core.c

index cb01775904899beb9004c1dd8a8b2db25c3b5492..ab1d92c12ccd7f98c64c2fa69e04118f20b234b6 100644 (file)
 #include <linux/uaccess.h>
 #include "optee_private.h"
 #include "optee_smc.h"
-#include <linux/sched.h>
-#include <linux/syscalls.h>
-#include <asm/smp_plat.h>
-#include <linux/amlogic/cpu_version.h>
-#include <asm/cputype.h>
-#include <linux/delay.h>
 
 struct optee_call_waiter {
        struct list_head list_node;
        struct completion c;
 };
 
-int (*tee_get_meson_cpu_version)(int level);
-unsigned int chipid = 0;
-void optee_set_sys(void);
-void optee_set_affinity_a53(void);
-void optee_release_affinity_a53(void);
-
 static void optee_cq_wait_init(struct optee_call_queue *cq,
                               struct optee_call_waiter *w)
 {
@@ -232,7 +220,6 @@ int optee_open_session(struct tee_context *ctx,
        struct optee_msg_arg *msg_arg;
        phys_addr_t msg_parg;
        struct optee_session *sess = NULL;
-       long cpu;
 
        /* +2 for the meta parameters added below */
        shm = get_msg_arg(ctx, arg->num_params + 2, &msg_arg, &msg_parg);
@@ -264,24 +251,11 @@ int optee_open_session(struct tee_context *ctx,
                goto out;
        }
 
-       optee_set_affinity_a53();
-
        if (optee_do_call_with_arg(ctx, msg_parg)) {
                msg_arg->ret = TEEC_ERROR_COMMUNICATION;
                msg_arg->ret_origin = TEEC_ORIGIN_COMMS;
        }
 
-#if 1
-       if (chipid == MESON_CPU_MAJOR_ID_G12B) {
-               cpu = read_cpuid_mpidr();
-               cpu &= 0xfff;
-               //if ((cpu != 0) && (cpu != 1))
-               if (cpu != 0)
-                       pr_info("!!!!!!!!!!!!%s:%lx\n", __func__, cpu);
-       }
-#endif
-       optee_release_affinity_a53();
-
        if (msg_arg->ret == TEEC_SUCCESS) {
                /* A new session has been created, add it to the list. */
                sess->session_id = msg_arg->session;
@@ -304,6 +278,7 @@ int optee_open_session(struct tee_context *ctx,
        }
 out:
        tee_shm_free(shm);
+
        return rc;
 }
 
@@ -314,7 +289,6 @@ int optee_close_session(struct tee_context *ctx, u32 session)
        struct optee_msg_arg *msg_arg;
        phys_addr_t msg_parg;
        struct optee_session *sess;
-       long cpu;
 
        /* Check that the session is valid and remove it from the list */
        mutex_lock(&ctxdata->mutex);
@@ -332,21 +306,8 @@ int optee_close_session(struct tee_context *ctx, u32 session)
 
        msg_arg->cmd = OPTEE_MSG_CMD_CLOSE_SESSION;
        msg_arg->session = session;
-
-       optee_set_affinity_a53();
        optee_do_call_with_arg(ctx, msg_parg);
 
-#if 1
-       if (chipid == MESON_CPU_MAJOR_ID_G12B) {
-               cpu = read_cpuid_mpidr();
-               cpu &= 0xfff;
-               //if ((cpu != 0) && (cpu != 1))
-               if (cpu != 0)
-                       pr_info("!!!!!!!!!!!!%s:%lx\n", __func__, cpu);
-       }
-#endif
-       optee_release_affinity_a53();
-
        tee_shm_free(shm);
        return 0;
 }
@@ -360,7 +321,6 @@ int optee_invoke_func(struct tee_context *ctx, struct tee_ioctl_invoke_arg *arg,
        phys_addr_t msg_parg;
        struct optee_session *sess;
        int rc;
-       long cpu;
 
        /* Check that the session is valid */
        mutex_lock(&ctxdata->mutex);
@@ -372,7 +332,6 @@ int optee_invoke_func(struct tee_context *ctx, struct tee_ioctl_invoke_arg *arg,
        shm = get_msg_arg(ctx, arg->num_params, &msg_arg, &msg_parg);
        if (IS_ERR(shm))
                return PTR_ERR(shm);
-
        msg_arg->cmd = OPTEE_MSG_CMD_INVOKE_COMMAND;
        msg_arg->func = arg->func;
        msg_arg->session = arg->session;
@@ -382,23 +341,11 @@ int optee_invoke_func(struct tee_context *ctx, struct tee_ioctl_invoke_arg *arg,
        if (rc)
                goto out;
 
-       optee_set_affinity_a53();
        if (optee_do_call_with_arg(ctx, msg_parg)) {
                msg_arg->ret = TEEC_ERROR_COMMUNICATION;
                msg_arg->ret_origin = TEEC_ORIGIN_COMMS;
        }
 
-#if 1
-       if (chipid == MESON_CPU_MAJOR_ID_G12B) {
-               cpu = read_cpuid_mpidr();
-               cpu &= 0xfff;
-               //if ((cpu != 0) && (cpu != 1))
-               if (cpu != 0)
-                       pr_info("!!!!!!!!!!!!%s:%lx\n", __func__, cpu);
-       }
-#endif
-       optee_release_affinity_a53();
-
        if (optee_from_msg_param(param, arg->num_params, msg_arg->params)) {
                msg_arg->ret = TEEC_ERROR_COMMUNICATION;
                msg_arg->ret_origin = TEEC_ORIGIN_COMMS;
@@ -418,7 +365,6 @@ int optee_cancel_req(struct tee_context *ctx, u32 cancel_id, u32 session)
        struct optee_msg_arg *msg_arg;
        phys_addr_t msg_parg;
        struct optee_session *sess;
-       long cpu;
 
        /* Check that the session is valid */
        mutex_lock(&ctxdata->mutex);
@@ -434,21 +380,8 @@ int optee_cancel_req(struct tee_context *ctx, u32 cancel_id, u32 session)
        msg_arg->cmd = OPTEE_MSG_CMD_CANCEL;
        msg_arg->session = session;
        msg_arg->cancel_id = cancel_id;
-
-       optee_set_affinity_a53();
        optee_do_call_with_arg(ctx, msg_parg);
 
-#if 1
-       if (chipid == MESON_CPU_MAJOR_ID_G12B) {
-               cpu = read_cpuid_mpidr();
-               cpu &= 0xfff;
-               //if ((cpu != 0) && (cpu != 1))
-               if (cpu != 0)
-                       pr_info("!!!!!!!!!!!!%s:%lx\n", __func__, cpu);
-       }
-#endif
-       optee_release_affinity_a53();
-
        tee_shm_free(shm);
        return 0;
 }
@@ -469,7 +402,6 @@ void optee_enable_shm_cache(struct optee *optee)
 
                optee->invoke_fn(OPTEE_SMC_ENABLE_SHM_CACHE, 0, 0, 0, 0, 0, 0,
                                 0, &res);
-
                if (res.a0 == OPTEE_SMC_RETURN_OK)
                        break;
                optee_cq_wait_for_completion(&optee->call_queue, &w);
@@ -496,7 +428,6 @@ void optee_disable_shm_cache(struct optee *optee)
 
                optee->invoke_fn(OPTEE_SMC_DISABLE_SHM_CACHE, 0, 0, 0, 0, 0, 0,
                                 0, &res.smccc);
-
                if (res.result.status == OPTEE_SMC_RETURN_ENOTAVAIL)
                        break; /* All shm's freed */
                if (res.result.status == OPTEE_SMC_RETURN_OK) {
@@ -511,29 +442,3 @@ void optee_disable_shm_cache(struct optee *optee)
        }
        optee_cq_wait_final(&optee->call_queue, &w);
 }
-
-void optee_set_sys(void)
-{
-       tee_get_meson_cpu_version = (int(*)(int))kallsyms_lookup_name("get_meson_cpu_version");
-       chipid = tee_get_meson_cpu_version(0);
-       pr_info("chipid-new: %x\n", chipid);
-}
-
-void optee_set_affinity_a53(void)
-{
-       long cpu;
-
-       if (chipid == MESON_CPU_MAJOR_ID_G12B) {
-               set_cpus_allowed_ptr(current, cpumask_of(0));
-               cpu = read_cpuid_mpidr();
-               cpu &= 0xfff;
-               if (cpu != 0x0)
-                       usleep_range(10, 20);
-       }
-}
-
-void optee_release_affinity_a53(void)
-{
-       if (chipid == MESON_CPU_MAJOR_ID_G12B)
-               set_cpus_allowed_ptr(current, cpu_all_mask);
-}
index 6e6a24ea32cde2ad2bcc40502fd32256d78971f2..efacf4f8d466f8539344cf85153040bc6c935caf 100644 (file)
 #include "../include/linux/arm-smccc.h"
 #include "optee_private.h"
 #include "optee_smc.h"
-#include <linux/sched.h>
-#include <linux/syscalls.h>
-#include <asm/smp_plat.h>
 
 #define DRIVER_NAME "optee"
 
 #define OPTEE_SHM_NUM_PRIV_PAGES       4
 
-extern void optee_set_sys(void);
-
 /**
  * optee_from_msg_param() - convert from OPTEE_MSG parameters to
  *                         struct tee_param
@@ -511,7 +506,7 @@ static int optee_probe(struct platform_device *pdev)
 
        optee_enable_shm_cache(optee);
 
-       pr_info("initialized driver!!!!\n");
+       pr_info("initialized driver\n");
        return 0;
 err:
        if (optee) {
@@ -602,14 +597,7 @@ static int __init optee_driver_init(void)
                return -EINVAL;
        }
 
-       rc = platform_driver_register(&optee_driver);
-       if (rc != 0) {
-               pr_err("failed to register driver %s\n", DRIVER_NAME);
-               return -EINVAL;
-       }
-
-       optee_set_sys();
-       return rc;
+       return platform_driver_register(&optee_driver);
 }
 module_init(optee_driver_init);