securemsm-kernel: Moving qseecom headers to securemsm-kernel
Move qseecom headers to securemsm-kernel. Also, cleanup and split of qseecom header done based on usage. These qseecom headers are now exposed to userspace as qseecom_kernel_headers. All the other changes are to take care of compilation dependencies from the above. Tests: Tested in device with local build with qseecom sampleclient cmds. Change-Id: I55442ce7380636a2630c2e372099735fec0756a8 Signed-off-by: Divisha Bisht <quic_divibish@quicinc.com>
This commit is contained in:
44
Android.bp
44
Android.bp
@@ -5,7 +5,7 @@ headers_src = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
smcinvoke_headers_out = [
|
smcinvoke_headers_out = [
|
||||||
"include/uapi/linux/smcinvoke.h",
|
"include/linux/smcinvoke.h",
|
||||||
"include/linux/smcinvoke_object.h",
|
"include/linux/smcinvoke_object.h",
|
||||||
"include/linux/IClientEnv.h",
|
"include/linux/IClientEnv.h",
|
||||||
]
|
]
|
||||||
@@ -40,6 +40,48 @@ cc_library_headers {
|
|||||||
recovery_available: true
|
recovery_available: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qseecom_headers_src = [
|
||||||
|
"include/uapi/linux/qsee*om.h",
|
||||||
|
"include/uapi/linux/qsee*api.h",
|
||||||
|
]
|
||||||
|
|
||||||
|
qseecom_headers_out = [
|
||||||
|
"include/linux/qseecom.h",
|
||||||
|
"include/linux/qseecom_api.h",
|
||||||
|
]
|
||||||
|
|
||||||
|
qseecom_kernel_headers_verbose = "--verbose "
|
||||||
|
|
||||||
|
genrule {
|
||||||
|
name: "qti_generate_qseecom_kernel_headers",
|
||||||
|
tools: ["headers_install.sh",
|
||||||
|
"unifdef"
|
||||||
|
],
|
||||||
|
tool_files: [
|
||||||
|
"ssg_kernel_headers.py",
|
||||||
|
],
|
||||||
|
srcs: qseecom_headers_src,
|
||||||
|
cmd: "python3 -u $(location ssg_kernel_headers.py) " +
|
||||||
|
qseecom_kernel_headers_verbose +
|
||||||
|
"--header_arch arm64 " +
|
||||||
|
"--gen_dir $(genDir) " +
|
||||||
|
"--smcinvoke_headers_to_expose $(locations include/uapi/linux/qsee*om.h) $(locations include/uapi/linux/qsee*api.h) " +
|
||||||
|
"--unifdef $(location unifdef) " +
|
||||||
|
"--headers_install $(location headers_install.sh)",
|
||||||
|
out: qseecom_headers_out,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
cc_library_headers {
|
||||||
|
name: "qseecom_kernel_headers",
|
||||||
|
export_include_dirs: ["."] + ["include"] + ["include/uapi"],
|
||||||
|
generated_headers: ["qti_generate_qseecom_kernel_headers"],
|
||||||
|
export_generated_headers: ["qti_generate_qseecom_kernel_headers"],
|
||||||
|
vendor: true,
|
||||||
|
recovery_available: true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
cc_library_headers {
|
cc_library_headers {
|
||||||
name: "smmu_proxy_uapi_header",
|
name: "smmu_proxy_uapi_header",
|
||||||
vendor_available: true,
|
vendor_available: true,
|
||||||
|
@@ -16,7 +16,8 @@ DLKM_DIR := $(TOP)/device/qcom/common/dlkm
|
|||||||
|
|
||||||
SEC_KERNEL_DIR := $(TOP)/vendor/qcom/opensource/securemsm-kernel
|
SEC_KERNEL_DIR := $(TOP)/vendor/qcom/opensource/securemsm-kernel
|
||||||
|
|
||||||
LOCAL_EXPORT_KO_INCLUDE_DIRS := $(LOCAL_PATH)/include/
|
LOCAL_EXPORT_KO_INCLUDE_DIRS := $(LOCAL_PATH)/include/ \
|
||||||
|
$(LOCAL_PATH)/include/uapi
|
||||||
|
|
||||||
SSG_SRC_FILES := \
|
SSG_SRC_FILES := \
|
||||||
$(wildcard $(LOCAL_PATH)/*) \
|
$(wildcard $(LOCAL_PATH)/*) \
|
||||||
|
13
BUILD.bazel
13
BUILD.bazel
@@ -14,8 +14,6 @@ ddk_headers(
|
|||||||
"include/linux/IClientE*.h",
|
"include/linux/IClientE*.h",
|
||||||
"include/linux/ITrustedCameraDriver.h",
|
"include/linux/ITrustedCameraDriver.h",
|
||||||
"include/linux/CTrustedCameraDriver.h",
|
"include/linux/CTrustedCameraDriver.h",
|
||||||
"linux/misc/qseecom_kernel.h",
|
|
||||||
"linux/misc/qseecom_priv.h",
|
|
||||||
]),
|
]),
|
||||||
includes = [
|
includes = [
|
||||||
"include",
|
"include",
|
||||||
@@ -26,12 +24,15 @@ ddk_headers(
|
|||||||
)
|
)
|
||||||
|
|
||||||
ddk_headers(
|
ddk_headers(
|
||||||
name = "securemsm_kernel_headers",
|
name = "qseecom_kernel_headers",
|
||||||
hdrs = [
|
hdrs = glob([
|
||||||
|
"include/uapi/linux/qseecom.h",
|
||||||
|
"include/uapi/linux/qseecom_api.h",
|
||||||
"linux/misc/qseecom_kernel.h",
|
"linux/misc/qseecom_kernel.h",
|
||||||
"linux/misc/qseecom_priv.h",
|
"linux/misc/qseecom_priv.h",
|
||||||
],
|
"linux/misc/qseecomi.h",
|
||||||
includes = ["linux"],
|
]),
|
||||||
|
includes = ["linux", "include/uapi", "include/uapi/linux"]
|
||||||
)
|
)
|
||||||
|
|
||||||
ddk_headers(
|
ddk_headers(
|
||||||
|
186
include/uapi/linux/qseecom.h
Normal file
186
include/uapi/linux/qseecom.h
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2019, 2021, The Linux Foundation. All rights reserved.
|
||||||
|
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _QSEECOM_H_
|
||||||
|
#define _QSEECOM_H_
|
||||||
|
|
||||||
|
#pragma message("Warning: This header file will be deprecated in future")
|
||||||
|
|
||||||
|
#include <linux/types.h>
|
||||||
|
#include <linux/ioctl.h>
|
||||||
|
|
||||||
|
#define MAX_ION_FD 4
|
||||||
|
#define MAX_APP_NAME_SIZE 64
|
||||||
|
#define QSEECOM_HASH_SIZE 32
|
||||||
|
|
||||||
|
#define ICE_KEY_SIZE 32
|
||||||
|
#define ICE_SALT_SIZE 32
|
||||||
|
|
||||||
|
/*
|
||||||
|
* struct qseecom_ion_fd_info - ion fd handle data information
|
||||||
|
* @fd - ion handle to some memory allocated in user space
|
||||||
|
* @cmd_buf_offset - command buffer offset
|
||||||
|
*/
|
||||||
|
struct qseecom_ion_fd_info {
|
||||||
|
__s32 fd;
|
||||||
|
__u32 cmd_buf_offset;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum qseecom_key_management_usage_type {
|
||||||
|
QSEOS_KM_USAGE_DISK_ENCRYPTION = 0x01,
|
||||||
|
QSEOS_KM_USAGE_FILE_ENCRYPTION = 0x02,
|
||||||
|
QSEOS_KM_USAGE_UFS_ICE_DISK_ENCRYPTION = 0x03,
|
||||||
|
QSEOS_KM_USAGE_SDCC_ICE_DISK_ENCRYPTION = 0x04,
|
||||||
|
QSEOS_KM_USAGE_MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
struct qseecom_create_key_req {
|
||||||
|
unsigned char hash32[QSEECOM_HASH_SIZE];
|
||||||
|
enum qseecom_key_management_usage_type usage;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct qseecom_wipe_key_req {
|
||||||
|
enum qseecom_key_management_usage_type usage;
|
||||||
|
int wipe_key_flag;/* 1->remove key from storage(alone with clear key) */
|
||||||
|
/* 0->do not remove from storage (clear key) */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct qseecom_update_key_userinfo_req {
|
||||||
|
unsigned char current_hash32[QSEECOM_HASH_SIZE];
|
||||||
|
unsigned char new_hash32[QSEECOM_HASH_SIZE];
|
||||||
|
enum qseecom_key_management_usage_type usage;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define SHA256_DIGEST_LENGTH (256/8)
|
||||||
|
/*
|
||||||
|
* struct qseecom_save_partition_hash_req
|
||||||
|
* @partition_id - partition id.
|
||||||
|
* @hash[SHA256_DIGEST_LENGTH] - sha256 digest.
|
||||||
|
*/
|
||||||
|
struct qseecom_save_partition_hash_req {
|
||||||
|
int partition_id; /* in */
|
||||||
|
char digest[SHA256_DIGEST_LENGTH]; /* in */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* struct qseecom_is_es_activated_req
|
||||||
|
* @is_activated - 1=true , 0=false
|
||||||
|
*/
|
||||||
|
struct qseecom_is_es_activated_req {
|
||||||
|
int is_activated; /* out */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* struct qseecom_mdtp_cipher_dip_req
|
||||||
|
* @in_buf - input buffer
|
||||||
|
* @in_buf_size - input buffer size
|
||||||
|
* @out_buf - output buffer
|
||||||
|
* @out_buf_size - output buffer size
|
||||||
|
* @direction - 0=encrypt, 1=decrypt
|
||||||
|
*/
|
||||||
|
struct qseecom_mdtp_cipher_dip_req {
|
||||||
|
__u8 *in_buf;
|
||||||
|
__u32 in_buf_size;
|
||||||
|
__u8 *out_buf;
|
||||||
|
__u32 out_buf_size;
|
||||||
|
__u32 direction;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct qseecom_qteec_req {
|
||||||
|
void *req_ptr;
|
||||||
|
__u32 req_len;
|
||||||
|
void *resp_ptr;
|
||||||
|
__u32 resp_len;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct qseecom_qteec_modfd_req {
|
||||||
|
void *req_ptr;
|
||||||
|
__u32 req_len;
|
||||||
|
void *resp_ptr;
|
||||||
|
__u32 resp_len;
|
||||||
|
struct qseecom_ion_fd_info ifd_data[MAX_ION_FD];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MAX_CE_PIPE_PAIR_PER_UNIT 3
|
||||||
|
|
||||||
|
struct qseecom_ce_pipe_entry {
|
||||||
|
int valid;
|
||||||
|
unsigned int ce_num;
|
||||||
|
unsigned int ce_pipe_pair;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct qseecom_ice_data_t {
|
||||||
|
int flag;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MAX_CE_INFO_HANDLE_SIZE 32
|
||||||
|
struct qseecom_ce_info_req {
|
||||||
|
unsigned char handle[MAX_CE_INFO_HANDLE_SIZE];
|
||||||
|
unsigned int usage;
|
||||||
|
unsigned int unit_num;
|
||||||
|
unsigned int num_ce_pipe_entries;
|
||||||
|
struct qseecom_ce_pipe_entry ce_pipe_entry[MAX_CE_PIPE_PAIR_PER_UNIT];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct qseecom_ice_key_data_t {
|
||||||
|
__u8 key[ICE_KEY_SIZE];
|
||||||
|
__u32 key_len;
|
||||||
|
__u8 salt[ICE_SALT_SIZE];
|
||||||
|
__u32 salt_len;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct file;
|
||||||
|
|
||||||
|
|
||||||
|
#define QSEECOM_IOC_MAGIC 0x97
|
||||||
|
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_CREATE_KEY_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 17, struct qseecom_create_key_req)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_WIPE_KEY_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 18, struct qseecom_wipe_key_req)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_SAVE_PARTITION_HASH_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 19, struct qseecom_save_partition_hash_req)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_IS_ES_ACTIVATED_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 20, struct qseecom_is_es_activated_req)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_UPDATE_KEY_USER_INFO_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 24, struct qseecom_update_key_userinfo_req)
|
||||||
|
|
||||||
|
#define QSEECOM_QTEEC_IOCTL_OPEN_SESSION_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 30, struct qseecom_qteec_modfd_req)
|
||||||
|
|
||||||
|
#define QSEECOM_QTEEC_IOCTL_CLOSE_SESSION_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 31, struct qseecom_qteec_req)
|
||||||
|
|
||||||
|
#define QSEECOM_QTEEC_IOCTL_INVOKE_MODFD_CMD_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 32, struct qseecom_qteec_modfd_req)
|
||||||
|
|
||||||
|
#define QSEECOM_QTEEC_IOCTL_REQUEST_CANCELLATION_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 33, struct qseecom_qteec_modfd_req)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_MDTP_CIPHER_DIP_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 34, struct qseecom_mdtp_cipher_dip_req)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_GET_CE_PIPE_INFO \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 40, struct qseecom_ce_info_req)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_FREE_CE_PIPE_INFO \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 41, struct qseecom_ce_info_req)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_QUERY_CE_PIPE_INFO \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 42, struct qseecom_ce_info_req)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_SET_ICE_INFO \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 43, struct qseecom_ice_data_t)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_FBE_CLEAR_KEY \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 44, struct qseecom_ice_key_data_t)
|
||||||
|
|
||||||
|
#endif /* _QSEECOM_H_ */
|
196
include/uapi/linux/qseecom_api.h
Normal file
196
include/uapi/linux/qseecom_api.h
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2017, 2019, 2021, The Linux Foundation. All rights reserved.
|
||||||
|
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _QSEECOM_API_H_
|
||||||
|
#define _QSEECOM_API_H_
|
||||||
|
|
||||||
|
#pragma message("Warning: This header file will be deprecated in future")
|
||||||
|
|
||||||
|
#include <linux/types.h>
|
||||||
|
#include <linux/ioctl.h>
|
||||||
|
#include "qseecom.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* struct qseecom_register_listener_req -
|
||||||
|
* for register listener ioctl request
|
||||||
|
* @listener_id - service id (shared between userspace and QSE)
|
||||||
|
* @ifd_data_fd - ion handle
|
||||||
|
* @virt_sb_base - shared buffer base in user space
|
||||||
|
* @sb_size - shared buffer size
|
||||||
|
*/
|
||||||
|
struct qseecom_register_listener_req {
|
||||||
|
__u32 listener_id; /* in */
|
||||||
|
__s32 ifd_data_fd; /* in */
|
||||||
|
void *virt_sb_base; /* in */
|
||||||
|
__u32 sb_size; /* in */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* struct qseecom_send_cmd_req - for send command ioctl request
|
||||||
|
* @cmd_req_len - command buffer length
|
||||||
|
* @cmd_req_buf - command buffer
|
||||||
|
* @resp_len - response buffer length
|
||||||
|
* @resp_buf - response buffer
|
||||||
|
*/
|
||||||
|
struct qseecom_send_cmd_req {
|
||||||
|
void *cmd_req_buf; /* in */
|
||||||
|
unsigned int cmd_req_len; /* in */
|
||||||
|
void *resp_buf; /* in/out */
|
||||||
|
unsigned int resp_len; /* in/out */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* struct qseecom_send_modfd_cmd_req - for send command ioctl request
|
||||||
|
* @cmd_req_len - command buffer length
|
||||||
|
* @cmd_req_buf - command buffer
|
||||||
|
* @resp_len - response buffer length
|
||||||
|
* @resp_buf - response buffer
|
||||||
|
* @ifd_data_fd - ion handle to memory allocated in user space
|
||||||
|
* @cmd_buf_offset - command buffer offset
|
||||||
|
*/
|
||||||
|
struct qseecom_send_modfd_cmd_req {
|
||||||
|
void *cmd_req_buf; /* in */
|
||||||
|
unsigned int cmd_req_len; /* in */
|
||||||
|
void *resp_buf; /* in/out */
|
||||||
|
unsigned int resp_len; /* in/out */
|
||||||
|
struct qseecom_ion_fd_info ifd_data[MAX_ION_FD];
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* struct qseecom_load_img_data - for sending image length information and
|
||||||
|
* ion file descriptor to the qseecom driver. ion file descriptor is used
|
||||||
|
* for retrieving the ion file handle and in turn the physical address of
|
||||||
|
* the image location.
|
||||||
|
* @mdt_len - Length of the .mdt file in bytes.
|
||||||
|
* @img_len - Length of the .mdt + .b00 +..+.bxx images files in bytes
|
||||||
|
* @ion_fd - Ion file descriptor used when allocating memory.
|
||||||
|
* @img_name - Name of the image.
|
||||||
|
* @app_arch - Architecture of the image, i.e. 32bit or 64bit app
|
||||||
|
*/
|
||||||
|
struct qseecom_load_img_req {
|
||||||
|
__u32 mdt_len; /* in */
|
||||||
|
__u32 img_len; /* in */
|
||||||
|
__s32 ifd_data_fd; /* in */
|
||||||
|
char img_name[MAX_APP_NAME_SIZE]; /* in */
|
||||||
|
__u32 app_arch; /* in */
|
||||||
|
__u32 app_id; /* out*/
|
||||||
|
};
|
||||||
|
|
||||||
|
struct qseecom_set_sb_mem_param_req {
|
||||||
|
__s32 ifd_data_fd; /* in */
|
||||||
|
void *virt_sb_base; /* in */
|
||||||
|
__u32 sb_len; /* in */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* struct qseecom_qseos_version_req - get qseos version
|
||||||
|
* @qseos_version - version number
|
||||||
|
*/
|
||||||
|
struct qseecom_qseos_version_req {
|
||||||
|
unsigned int qseos_version; /* in */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* struct qseecom_qseos_app_load_query - verify if app is loaded in qsee
|
||||||
|
* @app_name[MAX_APP_NAME_SIZE]- name of the app.
|
||||||
|
* @app_id - app id.
|
||||||
|
*/
|
||||||
|
struct qseecom_qseos_app_load_query {
|
||||||
|
char app_name[MAX_APP_NAME_SIZE]; /* in */
|
||||||
|
__u32 app_id; /* out */
|
||||||
|
__u32 app_arch;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct qseecom_send_svc_cmd_req {
|
||||||
|
__u32 cmd_id;
|
||||||
|
void *cmd_req_buf; /* in */
|
||||||
|
unsigned int cmd_req_len; /* in */
|
||||||
|
void *resp_buf; /* in/out */
|
||||||
|
unsigned int resp_len; /* in/out */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* struct qseecom_send_modfd_resp - for send command ioctl request
|
||||||
|
* @req_len - command buffer length
|
||||||
|
* @req_buf - command buffer
|
||||||
|
* @ifd_data_fd - ion handle to memory allocated in user space
|
||||||
|
* @cmd_buf_offset - command buffer offset
|
||||||
|
*/
|
||||||
|
struct qseecom_send_modfd_listener_resp {
|
||||||
|
void *resp_buf_ptr; /* in */
|
||||||
|
unsigned int resp_len; /* in */
|
||||||
|
struct qseecom_ion_fd_info ifd_data[MAX_ION_FD]; /* in */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct qseecom_sg_entry {
|
||||||
|
__u32 phys_addr;
|
||||||
|
__u32 len;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct qseecom_sg_entry_64bit {
|
||||||
|
__u64 phys_addr;
|
||||||
|
__u32 len;
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
|
|
||||||
|
struct file;
|
||||||
|
|
||||||
|
|
||||||
|
#define QSEECOM_IOC_MAGIC 0x97
|
||||||
|
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_REGISTER_LISTENER_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 1, struct qseecom_register_listener_req)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_UNREGISTER_LISTENER_REQ \
|
||||||
|
_IO(QSEECOM_IOC_MAGIC, 2)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_SEND_CMD_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 3, struct qseecom_send_cmd_req)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_SEND_MODFD_CMD_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 4, struct qseecom_send_modfd_cmd_req)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_RECEIVE_REQ \
|
||||||
|
_IO(QSEECOM_IOC_MAGIC, 5)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_SEND_RESP_REQ \
|
||||||
|
_IO(QSEECOM_IOC_MAGIC, 6)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_LOAD_APP_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 7, struct qseecom_load_img_req)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_SET_MEM_PARAM_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 8, struct qseecom_set_sb_mem_param_req)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_UNLOAD_APP_REQ \
|
||||||
|
_IO(QSEECOM_IOC_MAGIC, 9)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_GET_QSEOS_VERSION_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 10, struct qseecom_qseos_version_req)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_LOAD_EXTERNAL_ELF_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 13, struct qseecom_load_img_req)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_UNLOAD_EXTERNAL_ELF_REQ \
|
||||||
|
_IO(QSEECOM_IOC_MAGIC, 14)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_APP_LOADED_QUERY_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 15, struct qseecom_qseos_app_load_query)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_SEND_CMD_SERVICE_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 16, struct qseecom_send_svc_cmd_req)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_SEND_MODFD_RESP \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 21, struct qseecom_send_modfd_listener_resp)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_SEND_MODFD_CMD_64_REQ \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 35, struct qseecom_send_modfd_cmd_req)
|
||||||
|
|
||||||
|
#define QSEECOM_IOCTL_SEND_MODFD_RESP_64 \
|
||||||
|
_IOWR(QSEECOM_IOC_MAGIC, 36, struct qseecom_send_modfd_listener_resp)
|
||||||
|
|
||||||
|
#endif /* _QSEECOM_API_H_ */
|
740
linux/misc/qseecomi.h
Normal file
740
linux/misc/qseecomi.h
Normal file
@@ -0,0 +1,740 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
|
||||||
|
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __QSEECOMI_H_
|
||||||
|
#define __QSEECOMI_H_
|
||||||
|
|
||||||
|
/* we need to include qseecom.h present in securemsm-kernel */
|
||||||
|
#include "../../include/uapi/linux/qseecom.h"
|
||||||
|
|
||||||
|
#define QSEECOM_KEY_ID_SIZE 32
|
||||||
|
|
||||||
|
#define QSEOS_RESULT_FAIL_SEND_CMD_NO_THREAD -19 /*0xFFFFFFED*/
|
||||||
|
#define QSEOS_RESULT_FAIL_UNSUPPORTED_CE_PIPE -63
|
||||||
|
#define QSEOS_RESULT_FAIL_KS_OP -64
|
||||||
|
#define QSEOS_RESULT_FAIL_KEY_ID_EXISTS -65
|
||||||
|
#define QSEOS_RESULT_FAIL_MAX_KEYS -66
|
||||||
|
#define QSEOS_RESULT_FAIL_SAVE_KS -67
|
||||||
|
#define QSEOS_RESULT_FAIL_LOAD_KS -68
|
||||||
|
#define QSEOS_RESULT_FAIL_KS_ALREADY_DONE -69
|
||||||
|
#define QSEOS_RESULT_FAIL_KEY_ID_DNE -70
|
||||||
|
#define QSEOS_RESULT_FAIL_INCORRECT_PSWD -71
|
||||||
|
#define QSEOS_RESULT_FAIL_MAX_ATTEMPT -72
|
||||||
|
#define QSEOS_RESULT_FAIL_PENDING_OPERATION -73
|
||||||
|
|
||||||
|
#define SMCINVOKE_RESULT_INBOUND_REQ_NEEDED 3
|
||||||
|
|
||||||
|
enum qseecom_command_scm_resp_type {
|
||||||
|
QSEOS_APP_ID = 0xEE01,
|
||||||
|
QSEOS_LISTENER_ID
|
||||||
|
};
|
||||||
|
|
||||||
|
enum qseecom_qceos_cmd_id {
|
||||||
|
QSEOS_APP_START_COMMAND = 0x01,
|
||||||
|
QSEOS_APP_SHUTDOWN_COMMAND,
|
||||||
|
QSEOS_APP_LOOKUP_COMMAND,
|
||||||
|
QSEOS_REGISTER_LISTENER,
|
||||||
|
QSEOS_DEREGISTER_LISTENER,
|
||||||
|
QSEOS_CLIENT_SEND_DATA_COMMAND,
|
||||||
|
QSEOS_LISTENER_DATA_RSP_COMMAND,
|
||||||
|
QSEOS_LOAD_EXTERNAL_ELF_COMMAND,
|
||||||
|
QSEOS_UNLOAD_EXTERNAL_ELF_COMMAND,
|
||||||
|
QSEOS_GET_APP_STATE_COMMAND,
|
||||||
|
QSEOS_LOAD_SERV_IMAGE_COMMAND,
|
||||||
|
QSEOS_UNLOAD_SERV_IMAGE_COMMAND,
|
||||||
|
QSEOS_APP_REGION_NOTIFICATION,
|
||||||
|
QSEOS_REGISTER_LOG_BUF_COMMAND,
|
||||||
|
QSEOS_RPMB_PROVISION_KEY_COMMAND,
|
||||||
|
QSEOS_RPMB_ERASE_COMMAND,
|
||||||
|
QSEOS_GENERATE_KEY = 0x11,
|
||||||
|
QSEOS_DELETE_KEY,
|
||||||
|
QSEOS_MAX_KEY_COUNT,
|
||||||
|
QSEOS_SET_KEY,
|
||||||
|
QSEOS_UPDATE_KEY_USERINFO,
|
||||||
|
QSEOS_TEE_OPEN_SESSION,
|
||||||
|
QSEOS_TEE_INVOKE_COMMAND,
|
||||||
|
QSEOS_TEE_INVOKE_MODFD_COMMAND = QSEOS_TEE_INVOKE_COMMAND,
|
||||||
|
QSEOS_TEE_CLOSE_SESSION,
|
||||||
|
QSEOS_TEE_REQUEST_CANCELLATION,
|
||||||
|
QSEOS_CONTINUE_BLOCKED_REQ_COMMAND,
|
||||||
|
QSEOS_RPMB_CHECK_PROV_STATUS_COMMAND = 0x1B,
|
||||||
|
QSEOS_CLIENT_SEND_DATA_COMMAND_WHITELIST = 0x1C,
|
||||||
|
QSEOS_TEE_OPEN_SESSION_WHITELIST = 0x1D,
|
||||||
|
QSEOS_TEE_INVOKE_COMMAND_WHITELIST = 0x1E,
|
||||||
|
QSEOS_LISTENER_DATA_RSP_COMMAND_WHITELIST = 0x1F,
|
||||||
|
QSEOS_FSM_LTEOTA_REQ_CMD = 0x109,
|
||||||
|
QSEOS_FSM_LTEOTA_REQ_RSP_CMD = 0x110,
|
||||||
|
QSEOS_FSM_IKE_REQ_CMD = 0x203,
|
||||||
|
QSEOS_FSM_IKE_REQ_RSP_CMD = 0x204,
|
||||||
|
QSEOS_FSM_OEM_FUSE_WRITE_ROW = 0x301,
|
||||||
|
QSEOS_FSM_OEM_FUSE_READ_ROW = 0x302,
|
||||||
|
QSEOS_FSM_ENCFS_REQ_CMD = 0x403,
|
||||||
|
QSEOS_FSM_ENCFS_REQ_RSP_CMD = 0x404,
|
||||||
|
QSEOS_DIAG_FUSE_REQ_CMD = 0x501,
|
||||||
|
QSEOS_DIAG_FUSE_REQ_RSP_CMD = 0x502,
|
||||||
|
QSEOS_CMD_MAX = 0xEFFFFFFF
|
||||||
|
};
|
||||||
|
|
||||||
|
enum qseecom_qceos_cmd_status {
|
||||||
|
QSEOS_RESULT_SUCCESS = 0,
|
||||||
|
QSEOS_RESULT_INCOMPLETE,
|
||||||
|
QSEOS_RESULT_BLOCKED_ON_LISTENER,
|
||||||
|
QSEOS_RESULT_CBACK_REQUEST,
|
||||||
|
QSEOS_RESULT_FAILURE = 0xFFFFFFFF
|
||||||
|
};
|
||||||
|
|
||||||
|
enum qseecom_pipe_type {
|
||||||
|
QSEOS_PIPE_ENC = 0x1,
|
||||||
|
QSEOS_PIPE_ENC_XTS = 0x2,
|
||||||
|
QSEOS_PIPE_AUTH = 0x4,
|
||||||
|
QSEOS_PIPE_ENUM_FILL = 0x7FFFFFFF
|
||||||
|
};
|
||||||
|
|
||||||
|
/* QSEE Reentrancy support phase */
|
||||||
|
enum qseecom_qsee_reentrancy_phase {
|
||||||
|
QSEE_REENTRANCY_PHASE_0 = 0,
|
||||||
|
QSEE_REENTRANCY_PHASE_1,
|
||||||
|
QSEE_REENTRANCY_PHASE_2,
|
||||||
|
QSEE_REENTRANCY_PHASE_3,
|
||||||
|
QSEE_REENTRANCY_PHASE_MAX = 0xFF
|
||||||
|
};
|
||||||
|
|
||||||
|
struct qsee_apps_region_info_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t addr;
|
||||||
|
uint32_t size;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qsee_apps_region_info_64bit_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint64_t addr;
|
||||||
|
uint32_t size;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_check_app_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
char app_name[MAX_APP_NAME_SIZE];
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_load_app_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t mdt_len; /* Length of the mdt file */
|
||||||
|
uint32_t img_len; /* Length of .bxx and .mdt files */
|
||||||
|
uint32_t phy_addr; /* phy addr of the start of image */
|
||||||
|
char app_name[MAX_APP_NAME_SIZE]; /* application name*/
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_load_app_64bit_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t mdt_len;
|
||||||
|
uint32_t img_len;
|
||||||
|
uint64_t phy_addr;
|
||||||
|
char app_name[MAX_APP_NAME_SIZE];
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_unload_app_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t app_id;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_load_lib_image_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t mdt_len;
|
||||||
|
uint32_t img_len;
|
||||||
|
uint32_t phy_addr;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_load_lib_image_64bit_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t mdt_len;
|
||||||
|
uint32_t img_len;
|
||||||
|
uint64_t phy_addr;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_unload_lib_image_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_register_listener_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t listener_id;
|
||||||
|
uint32_t sb_ptr;
|
||||||
|
uint32_t sb_len;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_register_listener_64bit_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t listener_id;
|
||||||
|
uint64_t sb_ptr;
|
||||||
|
uint32_t sb_len;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_unregister_listener_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t listener_id;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_client_send_data_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t app_id;
|
||||||
|
uint32_t req_ptr;
|
||||||
|
uint32_t req_len;
|
||||||
|
uint32_t rsp_ptr;/* First 4 bytes should be the return status */
|
||||||
|
uint32_t rsp_len;
|
||||||
|
uint32_t sglistinfo_ptr;
|
||||||
|
uint32_t sglistinfo_len;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_client_send_data_64bit_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t app_id;
|
||||||
|
uint64_t req_ptr;
|
||||||
|
uint32_t req_len;
|
||||||
|
uint64_t rsp_ptr;
|
||||||
|
uint32_t rsp_len;
|
||||||
|
uint64_t sglistinfo_ptr;
|
||||||
|
uint32_t sglistinfo_len;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_reg_log_buf_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t phy_addr;
|
||||||
|
uint32_t len;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_reg_log_buf_64bit_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint64_t phy_addr;
|
||||||
|
uint32_t len;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
/* send_data resp */
|
||||||
|
struct qseecom_client_listener_data_irsp {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t listener_id;
|
||||||
|
uint32_t status;
|
||||||
|
uint32_t sglistinfo_ptr;
|
||||||
|
uint32_t sglistinfo_len;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_client_listener_data_64bit_irsp {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t listener_id;
|
||||||
|
uint32_t status;
|
||||||
|
uint64_t sglistinfo_ptr;
|
||||||
|
uint32_t sglistinfo_len;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* struct qseecom_command_scm_resp - qseecom response buffer
|
||||||
|
* @cmd_status: value from enum tz_sched_cmd_status
|
||||||
|
* @sb_in_rsp_addr: points to physical location of response
|
||||||
|
* buffer
|
||||||
|
* @sb_in_rsp_len: length of command response
|
||||||
|
*/
|
||||||
|
struct qseecom_command_scm_resp {
|
||||||
|
uint32_t result;
|
||||||
|
enum qseecom_command_scm_resp_type resp_type;
|
||||||
|
unsigned int data;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_rpmb_provision_key {
|
||||||
|
uint32_t key_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct qseecom_client_send_service_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t key_type; /* in */
|
||||||
|
unsigned int req_len; /* in */
|
||||||
|
uint32_t rsp_ptr; /* in/out */
|
||||||
|
unsigned int rsp_len; /* in/out */
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_client_send_service_64bit_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t key_type;
|
||||||
|
unsigned int req_len;
|
||||||
|
uint64_t rsp_ptr;
|
||||||
|
unsigned int rsp_len;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_key_generate_ireq {
|
||||||
|
uint32_t qsee_command_id;
|
||||||
|
uint32_t flags;
|
||||||
|
uint8_t key_id[QSEECOM_KEY_ID_SIZE];
|
||||||
|
uint8_t hash32[QSEECOM_HASH_SIZE];
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_key_select_ireq {
|
||||||
|
uint32_t qsee_command_id;
|
||||||
|
uint32_t ce;
|
||||||
|
uint32_t pipe;
|
||||||
|
uint32_t pipe_type;
|
||||||
|
uint32_t flags;
|
||||||
|
uint8_t key_id[QSEECOM_KEY_ID_SIZE];
|
||||||
|
uint8_t hash32[QSEECOM_HASH_SIZE];
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_key_delete_ireq {
|
||||||
|
uint32_t qsee_command_id;
|
||||||
|
uint32_t flags;
|
||||||
|
uint8_t key_id[QSEECOM_KEY_ID_SIZE];
|
||||||
|
uint8_t hash32[QSEECOM_HASH_SIZE];
|
||||||
|
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_key_userinfo_update_ireq {
|
||||||
|
uint32_t qsee_command_id;
|
||||||
|
uint32_t flags;
|
||||||
|
uint8_t key_id[QSEECOM_KEY_ID_SIZE];
|
||||||
|
uint8_t current_hash32[QSEECOM_HASH_SIZE];
|
||||||
|
uint8_t new_hash32[QSEECOM_HASH_SIZE];
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_key_max_count_query_ireq {
|
||||||
|
uint32_t flags;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_key_max_count_query_irsp {
|
||||||
|
uint32_t max_key_count;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_qteec_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t app_id;
|
||||||
|
uint32_t req_ptr;
|
||||||
|
uint32_t req_len;
|
||||||
|
uint32_t resp_ptr;
|
||||||
|
uint32_t resp_len;
|
||||||
|
uint32_t sglistinfo_ptr;
|
||||||
|
uint32_t sglistinfo_len;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_qteec_64bit_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t app_id;
|
||||||
|
uint64_t req_ptr;
|
||||||
|
uint32_t req_len;
|
||||||
|
uint64_t resp_ptr;
|
||||||
|
uint32_t resp_len;
|
||||||
|
uint64_t sglistinfo_ptr;
|
||||||
|
uint32_t sglistinfo_len;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_client_send_fsm_diag_req {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t req_ptr;
|
||||||
|
uint32_t req_len;
|
||||||
|
uint32_t rsp_ptr;
|
||||||
|
uint32_t rsp_len;
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
struct qseecom_continue_blocked_request_ireq {
|
||||||
|
uint32_t qsee_cmd_id;
|
||||||
|
uint32_t app_or_session_id; /*legacy: app_id; smcinvoke: session_id*/
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
/********** ARMV8 SMC INTERFACE TZ MACRO *******************/
|
||||||
|
|
||||||
|
#define TZ_SVC_APP_MGR 1 /* Application management */
|
||||||
|
#define TZ_SVC_LISTENER 2 /* Listener service management */
|
||||||
|
#define TZ_SVC_EXTERNAL 3 /* External image loading */
|
||||||
|
#define TZ_SVC_RPMB 4 /* RPMB */
|
||||||
|
#define TZ_SVC_KEYSTORE 5 /* Keystore management */
|
||||||
|
#define TZ_SVC_FUSE 8 /* Fuse services */
|
||||||
|
#define TZ_SVC_ES 16 /* Enterprise Security */
|
||||||
|
#define TZ_SVC_MDTP 18 /* Mobile Device Theft */
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------
|
||||||
|
* Owning Entity IDs (defined by ARM SMC doc)
|
||||||
|
* ---------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
#define TZ_OWNER_ARM 0 /** ARM Architecture call ID */
|
||||||
|
#define TZ_OWNER_CPU 1 /** CPU service call ID */
|
||||||
|
#define TZ_OWNER_SIP 2 /** SIP service call ID */
|
||||||
|
#define TZ_OWNER_OEM 3 /** OEM service call ID */
|
||||||
|
#define TZ_OWNER_STD 4 /** Standard service call ID */
|
||||||
|
|
||||||
|
/** Values 5-47 are reserved for future use */
|
||||||
|
|
||||||
|
/** Trusted Application call IDs */
|
||||||
|
#define TZ_OWNER_TZ_APPS 48
|
||||||
|
#define TZ_OWNER_TZ_APPS_RESERVED 49
|
||||||
|
/** Trusted OS Call IDs */
|
||||||
|
#define TZ_OWNER_QSEE_OS 50
|
||||||
|
#define TZ_OWNER_MOBI_OS 51
|
||||||
|
#define TZ_OWNER_OS_RESERVED_3 52
|
||||||
|
#define TZ_OWNER_OS_RESERVED_4 53
|
||||||
|
#define TZ_OWNER_OS_RESERVED_5 54
|
||||||
|
#define TZ_OWNER_OS_RESERVED_6 55
|
||||||
|
#define TZ_OWNER_OS_RESERVED_7 56
|
||||||
|
#define TZ_OWNER_OS_RESERVED_8 57
|
||||||
|
#define TZ_OWNER_OS_RESERVED_9 58
|
||||||
|
#define TZ_OWNER_OS_RESERVED_10 59
|
||||||
|
#define TZ_OWNER_OS_RESERVED_11 60
|
||||||
|
#define TZ_OWNER_OS_RESERVED_12 61
|
||||||
|
#define TZ_OWNER_OS_RESERVED_13 62
|
||||||
|
#define TZ_OWNER_OS_RESERVED_14 63
|
||||||
|
|
||||||
|
#define TZ_SVC_INFO 6 /* Misc. information services */
|
||||||
|
|
||||||
|
/** Trusted Application call groups */
|
||||||
|
#define TZ_SVC_APP_ID_PLACEHOLDER 0 /* SVC bits will contain App ID */
|
||||||
|
|
||||||
|
/** General helper macro to create a bitmask from bits low to high. */
|
||||||
|
#define TZ_MASK_BITS(h, l) ((0xffffffff >> (32 - ((h - l) + 1))) << l)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Macro used to define an SMC ID based on the owner ID,
|
||||||
|
* service ID, and function number.
|
||||||
|
*/
|
||||||
|
#define TZ_SYSCALL_CREATE_SMC_ID(o, s, f) \
|
||||||
|
((uint32_t)((((o & 0x3f) << 24) | (s & 0xff) << 8) | (f & 0xff)))
|
||||||
|
|
||||||
|
#define TZ_SYSCALL_PARAM_NARGS_MASK TZ_MASK_BITS(3, 0)
|
||||||
|
#define TZ_SYSCALL_PARAM_TYPE_MASK TZ_MASK_BITS(1, 0)
|
||||||
|
|
||||||
|
#define TZ_SYSCALL_CREATE_PARAM_ID(nargs, p1, p2, p3, \
|
||||||
|
p4, p5, p6, p7, p8, p9, p10) \
|
||||||
|
((nargs&TZ_SYSCALL_PARAM_NARGS_MASK)+ \
|
||||||
|
((p1&TZ_SYSCALL_PARAM_TYPE_MASK)<<4)+ \
|
||||||
|
((p2&TZ_SYSCALL_PARAM_TYPE_MASK)<<6)+ \
|
||||||
|
((p3&TZ_SYSCALL_PARAM_TYPE_MASK)<<8)+ \
|
||||||
|
((p4&TZ_SYSCALL_PARAM_TYPE_MASK)<<10)+ \
|
||||||
|
((p5&TZ_SYSCALL_PARAM_TYPE_MASK)<<12)+ \
|
||||||
|
((p6&TZ_SYSCALL_PARAM_TYPE_MASK)<<14)+ \
|
||||||
|
((p7&TZ_SYSCALL_PARAM_TYPE_MASK)<<16)+ \
|
||||||
|
((p8&TZ_SYSCALL_PARAM_TYPE_MASK)<<18)+ \
|
||||||
|
((p9&TZ_SYSCALL_PARAM_TYPE_MASK)<<20)+ \
|
||||||
|
((p10&TZ_SYSCALL_PARAM_TYPE_MASK)<<22))
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Macros used to create the Parameter ID associated with the syscall
|
||||||
|
*/
|
||||||
|
#define TZ_SYSCALL_CREATE_PARAM_ID_0 0
|
||||||
|
#define TZ_SYSCALL_CREATE_PARAM_ID_1(p1) \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID(1, p1, 0, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||||
|
#define TZ_SYSCALL_CREATE_PARAM_ID_2(p1, p2) \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID(2, p1, p2, 0, 0, 0, 0, 0, 0, 0, 0)
|
||||||
|
#define TZ_SYSCALL_CREATE_PARAM_ID_3(p1, p2, p3) \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID(3, p1, p2, p3, 0, 0, 0, 0, 0, 0, 0)
|
||||||
|
#define TZ_SYSCALL_CREATE_PARAM_ID_4(p1, p2, p3, p4) \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID(4, p1, p2, p3, p4, 0, 0, 0, 0, 0, 0)
|
||||||
|
#define TZ_SYSCALL_CREATE_PARAM_ID_5(p1, p2, p3, p4, p5) \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID(5, p1, p2, p3, p4, p5, 0, 0, 0, 0, 0)
|
||||||
|
#define TZ_SYSCALL_CREATE_PARAM_ID_6(p1, p2, p3, p4, p5, p6) \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID(6, p1, p2, p3, p4, p5, p6, 0, 0, 0, 0)
|
||||||
|
#define TZ_SYSCALL_CREATE_PARAM_ID_7(p1, p2, p3, p4, p5, p6, p7) \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID(7, p1, p2, p3, p4, p5, p6, p7, 0, 0, 0)
|
||||||
|
#define TZ_SYSCALL_CREATE_PARAM_ID_8(p1, p2, p3, p4, p5, p6, p7, p8) \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID(8, p1, p2, p3, p4, p5, p6, p7, p8, 0, 0)
|
||||||
|
#define TZ_SYSCALL_CREATE_PARAM_ID_9(p1, p2, p3, p4, p5, p6, p7, p8, p9) \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID(9, p1, p2, p3, p4, p5, p6, p7, p8, p9, 0)
|
||||||
|
#define TZ_SYSCALL_CREATE_PARAM_ID_10(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID(10, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Macro used to obtain the Parameter ID associated with the syscall
|
||||||
|
*/
|
||||||
|
#define TZ_SYSCALL_GET_PARAM_ID(CMD_ID) CMD_ID ## _PARAM_ID
|
||||||
|
|
||||||
|
/** Helper macro to extract the owning entity from the SMC ID. */
|
||||||
|
#define TZ_SYSCALL_OWNER_ID(r0) ((r0 & TZ_MASK_BITS(29, 24)) >> 24)
|
||||||
|
|
||||||
|
/** Helper macro for checking whether an owning entity is of type trusted OS. */
|
||||||
|
#define IS_OWNER_TRUSTED_OS(owner_id) \
|
||||||
|
(((owner_id >= 50) && (owner_id <= 63)) ? 1:0)
|
||||||
|
|
||||||
|
#define TZ_SYSCALL_PARAM_TYPE_VAL 0x0 /* type of value */
|
||||||
|
#define TZ_SYSCALL_PARAM_TYPE_BUF_RO 0x1 /* type of buffer RO */
|
||||||
|
#define TZ_SYSCALL_PARAM_TYPE_BUF_RW 0x2 /* type of buffer RW */
|
||||||
|
|
||||||
|
#define TZ_OS_APP_START_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_APP_MGR, 0x01)
|
||||||
|
|
||||||
|
#define TZ_OS_APP_START_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_3( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_VAL, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_APP_SHUTDOWN_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_APP_MGR, 0x02)
|
||||||
|
|
||||||
|
#define TZ_OS_APP_SHUTDOWN_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_1(TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_APP_LOOKUP_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_APP_MGR, 0x03)
|
||||||
|
|
||||||
|
#define TZ_OS_APP_LOOKUP_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_2( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_BUF_RW, TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_APP_GET_STATE_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_APP_MGR, 0x04)
|
||||||
|
|
||||||
|
#define TZ_OS_APP_GET_STATE_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_1(TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_APP_REGION_NOTIFICATION_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_APP_MGR, 0x05)
|
||||||
|
|
||||||
|
#define TZ_OS_APP_REGION_NOTIFICATION_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_2( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_BUF_RW, TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_REGISTER_LOG_BUFFER_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_APP_MGR, 0x06)
|
||||||
|
|
||||||
|
#define TZ_OS_REGISTER_LOG_BUFFER_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_2( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_BUF_RW, TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_LOAD_SERVICES_IMAGE_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_APP_MGR, 0x07)
|
||||||
|
|
||||||
|
#define TZ_OS_LOAD_SERVICES_IMAGE_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_3( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_VAL, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_UNLOAD_SERVICES_IMAGE_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_APP_MGR, 0x08)
|
||||||
|
|
||||||
|
#define TZ_OS_UNLOAD_SERVICES_IMAGE_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_0
|
||||||
|
|
||||||
|
#define TZ_SECBOOT_GET_FUSE_INFO \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_SIP, TZ_SVC_FUSE, 0x09)
|
||||||
|
|
||||||
|
#define TZ_SECBOOT_GET_FUSE_INFO_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_4(\
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_BUF_RO, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_REGISTER_LISTENER_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_LISTENER, 0x01)
|
||||||
|
|
||||||
|
#define TZ_OS_REGISTER_LISTENER_SMCINVOKE_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_LISTENER, 0x06)
|
||||||
|
|
||||||
|
#define TZ_OS_REGISTER_LISTENER_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_3( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_DEREGISTER_LISTENER_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_LISTENER, 0x02)
|
||||||
|
|
||||||
|
#define TZ_OS_DEREGISTER_LISTENER_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_1(TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_LISTENER_RESPONSE_HANDLER_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_LISTENER, 0x03)
|
||||||
|
|
||||||
|
#define TZ_OS_LISTENER_RESPONSE_HANDLER_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_2( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_LOAD_EXTERNAL_IMAGE_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_EXTERNAL, 0x01)
|
||||||
|
|
||||||
|
#define TZ_OS_LOAD_EXTERNAL_IMAGE_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_3( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_VAL, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_APP_QSAPP_SEND_DATA_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_TZ_APPS, \
|
||||||
|
TZ_SVC_APP_ID_PLACEHOLDER, 0x01)
|
||||||
|
|
||||||
|
|
||||||
|
#define TZ_APP_QSAPP_SEND_DATA_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_5( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_UNLOAD_EXTERNAL_IMAGE_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_EXTERNAL, 0x02)
|
||||||
|
|
||||||
|
#define TZ_OS_UNLOAD_EXTERNAL_IMAGE_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_0
|
||||||
|
|
||||||
|
#define TZ_INFO_IS_SVC_AVAILABLE_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_SIP, TZ_SVC_INFO, 0x01)
|
||||||
|
|
||||||
|
#define TZ_INFO_IS_SVC_AVAILABLE_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_1(TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_INFO_GET_FEATURE_VERSION_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_SIP, TZ_SVC_INFO, 0x03)
|
||||||
|
|
||||||
|
#define TZ_INFO_GET_FEATURE_VERSION_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_1(TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_RPMB_PROVISION_KEY_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_RPMB, 0x01)
|
||||||
|
|
||||||
|
#define TZ_OS_RPMB_PROVISION_KEY_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_1(TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_RPMB_ERASE_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_RPMB, 0x02)
|
||||||
|
|
||||||
|
#define TZ_OS_RPMB_ERASE_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_0
|
||||||
|
|
||||||
|
#define TZ_OS_RPMB_CHECK_PROV_STATUS_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_RPMB, 0x03)
|
||||||
|
|
||||||
|
#define TZ_OS_RPMB_CHECK_PROV_STATUS_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_0
|
||||||
|
|
||||||
|
#define TZ_OS_KS_GEN_KEY_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_KEYSTORE, 0x01)
|
||||||
|
|
||||||
|
#define TZ_OS_KS_GEN_KEY_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_2( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_BUF_RW, TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_KS_DEL_KEY_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_KEYSTORE, 0x02)
|
||||||
|
|
||||||
|
#define TZ_OS_KS_DEL_KEY_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_2( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_BUF_RW, TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_KS_GET_MAX_KEYS_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_KEYSTORE, 0x03)
|
||||||
|
|
||||||
|
#define TZ_OS_KS_GET_MAX_KEYS_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_1(TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_KS_SET_PIPE_KEY_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_KEYSTORE, 0x04)
|
||||||
|
|
||||||
|
#define TZ_OS_KS_SET_PIPE_KEY_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_2( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_BUF_RW, TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_KS_UPDATE_KEY_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_KEYSTORE, 0x05)
|
||||||
|
|
||||||
|
#define TZ_OS_KS_UPDATE_KEY_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_2( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_BUF_RW, TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_ES_SAVE_PARTITION_HASH_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_SIP, TZ_SVC_ES, 0x01)
|
||||||
|
|
||||||
|
#define TZ_ES_SAVE_PARTITION_HASH_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_3( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_APP_GPAPP_OPEN_SESSION_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_TZ_APPS, \
|
||||||
|
TZ_SVC_APP_ID_PLACEHOLDER, 0x02)
|
||||||
|
|
||||||
|
#define TZ_APP_GPAPP_OPEN_SESSION_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_5( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_APP_GPAPP_CLOSE_SESSION_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_TZ_APPS, \
|
||||||
|
TZ_SVC_APP_ID_PLACEHOLDER, 0x03)
|
||||||
|
|
||||||
|
#define TZ_APP_GPAPP_CLOSE_SESSION_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_5( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_APP_GPAPP_INVOKE_COMMAND_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_TZ_APPS, \
|
||||||
|
TZ_SVC_APP_ID_PLACEHOLDER, 0x04)
|
||||||
|
|
||||||
|
#define TZ_APP_GPAPP_INVOKE_COMMAND_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_5( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_APP_GPAPP_REQUEST_CANCELLATION_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_TZ_APPS, \
|
||||||
|
TZ_SVC_APP_ID_PLACEHOLDER, 0x05)
|
||||||
|
|
||||||
|
#define TZ_APP_GPAPP_REQUEST_CANCELLATION_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_5( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_MDTP_CIPHER_DIP_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_SIP, TZ_SVC_MDTP, 0x1)
|
||||||
|
|
||||||
|
#define TZ_MDTP_CIPHER_DIP_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_5( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_BUF_RO, TZ_SYSCALL_PARAM_TYPE_VAL, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_BUF_RW, TZ_SYSCALL_PARAM_TYPE_VAL, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_CONTINUE_BLOCKED_REQUEST_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_LISTENER, 0x04)
|
||||||
|
|
||||||
|
#define TZ_OS_CONTINUE_BLOCKED_REQUEST_SMCINVOKE_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_LISTENER, 0x07)
|
||||||
|
|
||||||
|
#define TZ_OS_CONTINUE_BLOCKED_REQUEST_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_1(TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_APP_QSAPP_SEND_DATA_WITH_WHITELIST_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_TZ_APPS, \
|
||||||
|
TZ_SVC_APP_ID_PLACEHOLDER, 0x06)
|
||||||
|
|
||||||
|
#define TZ_APP_QSAPP_SEND_DATA_WITH_WHITELIST_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_7( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_APP_GPAPP_OPEN_SESSION_WITH_WHITELIST_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_TZ_APPS, \
|
||||||
|
TZ_SVC_APP_ID_PLACEHOLDER, 0x07)
|
||||||
|
|
||||||
|
#define TZ_APP_GPAPP_OPEN_SESSION_WITH_WHITELIST_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_7( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_APP_GPAPP_INVOKE_COMMAND_WITH_WHITELIST_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_TZ_APPS, \
|
||||||
|
TZ_SVC_APP_ID_PLACEHOLDER, 0x09)
|
||||||
|
|
||||||
|
#define TZ_APP_GPAPP_INVOKE_COMMAND_WITH_WHITELIST_ID_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_7( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_BUF_RW, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#define TZ_OS_LISTENER_RESPONSE_HANDLER_WITH_WHITELIST_ID \
|
||||||
|
TZ_SYSCALL_CREATE_SMC_ID(TZ_OWNER_QSEE_OS, TZ_SVC_LISTENER, 0x05)
|
||||||
|
|
||||||
|
#define TZ_OS_LISTENER_RESPONSE_HANDLER_WITH_WHITELIST_PARAM_ID \
|
||||||
|
TZ_SYSCALL_CREATE_PARAM_ID_4( \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_VAL, TZ_SYSCALL_PARAM_TYPE_VAL, \
|
||||||
|
TZ_SYSCALL_PARAM_TYPE_BUF_RW, TZ_SYSCALL_PARAM_TYPE_VAL)
|
||||||
|
|
||||||
|
#endif /* __QSEECOMI_H_ */
|
@@ -3,7 +3,7 @@
|
|||||||
* QTI Secure Execution Environment Communicator (QSEECOM) driver
|
* QTI Secure Execution Environment Communicator (QSEECOM) driver
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
|
||||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define pr_fmt(fmt) "QSEECOM: %s: " fmt, __func__
|
#define pr_fmt(fmt) "QSEECOM: %s: " fmt, __func__
|
||||||
@@ -25,7 +25,6 @@
|
|||||||
#include <linux/msm_ion.h>
|
#include <linux/msm_ion.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/qseecom.h>
|
|
||||||
#include <linux/elf.h>
|
#include <linux/elf.h>
|
||||||
#include <linux/firmware.h>
|
#include <linux/firmware.h>
|
||||||
#include <linux/freezer.h>
|
#include <linux/freezer.h>
|
||||||
@@ -33,7 +32,6 @@
|
|||||||
#include <linux/regulator/consumer.h>
|
#include <linux/regulator/consumer.h>
|
||||||
#include <linux/dma-mapping.h>
|
#include <linux/dma-mapping.h>
|
||||||
#include <soc/qcom/qseecom_scm.h>
|
#include <soc/qcom/qseecom_scm.h>
|
||||||
#include <soc/qcom/qseecomi.h>
|
|
||||||
#include <asm/cacheflush.h>
|
#include <asm/cacheflush.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/signal.h>
|
#include <linux/signal.h>
|
||||||
@@ -47,6 +45,7 @@
|
|||||||
#include <linux/qtee_shmbridge.h>
|
#include <linux/qtee_shmbridge.h>
|
||||||
#include <linux/mem-buf.h>
|
#include <linux/mem-buf.h>
|
||||||
#include <linux/version.h>
|
#include <linux/version.h>
|
||||||
|
#include "linux/qseecom_api.h"
|
||||||
#include "ice.h"
|
#include "ice.h"
|
||||||
#if IS_ENABLED(CONFIG_QSEECOM_PROXY)
|
#if IS_ENABLED(CONFIG_QSEECOM_PROXY)
|
||||||
#include <linux/qseecom_kernel.h>
|
#include <linux/qseecom_kernel.h>
|
||||||
@@ -54,6 +53,7 @@
|
|||||||
#else
|
#else
|
||||||
#include "misc/qseecom_kernel.h"
|
#include "misc/qseecom_kernel.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "misc/qseecomi.h"
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(6,0,0))
|
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(6,0,0))
|
||||||
#define KERNEL_VERSION_LEGACY
|
#define KERNEL_VERSION_LEGACY
|
||||||
@@ -120,6 +120,40 @@
|
|||||||
#define FDE_FLAG_POS 4
|
#define FDE_FLAG_POS 4
|
||||||
#define ENABLE_KEY_WRAP_IN_KS (1 << FDE_FLAG_POS)
|
#define ENABLE_KEY_WRAP_IN_KS (1 << FDE_FLAG_POS)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* sg list buf format version
|
||||||
|
* 1: Legacy format to support only 512 SG list entries
|
||||||
|
* 2: new format to support > 512 entries
|
||||||
|
*/
|
||||||
|
#define QSEECOM_SG_LIST_BUF_FORMAT_VERSION_1 1
|
||||||
|
#define QSEECOM_SG_LIST_BUF_FORMAT_VERSION_2 2
|
||||||
|
|
||||||
|
struct qseecom_sg_list_buf_hdr_64bit {
|
||||||
|
struct qseecom_sg_entry_64bit blank_entry; /* must be all 0 */
|
||||||
|
__u32 version; /* sg list buf format version */
|
||||||
|
__u64 new_buf_phys_addr; /* PA of new buffer */
|
||||||
|
__u32 nents_total; /* Total number of SG entries */
|
||||||
|
} __packed;
|
||||||
|
|
||||||
|
#define QSEECOM_SG_LIST_BUF_HDR_SZ_64BIT \
|
||||||
|
sizeof(struct qseecom_sg_list_buf_hdr_64bit)
|
||||||
|
|
||||||
|
#define MAX_CE_PIPE_PAIR_PER_UNIT 3
|
||||||
|
#define INVALID_CE_INFO_UNIT_NUM 0xffffffff
|
||||||
|
|
||||||
|
#define CE_PIPE_PAIR_USE_TYPE_FDE 0
|
||||||
|
#define CE_PIPE_PAIR_USE_TYPE_PFE 1
|
||||||
|
|
||||||
|
#define SG_ENTRY_SZ sizeof(struct qseecom_sg_entry)
|
||||||
|
#define SG_ENTRY_SZ_64BIT sizeof(struct qseecom_sg_entry_64bit)
|
||||||
|
|
||||||
|
enum qseecom_bandwidth_request_mode {
|
||||||
|
INACTIVE = 0,
|
||||||
|
LOW,
|
||||||
|
MEDIUM,
|
||||||
|
HIGH,
|
||||||
|
};
|
||||||
|
|
||||||
enum qseecom_clk_definitions {
|
enum qseecom_clk_definitions {
|
||||||
CLK_DFAB = 0,
|
CLK_DFAB = 0,
|
||||||
CLK_SFPB,
|
CLK_SFPB,
|
||||||
@@ -1930,50 +1964,6 @@ perf_enable_exit:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qseecom_scale_bus_bandwidth(struct qseecom_dev_handle *data,
|
|
||||||
void __user *argp)
|
|
||||||
{
|
|
||||||
int32_t ret = 0;
|
|
||||||
int32_t req_mode;
|
|
||||||
|
|
||||||
if (qseecom.no_clock_support)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
ret = copy_from_user(&req_mode, argp, sizeof(req_mode));
|
|
||||||
if (ret) {
|
|
||||||
pr_err("copy_from_user failed\n");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
if (req_mode > HIGH) {
|
|
||||||
pr_err("Invalid bandwidth mode (%d)\n", req_mode);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Register bus bandwidth needs if bus scaling feature is enabled;
|
|
||||||
* otherwise, qseecom enable/disable clocks for the client directly.
|
|
||||||
*/
|
|
||||||
if (qseecom.support_bus_scaling) {
|
|
||||||
mutex_lock(&qsee_bw_mutex);
|
|
||||||
ret = __qseecom_register_bus_bandwidth_needs(data, req_mode);
|
|
||||||
mutex_unlock(&qsee_bw_mutex);
|
|
||||||
} else {
|
|
||||||
pr_debug("Bus scaling feature is NOT enabled\n");
|
|
||||||
pr_debug("request bandwidth mode %d for the client\n",
|
|
||||||
req_mode);
|
|
||||||
if (req_mode != INACTIVE) {
|
|
||||||
ret = qseecom_perf_enable(data);
|
|
||||||
if (ret)
|
|
||||||
pr_err("Failed to vote for clock with err %d\n",
|
|
||||||
ret);
|
|
||||||
} else {
|
|
||||||
qsee_disable_clock_vote(data, CLK_DFAB);
|
|
||||||
qsee_disable_clock_vote(data, CLK_SFPB);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void __qseecom_add_bw_scale_down_timer(uint32_t duration)
|
static void __qseecom_add_bw_scale_down_timer(uint32_t duration)
|
||||||
{
|
{
|
||||||
if (qseecom.no_clock_support)
|
if (qseecom.no_clock_support)
|
||||||
@@ -7905,80 +7895,6 @@ long qseecom_ioctl(struct file *file,
|
|||||||
atomic_dec(&data->ioctl_count);
|
atomic_dec(&data->ioctl_count);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case QSEECOM_IOCTL_PERF_ENABLE_REQ:{
|
|
||||||
if ((data->type != QSEECOM_GENERIC) &&
|
|
||||||
(data->type != QSEECOM_CLIENT_APP)) {
|
|
||||||
pr_err("perf enable req: invalid handle (%d)\n",
|
|
||||||
data->type);
|
|
||||||
ret = -EINVAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ((data->type == QSEECOM_CLIENT_APP) &&
|
|
||||||
(data->client.app_id == 0)) {
|
|
||||||
pr_err("perf enable req:invalid handle(%d) appid(%d)\n",
|
|
||||||
data->type, data->client.app_id);
|
|
||||||
ret = -EINVAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
atomic_inc(&data->ioctl_count);
|
|
||||||
if (qseecom.support_bus_scaling) {
|
|
||||||
mutex_lock(&qsee_bw_mutex);
|
|
||||||
__qseecom_register_bus_bandwidth_needs(data, HIGH);
|
|
||||||
mutex_unlock(&qsee_bw_mutex);
|
|
||||||
} else {
|
|
||||||
ret = qseecom_perf_enable(data);
|
|
||||||
if (ret)
|
|
||||||
pr_err("Fail to vote for clocks %d\n", ret);
|
|
||||||
}
|
|
||||||
atomic_dec(&data->ioctl_count);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case QSEECOM_IOCTL_PERF_DISABLE_REQ:{
|
|
||||||
if ((data->type != QSEECOM_SECURE_SERVICE) &&
|
|
||||||
(data->type != QSEECOM_CLIENT_APP)) {
|
|
||||||
pr_err("perf disable req: invalid handle (%d)\n",
|
|
||||||
data->type);
|
|
||||||
ret = -EINVAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ((data->type == QSEECOM_CLIENT_APP) &&
|
|
||||||
(data->client.app_id == 0)) {
|
|
||||||
pr_err("perf disable: invalid handle (%d)app_id(%d)\n",
|
|
||||||
data->type, data->client.app_id);
|
|
||||||
ret = -EINVAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
atomic_inc(&data->ioctl_count);
|
|
||||||
if (!qseecom.support_bus_scaling) {
|
|
||||||
qsee_disable_clock_vote(data, CLK_DFAB);
|
|
||||||
qsee_disable_clock_vote(data, CLK_SFPB);
|
|
||||||
} else {
|
|
||||||
mutex_lock(&qsee_bw_mutex);
|
|
||||||
qseecom_unregister_bus_bandwidth_needs(data);
|
|
||||||
mutex_unlock(&qsee_bw_mutex);
|
|
||||||
}
|
|
||||||
atomic_dec(&data->ioctl_count);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case QSEECOM_IOCTL_SET_BUS_SCALING_REQ: {
|
|
||||||
/* If crypto clock is not handled by HLOS, return directly. */
|
|
||||||
if (qseecom.no_clock_support) {
|
|
||||||
pr_debug("crypto clock is not handled by HLOS\n");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ((data->client.app_id == 0) ||
|
|
||||||
(data->type != QSEECOM_CLIENT_APP)) {
|
|
||||||
pr_err("set bus scale: invalid handle (%d) appid(%d)\n",
|
|
||||||
data->type, data->client.app_id);
|
|
||||||
ret = -EINVAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
atomic_inc(&data->ioctl_count);
|
|
||||||
ret = qseecom_scale_bus_bandwidth(data, argp);
|
|
||||||
atomic_dec(&data->ioctl_count);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case QSEECOM_IOCTL_LOAD_EXTERNAL_ELF_REQ: {
|
case QSEECOM_IOCTL_LOAD_EXTERNAL_ELF_REQ: {
|
||||||
if (data->type != QSEECOM_GENERIC) {
|
if (data->type != QSEECOM_GENERIC) {
|
||||||
pr_err("load ext elf req: invalid client handle (%d)\n",
|
pr_err("load ext elf req: invalid client handle (%d)\n",
|
||||||
|
@@ -58,7 +58,7 @@ register_securemsm_module(
|
|||||||
"IQSEEComCompat.h",
|
"IQSEEComCompat.h",
|
||||||
"IQSEEComCompatAppLoader.h",
|
"IQSEEComCompatAppLoader.h",
|
||||||
],
|
],
|
||||||
deps = [":smcinvoke_kernel_headers"],
|
deps = [":smcinvoke_kernel_headers", ":qseecom_kernel_headers"],
|
||||||
hdrs = [":smcinvoke_kernel_headers"],
|
hdrs = [":smcinvoke_kernel_headers"],
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -69,14 +69,15 @@ register_securemsm_module(
|
|||||||
"qseecom.c",
|
"qseecom.c",
|
||||||
"ice.h",
|
"ice.h",
|
||||||
],
|
],
|
||||||
deps = [":securemsm_kernel_headers"],
|
deps = [":qseecom_kernel_headers"],
|
||||||
srcs = ["config/sec-kernel_defconfig_qseecom.h"],
|
#srcs = ["config/sec-kernel_defconfig_qseecom.h"],
|
||||||
copts = ["-include", "config/sec-kernel_defconfig_qseecom.h"],
|
#copts = ["-include", "config/sec-kernel_defconfig_qseecom.h"],
|
||||||
)
|
)
|
||||||
|
|
||||||
register_securemsm_module(
|
register_securemsm_module(
|
||||||
name = "tz_log_dlkm",
|
name = "tz_log_dlkm",
|
||||||
path = TZLOG_PATH,
|
path = TZLOG_PATH,
|
||||||
|
deps = [":qseecom_kernel_headers"],
|
||||||
default_srcs = ["tz_log.c"],
|
default_srcs = ["tz_log.c"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@@ -29,7 +29,6 @@
|
|||||||
#include <linux/freezer.h>
|
#include <linux/freezer.h>
|
||||||
#include <linux/ratelimit.h>
|
#include <linux/ratelimit.h>
|
||||||
#include <asm/cacheflush.h>
|
#include <asm/cacheflush.h>
|
||||||
#include <soc/qcom/qseecomi.h>
|
|
||||||
#include <linux/qtee_shmbridge.h>
|
#include <linux/qtee_shmbridge.h>
|
||||||
#include <linux/kthread.h>
|
#include <linux/kthread.h>
|
||||||
#include "smcinvoke.h"
|
#include "smcinvoke.h"
|
||||||
@@ -41,6 +40,7 @@
|
|||||||
#else
|
#else
|
||||||
#include "misc/qseecom_kernel.h"
|
#include "misc/qseecom_kernel.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "misc/qseecomi.h"
|
||||||
|
|
||||||
#define CREATE_TRACE_POINTS
|
#define CREATE_TRACE_POINTS
|
||||||
#include "trace_smcinvoke.h"
|
#include "trace_smcinvoke.h"
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
|
||||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
#include <linux/file.h>
|
#include <linux/file.h>
|
||||||
#include <linux/fs.h>
|
#include <linux/fs.h>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
#if !IS_ENABLED(CONFIG_QSEECOM)
|
#if !IS_ENABLED(CONFIG_QSEECOM)
|
||||||
#include "IQSEEComCompat.h"
|
#include "IQSEEComCompat.h"
|
||||||
#include "IQSEEComCompatAppLoader.h"
|
#include "IQSEEComCompatAppLoader.h"
|
||||||
#include "linux/qseecom.h"
|
#include "linux/qseecom_api.h"
|
||||||
#if IS_ENABLED(CONFIG_QSEECOM_PROXY)
|
#if IS_ENABLED(CONFIG_QSEECOM_PROXY)
|
||||||
#include <linux/qseecom_kernel.h>
|
#include <linux/qseecom_kernel.h>
|
||||||
#else
|
#else
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
# Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
|
# Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
|
||||||
# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
# Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify it
|
# This program is free software; you can redistribute it and/or modify it
|
||||||
# under the terms of the GNU General Public License version 2 as published by
|
# under the terms of the GNU General Public License version 2 as published by
|
||||||
@@ -29,6 +29,9 @@ def run_headers_install(verbose, gen_dir, headers_install, unifdef, prefix, h):
|
|||||||
# ex. out/soong/.temp/sbox/<temp hash value>/out/linux/smcinvoke.h
|
# ex. out/soong/.temp/sbox/<temp hash value>/out/linux/smcinvoke.h
|
||||||
# After the build is complete, you can find the headers that you exposed located in the following gen path:
|
# After the build is complete, you can find the headers that you exposed located in the following gen path:
|
||||||
# out/soong/.intermediates/.../qti_generate_smcinvoke_kernel_headers/gen/
|
# out/soong/.intermediates/.../qti_generate_smcinvoke_kernel_headers/gen/
|
||||||
|
if 'include/uapi' in h:
|
||||||
|
out_h = os.path.join(gen_dir,'include', h[len(prefix):])
|
||||||
|
else:
|
||||||
out_h = os.path.join(gen_dir, h[len(prefix):])
|
out_h = os.path.join(gen_dir, h[len(prefix):])
|
||||||
(out_h_dirname, out_h_basename) = os.path.split(out_h)
|
(out_h_dirname, out_h_basename) = os.path.split(out_h)
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
@@ -54,6 +57,12 @@ def gen_smcinvoke_headers(verbose, gen_dir, headers_install, unifdef, smcinvoke_
|
|||||||
# h will be the relative path from the repo root directory securemsm-kernel ex. <parent directory structure>/securemsm-kernel/linux/smcinvoke.h
|
# h will be the relative path from the repo root directory securemsm-kernel ex. <parent directory structure>/securemsm-kernel/linux/smcinvoke.h
|
||||||
# So we need to split the string and keep the directory structure we want to expose i.e. just linux/smcinvoke.h
|
# So we need to split the string and keep the directory structure we want to expose i.e. just linux/smcinvoke.h
|
||||||
topDirectory = 'securemsm-kernel'
|
topDirectory = 'securemsm-kernel'
|
||||||
|
if 'include/uapi' in h:
|
||||||
|
directorySplitLocation = '/'+ topDirectory +'/'
|
||||||
|
smcinvoke_headers_to_expose_prefix = os.path.join(h.split(directorySplitLocation)[0], topDirectory, 'include', 'uapi') + os.sep
|
||||||
|
if not run_headers_install(verbose, gen_dir, headers_install, unifdef, smcinvoke_headers_to_expose_prefix, h):
|
||||||
|
error_count += 1
|
||||||
|
else:
|
||||||
directorySplitLocation = '/'+ topDirectory +'/'
|
directorySplitLocation = '/'+ topDirectory +'/'
|
||||||
smcinvoke_headers_to_expose_prefix = os.path.join(h.split(directorySplitLocation)[0], topDirectory) + os.sep
|
smcinvoke_headers_to_expose_prefix = os.path.join(h.split(directorySplitLocation)[0], topDirectory) + os.sep
|
||||||
if not run_headers_install(verbose, gen_dir, headers_install, unifdef, smcinvoke_headers_to_expose_prefix, h):
|
if not run_headers_install(verbose, gen_dir, headers_install, unifdef, smcinvoke_headers_to_expose_prefix, h):
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
|
||||||
|
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
#include <linux/debugfs.h>
|
#include <linux/debugfs.h>
|
||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
@@ -17,10 +18,10 @@
|
|||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/dma-buf.h>
|
#include <linux/dma-buf.h>
|
||||||
#include <linux/qcom_scm.h>
|
#include <linux/qcom_scm.h>
|
||||||
#include <soc/qcom/qseecomi.h>
|
|
||||||
#include <linux/qtee_shmbridge.h>
|
#include <linux/qtee_shmbridge.h>
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
#include <linux/version.h>
|
#include <linux/version.h>
|
||||||
|
#include "misc/qseecomi.h"
|
||||||
|
|
||||||
/* QSEE_LOG_BUF_SIZE = 32K */
|
/* QSEE_LOG_BUF_SIZE = 32K */
|
||||||
#define QSEE_LOG_BUF_SIZE 0x8000
|
#define QSEE_LOG_BUF_SIZE 0x8000
|
||||||
|
Reference in New Issue
Block a user