int32_t meson_secure_mem_ge2d_access(uint32_t msec)
{
int ret = -1;
+ struct cpumask org_cpumask;
+ cpumask_copy(&org_cpumask, ¤t->cpus_allowed);
set_cpus_allowed_ptr(current, cpumask_of(0));
ret = meson_smc_hal_api(TRUSTZONE_HAL_API_MEMCONFIG_GE2D, msec);
- set_cpus_allowed_ptr(current, cpu_all_mask);
+ set_cpus_allowed_ptr(current, &org_cpumask);
return ret;
}
int meson_trustzone_efuse(void *arg)
{
int ret;
+ struct cpumask org_cpumask;
if (!arg)
return -1;
+ cpumask_copy(&org_cpumask, ¤t->cpus_allowed);
set_cpus_allowed_ptr(current, cpumask_of(0));
ret = meson_smc_hal_api(TRUSTZONE_HAL_API_EFUSE, __pa(arg));
- set_cpus_allowed_ptr(current, cpu_all_mask);
+ set_cpus_allowed_ptr(current, &org_cpumask);
return ret;
}
int meson_trustzone_audio_info_get(struct efuse_hal_api_arg *arg)
{
int ret;
+ struct cpumask org_cpumask;
if (!arg)
return -1;
+ cpumask_copy(&org_cpumask, ¤t->cpus_allowed);
set_cpus_allowed_ptr(current, cpumask_of(0));
ret = meson_efuse_fn_smc_query_audioinfo(arg);
- set_cpus_allowed_ptr(current, cpu_all_mask);
+ set_cpus_allowed_ptr(current, &org_cpumask);
return ret;
}
int meson64_trustzone_efuse(struct efuse_hal_api_arg *arg)
{
int ret;
+ struct cpumask org_cpumask;
if (!arg)
return -1;
+ cpumask_copy(&org_cpumask, ¤t->cpus_allowed);
set_cpus_allowed_ptr(current, cpumask_of(0));
ret = meson64_efuse_fn_smc(arg);
- set_cpus_allowed_ptr(current, cpu_all_mask);
+ set_cpus_allowed_ptr(current, &org_cpumask);
return ret;
}
unsigned long efuse_amlogic_set(char *buf, size_t count)
{
unsigned long ret;
+ struct cpumask org_cpumask;
+ cpumask_copy(&org_cpumask, ¤t->cpus_allowed);
set_cpus_allowed_ptr(current, cpumask_of(0));
ret = efuse_aml_sec_boot_check(AML_D_P_W_EFUSE_AMLOGIC,
(unsigned long)buf, (unsigned long)count, 0);
- set_cpus_allowed_ptr(current, cpu_all_mask);
+ set_cpus_allowed_ptr(current, &org_cpumask);
return ret;
}
{
struct efuse_hal_api_arg arg;
int ret;
+ struct cpumask org_cpumask;
arg.cmd = EFUSE_HAL_API_USER_MAX;
+ cpumask_copy(&org_cpumask, ¤t->cpus_allowed);
set_cpus_allowed_ptr(current, cpumask_of(0));
ret = meson64_trustzone_efuse_get_max(&arg);
- set_cpus_allowed_ptr(current, cpu_all_mask);
+ set_cpus_allowed_ptr(current, &org_cpumask);
if (ret == 0) {
pr_info("ERROR: can not get efuse user max bytes!!!\n");
{
struct aml_jtag_dev *jdev = platform_get_drvdata(pdev);
uint32_t select = jdev->select;
+ struct cpumask org_cpumask;
+ cpumask_copy(&org_cpumask, ¤t->cpus_allowed);
set_cpus_allowed_ptr(current, cpumask_of(0));
pr_info("meson8b select %s\n", select_to_name(jdev->select));
switch (select) {
writel_relaxed(0x0, jdev->base);
break;
}
- set_cpus_allowed_ptr(current, cpu_all_mask);
+ set_cpus_allowed_ptr(current, &org_cpumask);
return 0;
}
struct aml_jtag_dev *jdev = platform_get_drvdata(pdev);
unsigned int select = jdev->select;
unsigned int state = AMLOGIC_JTAG_STATE_OFF;
+ struct cpumask org_cpumask;
if (select != AMLOGIC_JTAG_DISABLE)
state = AMLOGIC_JTAG_STATE_ON;
select |= jdev->cluster << CLUSTER_BIT;
pr_info("select %s\n", select_to_name(select));
+ cpumask_copy(&org_cpumask, ¤t->cpus_allowed);
set_cpus_allowed_ptr(current, cpumask_of(0));
aml_set_jtag_state(state, select);
- set_cpus_allowed_ptr(current, cpu_all_mask);
+ set_cpus_allowed_ptr(current, &org_cpumask);
return 0;
}
void jtag_select_ao(void)
{
+ struct cpumask org_cpumask;
+
+ cpumask_copy(&org_cpumask, ¤t->cpus_allowed);
set_cpus_allowed_ptr(current, cpumask_of(0));
jtag_set_state(AMLOGIC_JTAG_STATE_ON, AMLOGIC_JTAG_APAO);
- set_cpus_allowed_ptr(current, cpu_all_mask);
+ set_cpus_allowed_ptr(current, &org_cpumask);
}
void jtag_select_sd(void)
{
+ struct cpumask org_cpumask;
+
+ cpumask_copy(&org_cpumask, ¤t->cpus_allowed);
set_cpus_allowed_ptr(current, cpumask_of(0));
jtag_set_state(AMLOGIC_JTAG_STATE_ON, AMLOGIC_JTAG_APEE);
- set_cpus_allowed_ptr(current, cpu_all_mask);
+ set_cpus_allowed_ptr(current, &org_cpumask);
}
#endif
#include <linux/platform_device.h>
#include <linux/amlogic/tee.h>
-#include <linux/delay.h>
-#include <linux/amlogic/cpu_version.h>
#include <asm/cputype.h>
#define DRIVER_NAME "tee_info"
struct arm_smccc_res smccc;
struct tee_smc_calls_revision_result result;
} res;
- long cpu;
-
- if (get_meson_cpu_version(MESON_CPU_VERSION_LVL_MAJOR)
- == 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);
- }
arm_smccc_smc(TEE_SMC_CALL_GET_OS_REVISION,
0, 0, 0, 0, 0, 0, 0, &res.smccc);
*major = res.result.major;
*minor = res.result.minor;
- if (get_meson_cpu_version(MESON_CPU_VERSION_LVL_MAJOR)
- == MESON_CPU_MAJOR_ID_G12B)
- set_cpus_allowed_ptr(current, cpu_all_mask);
return 0;
}
struct arm_smccc_res smccc;
struct tee_smc_calls_revision_result result;
} res;
- long cpu;
-
- if (get_meson_cpu_version(MESON_CPU_VERSION_LVL_MAJOR)
- == 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);
- }
arm_smccc_smc(TEE_SMC_CALLS_REVISION,
0, 0, 0, 0, 0, 0, 0, &res.smccc);
*major = res.result.major;
*minor = res.result.minor;
- if (get_meson_cpu_version(MESON_CPU_VERSION_LVL_MAJOR)
- == MESON_CPU_MAJOR_ID_G12B)
- set_cpus_allowed_ptr(current, cpu_all_mask);
return 0;
}
static int tee_load_firmware(uint32_t index, uint32_t vdec, bool is_swap)
{
struct arm_smccc_res res;
- long cpu;
-
- if (get_meson_cpu_version(MESON_CPU_VERSION_LVL_MAJOR)
- == 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);
- }
arm_smccc_smc(TEE_SMC_LOAD_VIDEO_FW,
index, vdec, is_swap, 0, 0, 0, 0, &res);
- if (get_meson_cpu_version(MESON_CPU_VERSION_LVL_MAJOR)
- == MESON_CPU_MAJOR_ID_G12B)
- set_cpus_allowed_ptr(current, cpu_all_mask);
return res.a0;
}
bool tee_enabled(void)
{
struct arm_smccc_res res;
- long cpu;
if (disable_flag == 1)
return false;
/*return false;*/ /*disable tee load temporary*/
- if (get_meson_cpu_version(MESON_CPU_VERSION_LVL_MAJOR)
- == 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);
- }
-
arm_smccc_smc(TEE_SMC_CALLS_UID, 0, 0, 0, 0, 0, 0, 0, &res);
- if (get_meson_cpu_version(MESON_CPU_VERSION_LVL_MAJOR)
- == MESON_CPU_MAJOR_ID_G12B)
- set_cpus_allowed_ptr(current, cpu_all_mask);
-
if (res.a0 == TEE_MSG_UID_0 && res.a1 == TEE_MSG_UID_1 &&
res.a2 == TEE_MSG_UID_2 && res.a3 == TEE_MSG_UID_3)
return true;