securemsm-kernel: smcinvoke: expand API

Expand SMCInvoke API to support possible
future requirements.

Change-Id: I9f6031751489c43a27afc2860a1cb9f87c7ebb87
Signed-off-by: Reut Zysman <quic_rzysman@quicinc.com>
This commit is contained in:
Reut Zysman
2023-05-16 13:33:58 -07:00
committed by Gerrit - the friendly Code Review server
parent cdef6720fe
commit 780711b60c
3 changed files with 25 additions and 17 deletions

View File

@@ -20,8 +20,8 @@ struct smcinvoke_buf {
struct smcinvoke_obj { struct smcinvoke_obj {
__s64 fd; __s64 fd;
__s32 cb_server_fd; __s64 cb_server_fd;
__s32 reserved; __s64 reserved;
}; };
union smcinvoke_arg { union smcinvoke_arg {
@@ -36,6 +36,7 @@ union smcinvoke_arg {
* @result - result of invoke operation * @result - result of invoke operation
* @argsize - size of each of arguments * @argsize - size of each of arguments
* @args - args is pointer to buffer having all arguments * @args - args is pointer to buffer having all arguments
* @reserved: IN/OUT: Usage is not defined but should be set to 0
*/ */
struct smcinvoke_cmd_req { struct smcinvoke_cmd_req {
__u32 op; __u32 op;
@@ -43,42 +44,45 @@ struct smcinvoke_cmd_req {
__s32 result; __s32 result;
__u32 argsize; __u32 argsize;
__u64 args; __u64 args;
__s64 reserved;
}; };
/* /*
* struct smcinvoke_accept: structure to process CB req from TEE * struct smcinvoke_accept: structure to process CB req from TEE
* @has_resp: IN: Whether IOCTL is carrying response data * @has_resp: IN: Whether IOCTL is carrying response data
* @txn_id: OUT: An id that should be passed as it is for response
* @result: IN: Outcome of operation op * @result: IN: Outcome of operation op
* @cbobj_id: OUT: Callback object which is target of operation op
* @op: OUT: Operation to be performed on target object * @op: OUT: Operation to be performed on target object
* @counts: OUT: Number of arguments, embedded in buffer pointed by * @counts: OUT: Number of arguments, embedded in buffer pointed by
* buf_addr, to complete operation * buf_addr, to complete operation
* @reserved: IN/OUT: Usage is not defined but should be set to 0. * @reserved: IN/OUT: Usage is not defined but should be set to 0.
* @argsize: IN: Size of any argument, all of equal size, embedded * @argsize: IN: Size of any argument, all of equal size, embedded
* in buffer pointed by buf_addr * in buffer pointed by buf_addr
* @txn_id: OUT: An id that should be passed as it is for response
* @cbobj_id: OUT: Callback object which is target of operation op
* @buf_len: IN: Len of buffer pointed by buf_addr * @buf_len: IN: Len of buffer pointed by buf_addr
* @buf_addr: IN: Buffer containing all arguments which are needed * @buf_addr: IN: Buffer containing all arguments which are needed
* to complete operation op * to complete operation op
*/ */
struct smcinvoke_accept { struct smcinvoke_accept {
__u32 has_resp; __u32 has_resp;
__u32 txn_id;
__s32 result; __s32 result;
__s32 cbobj_id;
__u32 op; __u32 op;
__u32 counts; __u32 counts;
__s32 reserved; __s32 reserved;
__u32 argsize; __u32 argsize;
__u64 txn_id;
__s64 cbobj_id;
__u64 buf_len; __u64 buf_len;
__u64 buf_addr; __u64 buf_addr;
}; };
/* /*
* @cb_buf_size: IN: Max buffer size for any callback obj implemented by client * @cb_buf_size: IN: Max buffer size for any callback obj implemented by client
* @reserved: IN/OUT: Usage is not defined but should be set to 0
*/ */
struct smcinvoke_server { struct smcinvoke_server {
__u32 cb_buf_size; __u64 cb_buf_size;
__s64 reserved;
}; };
#define SMCINVOKE_IOC_MAGIC 0x98 #define SMCINVOKE_IOC_MAGIC 0x98
@@ -93,7 +97,7 @@ struct smcinvoke_server {
_IOWR(SMCINVOKE_IOC_MAGIC, 3, struct smcinvoke_server) _IOWR(SMCINVOKE_IOC_MAGIC, 3, struct smcinvoke_server)
#define SMCINVOKE_IOCTL_ACK_LOCAL_OBJ \ #define SMCINVOKE_IOCTL_ACK_LOCAL_OBJ \
_IOWR(SMCINVOKE_IOC_MAGIC, 4, __s32) _IOWR(SMCINVOKE_IOC_MAGIC, 4, __s64)
/* /*
* smcinvoke logging buffer is for communicating with the smcinvoke driver additional * smcinvoke logging buffer is for communicating with the smcinvoke driver additional

View File

@@ -20,8 +20,8 @@ struct smcinvoke_buf {
struct smcinvoke_obj { struct smcinvoke_obj {
__s64 fd; __s64 fd;
__s32 cb_server_fd; __s64 cb_server_fd;
__s32 reserved; __s64 reserved;
}; };
union smcinvoke_arg { union smcinvoke_arg {
@@ -36,6 +36,7 @@ union smcinvoke_arg {
* @result - result of invoke operation * @result - result of invoke operation
* @argsize - size of each of arguments * @argsize - size of each of arguments
* @args - args is pointer to buffer having all arguments * @args - args is pointer to buffer having all arguments
* @reserved: IN/OUT: Usage is not defined but should be set to 0
*/ */
struct smcinvoke_cmd_req { struct smcinvoke_cmd_req {
__u32 op; __u32 op;
@@ -43,42 +44,45 @@ struct smcinvoke_cmd_req {
__s32 result; __s32 result;
__u32 argsize; __u32 argsize;
__u64 args; __u64 args;
__s64 reserved;
}; };
/* /*
* struct smcinvoke_accept: structure to process CB req from TEE * struct smcinvoke_accept: structure to process CB req from TEE
* @has_resp: IN: Whether IOCTL is carrying response data * @has_resp: IN: Whether IOCTL is carrying response data
* @txn_id: OUT: An id that should be passed as it is for response
* @result: IN: Outcome of operation op * @result: IN: Outcome of operation op
* @cbobj_id: OUT: Callback object which is target of operation op
* @op: OUT: Operation to be performed on target object * @op: OUT: Operation to be performed on target object
* @counts: OUT: Number of arguments, embedded in buffer pointed by * @counts: OUT: Number of arguments, embedded in buffer pointed by
* buf_addr, to complete operation * buf_addr, to complete operation
* @reserved: IN/OUT: Usage is not defined but should be set to 0. * @reserved: IN/OUT: Usage is not defined but should be set to 0.
* @argsize: IN: Size of any argument, all of equal size, embedded * @argsize: IN: Size of any argument, all of equal size, embedded
* in buffer pointed by buf_addr * in buffer pointed by buf_addr
* @txn_id: OUT: An id that should be passed as it is for response
* @cbobj_id: OUT: Callback object which is target of operation op
* @buf_len: IN: Len of buffer pointed by buf_addr * @buf_len: IN: Len of buffer pointed by buf_addr
* @buf_addr: IN: Buffer containing all arguments which are needed * @buf_addr: IN: Buffer containing all arguments which are needed
* to complete operation op * to complete operation op
*/ */
struct smcinvoke_accept { struct smcinvoke_accept {
__u32 has_resp; __u32 has_resp;
__u32 txn_id;
__s32 result; __s32 result;
__s32 cbobj_id;
__u32 op; __u32 op;
__u32 counts; __u32 counts;
__s32 reserved; __s32 reserved;
__u32 argsize; __u32 argsize;
__u64 txn_id;
__s64 cbobj_id;
__u64 buf_len; __u64 buf_len;
__u64 buf_addr; __u64 buf_addr;
}; };
/* /*
* @cb_buf_size: IN: Max buffer size for any callback obj implemented by client * @cb_buf_size: IN: Max buffer size for any callback obj implemented by client
* @reserved: IN/OUT: Usage is not defined but should be set to 0
*/ */
struct smcinvoke_server { struct smcinvoke_server {
__u32 cb_buf_size; __u64 cb_buf_size;
__s64 reserved;
}; };
#define SMCINVOKE_IOC_MAGIC 0x98 #define SMCINVOKE_IOC_MAGIC 0x98
@@ -93,7 +97,7 @@ struct smcinvoke_server {
_IOWR(SMCINVOKE_IOC_MAGIC, 3, struct smcinvoke_server) _IOWR(SMCINVOKE_IOC_MAGIC, 3, struct smcinvoke_server)
#define SMCINVOKE_IOCTL_ACK_LOCAL_OBJ \ #define SMCINVOKE_IOCTL_ACK_LOCAL_OBJ \
_IOWR(SMCINVOKE_IOC_MAGIC, 4, __s32) _IOWR(SMCINVOKE_IOC_MAGIC, 4, __s64)
/* /*
* smcinvoke logging buffer is for communicating with the smcinvoke driver additional * smcinvoke logging buffer is for communicating with the smcinvoke driver additional

View File

@@ -2085,7 +2085,7 @@ static int marshal_in_tzcb_req(const struct smcinvoke_cb_txn *cb_txn,
user_req->txn_id = cb_txn->txn_id; user_req->txn_id = cb_txn->txn_id;
if (get_uhandle_from_tzhandle(tzcb_req->hdr.tzhandle, srvr_id, if (get_uhandle_from_tzhandle(tzcb_req->hdr.tzhandle, srvr_id,
&user_req->cbobj_id, TAKE_LOCK, (int32_t*)(&user_req->cbobj_id), TAKE_LOCK,
SMCINVOKE_OBJ_TYPE_TZ_OBJ)) { SMCINVOKE_OBJ_TYPE_TZ_OBJ)) {
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;