!23 adapt to common_module and fix bug to adapt OPTEE

Merge pull request !23 from suwanghw/master
This commit is contained in:
pete-lipeng
2023-12-28 03:43:32 +00:00
committed by Gitee
10 changed files with 78 additions and 71 deletions
+6 -6
View File
@@ -27,11 +27,11 @@ config ASAN_DEBUG
help
Macro defined for ASAN debug version
source "../../../../base/tee/tee_tzdriver/linux/auth/Kconfig"
source "../../../../base/tee/tee_tzdriver/linux/core/Kconfig"
source "../../../../base/tee/tee_tzdriver/linux/tlogger/Kconfig"
source "../../../../base/tee/tee_tzdriver/linux/agent_rpmb/Kconfig"
source "../../../../base/tee/tee_tzdriver/linux/ion/Kconfig"
source "../../../../base/tee/tee_tzdriver/linux/tui/Kconfig"
source "drivers/tzdriver/auth/Kconfig"
source "drivers/tzdriver/core/Kconfig"
source "drivers/tzdriver/tlogger/Kconfig"
source "drivers/tzdriver/agent_rpmb/Kconfig"
source "drivers/tzdriver/ion/Kconfig"
source "drivers/tzdriver/tui/Kconfig"
endmenu
+4 -4
View File
@@ -1,10 +1,10 @@
KERNEL_DIR :=$(srctree)
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux/core
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux/tlogger
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver/core
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver/tlogger
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../third_party/bounds_checking_function/include
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux/include
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver/include
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/security/selinux/include
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/security/selinux
+8 -1
View File
@@ -60,4 +60,11 @@ config FFA_SUPPORT
default n
depends on TZDRIVER
help
FFA Support Enable
FFA Support Enable
config THIRDPARTY_COMPATIBLE
bool "Compatible with OPTEE"
default n
depends on TZDRIVER
help
Compatible with OPTEE
+10 -10
View File
@@ -5,17 +5,17 @@ ifneq ($(TARGET_BUILD_VARIANT), user)
endif
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../third_party/bounds_checking_function/include
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux/agent_rpmb/core
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux/auth
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux/tlogger
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux/tui
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux/ion
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux/core
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux/include
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver/agent_rpmb/core
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver/auth
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver/tlogger
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver/tui
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver/ion
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver/core
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver/include
ifeq ($(CONFIG_TZDRIVER_INTERNAL), y)
include $(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux/tzdriver_internal/internal.mk
include $(KERNEL_DIR)/drivers/tzdriver/tzdriver_internal/internal.mk
endif
obj-y += teek_client_api.o
@@ -29,4 +29,4 @@ ifdef CONFIG_FFA_SUPPORT
obj-y += ffa_abi.o
else
obj-y += smc_abi.o
endif
endif
+3 -1
View File
@@ -12,7 +12,9 @@
*/
#include <linux/arm-smccc.h>
#include "smc_call.h"
#include "smc_smp.h"
#include "teek_ns_client.h"
#include "smc_abi.h"
#ifndef CONFIG_ARCH32
void do_smc_transport(struct smc_in_params *in, struct smc_out_params *out, uint8_t wait)
@@ -109,6 +111,6 @@ void smc_req(struct smc_in_params *in, struct smc_out_params *out, uint8_t wait)
{
do_smc_transport(in, out, wait);
#ifdef CONFIG_THIRDPARTY_COMPATIBLE
fix_params_offset(&out_param);
fix_params_offset(out);
#endif
}
+14 -38
View File
@@ -155,50 +155,27 @@ static uint32_t g_siq_queue[MAX_SIQ_NUM];
DEFINE_MUTEX(g_siq_lock);
enum smc_ops_exit {
SMC_OPS_NORMAL = 0x0,
SMC_OPS_NORMAL = 0x0,
SMC_OPS_SCHEDTO = 0x1,
SMC_OPS_START_SHADOW = 0x2,
SMC_OPS_START_FIQSHD = 0x3,
SMC_OPS_PROBE_ALIVE = 0x4,
SMC_OPS_ABORT_TASK = 0x5,
SMC_EXIT_NORMAL = 0x0,
SMC_EXIT_PREEMPTED = 0x1,
SMC_EXIT_SHADOW = 0x2,
SMC_EXIT_ABORT = 0x3,
SMC_OPS_PROBE_ALIVE = 0x4,
SMC_OPS_ABORT_TASK = 0x5,
SMC_EXIT_NORMAL = 0x0,
SMC_EXIT_PREEMPTED = 0x1,
SMC_EXIT_SHADOW = 0x2,
SMC_EXIT_ABORT = 0x3,
#ifdef CONFIG_THIRDPARTY_COMPATIBLE
SMC_EXIT_CRASH = 0x4,
SMC_EXIT_MAX = 0x5,
#else
SMC_EXIT_MAX = 0x4,
SMC_EXIT_MAX = 0x4,
#endif
};
#define SHADOW_EXIT_RUN 0x1234dead
#define SMC_EXIT_TARGET_SHADOW_EXIT 0x1
#define SYM_NAME_LEN_MAX 16
#define SYM_NAME_LEN_1 7
#define SYM_NAME_LEN_2 4
#define CRASH_REG_NUM 3
#define LOW_FOUR_BITE 4
union crash_inf {
uint64_t crash_reg[CRASH_REG_NUM];
struct {
uint8_t halt_reason : LOW_FOUR_BITE;
uint8_t app : LOW_FOUR_BITE;
char sym_name[SYM_NAME_LEN_1];
uint16_t off;
uint16_t size;
uint32_t far;
uint32_t fault;
union {
char sym_name_append[SYM_NAME_LEN_2];
uint32_t elr;
};
} crash_msg;
};
#define compile_time_assert(cond, msg) typedef char g_assert_##msg[(cond) ? 1 : -1]
#ifndef CONFIG_BIG_SESSION
@@ -826,15 +803,15 @@ retry:
static uint64_t send_smc_cmd(uint32_t cmd, phys_addr_t cmd_addr, uint32_t cmd_type, uint8_t wait)
{
#ifdef CONFIG_THIRDPARTY_COMPATIBLE
if (g_sys_crash) {
out_param->ret = TSP_CRASH;
return out_param->ret;
}
#endif
uint64_t ret = 0;
struct smc_in_params in_param = { cmd, cmd_addr, cmd_type, cmd_addr >> ADDR_TRANS_NUM };
struct smc_out_params out_param = { ret };
#ifdef CONFIG_THIRDPARTY_COMPATIBLE
if (g_sys_crash) {
out_param.ret = TSP_CRASH;
return out_param.ret;
}
#endif
smc_req(&in_param, &out_param, wait);
ret = out_param.ret;
return ret;
@@ -1039,7 +1016,6 @@ static void shadow_wo_pm(const void *arg, struct smc_out_params *out_params,
return;
}
#endif
smc_req(&in_params, out_params, 0);
}
+23
View File
@@ -98,6 +98,29 @@ struct tc_ns_smc_queue {
struct tc_ns_smc_cmd out[MAX_SMC_CMD];
};
#define SYM_NAME_LEN_MAX 16
#define SYM_NAME_LEN_1 7
#define SYM_NAME_LEN_2 4
#define CRASH_REG_NUM 3
#define LOW_FOUR_BITE 4
union crash_inf {
uint64_t crash_reg[CRASH_REG_NUM];
struct {
uint8_t halt_reason : LOW_FOUR_BITE;
uint8_t app : LOW_FOUR_BITE;
char sym_name[SYM_NAME_LEN_1];
uint16_t off;
uint16_t size;
uint32_t far;
uint32_t fault;
union {
char sym_name_append[SYM_NAME_LEN_2];
uint32_t elr;
};
} crash_msg;
};
#define RESLEEP_TIMEOUT 15
bool sigkill_pending(struct task_struct *tsk);
+3 -4
View File
@@ -4,9 +4,8 @@ ifneq ($(TARGET_BUILD_VARIANT),user)
ccflags-y += -DDEF_ENG
endif
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../third_party/bounds_checking_function/include
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux/core
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver/core
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/staging/android
obj-$(CONFIG_STATIC_ION) += static_ion_mem.o
@@ -17,5 +16,5 @@ else
obj-$(CONFIG_STATIC_ION) += generic/declare_static_ion.o
endif
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux/include
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver/include
EXTRA_CFLAGS += -include internal_functions.h
+4 -4
View File
@@ -5,12 +5,12 @@ ifneq ($(TARGET_BUILD_VARIANT), user)
endif
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../third_party/bounds_checking_function/include
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux/core
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux/include
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver/core
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver/include
ifeq ($(CONFIG_TZDRIVER_INTERNAL), y)
include $(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux/tzdriver_internal/internal.mk
include $(KERNEL_DIR)/drivers/tzdriver/tzdriver_internal/internal.mk
endif
obj-$(CONFIG_TEELOG) += tlogger.o
+3 -3
View File
@@ -5,10 +5,10 @@ ifneq ($(TARGET_BUILD_VARIANT), user)
endif
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../third_party/bounds_checking_function/include
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux/include
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver/include
EXTRA_CFLAGS += -include internal_functions.h
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux
EXTRA_CFLAGS += -I$(KERNEL_DIR)/../../../../base/tee/tee_tzdriver/linux/core
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver
EXTRA_CFLAGS += -I$(KERNEL_DIR)/drivers/tzdriver/core
obj-y += agent_allowed_ca.o