From 2adcd7e3cc56bb4ec89dad2f3b3e6bc91bf7923d Mon Sep 17 00:00:00 2001 From: "ChenZheng (G)" Date: Fri, 3 Nov 2023 11:40:24 +0800 Subject: [PATCH] change agent buffer in ccos --- src/inc/tc_ns_client.h | 1 + src/teecd/tee_agent.c | 12 ++++++++++++ src/teecd/tee_agent.h | 3 ++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/inc/tc_ns_client.h b/src/inc/tc_ns_client.h index 6ca68c9..2f75f0a 100644 --- a/src/inc/tc_ns_client.h +++ b/src/inc/tc_ns_client.h @@ -159,6 +159,7 @@ struct AgentIoctlArgs { #define TC_NS_CLIENT_IOCTL_PORTAL_WORK _IOWR(TC_NS_CLIENT_IOC_MAGIC, 25, struct AgentIoctlArgs) #endif #define TC_NS_CLIENT_IOCTL_GET_TEE_INFO _IOWR(TC_NS_CLIENT_IOC_MAGIC, 26, TC_NS_TEE_Info) +#define TC_NS_CLIENT_IOCTL_CHECK_CCOS _IOWR(TC_NS_CLIENT_IOC_MAGIC, 32, unsigned int) TEEC_Result TEEC_CheckOperation(const TEEC_Operation *operation); #endif diff --git a/src/teecd/tee_agent.c b/src/teecd/tee_agent.c index 8991ab5..6d7f526 100644 --- a/src/teecd/tee_agent.c +++ b/src/teecd/tee_agent.c @@ -35,6 +35,7 @@ int AgentInit(unsigned int id, void **control) { int ret; struct AgentIoctlArgs args = { 0 }; + uint32_t check_ccos = 0; if (control == NULL) { return -1; @@ -50,6 +51,17 @@ int AgentInit(unsigned int id, void **control) } args.id = id; args.bufferSize = TRANS_BUFF_SIZE; + + ret = ioctl(fd, TC_NS_CLIENT_IOCTL_CHECK_CCOS, &check_ccos); + if (ret != 0) { + (void)close(fd); + tloge("private ioctl failed\n"); + return -1; + } + if (check_ccos != 0) { + args.bufferSize = TRANS_BUFF_SIZE_CCOS; + } + ret = ioctl(fd, TC_NS_CLIENT_IOCTL_REGISTER_AGENT, &args); if (ret != 0) { (void)close(fd); diff --git a/src/teecd/tee_agent.h b/src/teecd/tee_agent.h index 576e756..0f7f2cb 100644 --- a/src/teecd/tee_agent.h +++ b/src/teecd/tee_agent.h @@ -12,7 +12,8 @@ #ifndef LIBTEEC_TEE_AGENT_H #define LIBTEEC_TEE_AGENT_H -#define TRANS_BUFF_SIZE (4 * 1024) /* agent transfer share buffer size */ +#define TRANS_BUFF_SIZE (4 * 1024) /* agent transfer share buffer size */ +#define TRANS_BUFF_SIZE_CCOS (512 * 1024) /* agent transfer share buffer size on ccos */ int AgentInit(unsigned int id, void **control); void AgentExit(unsigned int id, int fd); -- Gitee