Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a14b31bc authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ARM: dts: msm: Add smcinvoke node for SM8150"

parents b07156bd 18c5591c
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
* SMCInvoke driver to provide transport between TZ and Linux

Required properties:
- compatible : Should be "qcom,smcinvoke"
- reg : should contain memory region address reserved for loading secure apps.

Example:
	qcom_smcinvoke: smcinvoke@87900000 {
		compatible = "qcom,smcinvoke";
		reg = <0x87900000 0x2200000>;
	};
+6 −0
Original line number Diff line number Diff line
@@ -2885,6 +2885,12 @@
		qcom,qsee-reentrancy-support = <2>;
	};

	qcom_smcinvoke: smcinvoke@87900000 {
		compatible = "qcom,smcinvoke";
		reg = <0x87900000 0x2200000>;
		reg-names = "secapp-region";
	};

	qcom_rng: qrng@793000 {
		compatible = "qcom,msm-rng";
		reg = <0x793000 0x1000>;
+1413 −195

File changed.

Preview size limit exceeded, changes collapsed.

+62 −24
Original line number Diff line number Diff line
@@ -14,38 +14,76 @@

#include <linux/types.h>

#define object_op_METHOD_MASK   ((uint32_t)0x0000FFFFu)
#define object_op_RELEASE       (object_op_METHOD_MASK - 0)
#define object_op_RETAIN        (object_op_METHOD_MASK - 1)
/*
 * Method bits are not modified by transport layers.  These describe the
 * method (member function) being requested by the client.
 */
#define OBJECT_OP_METHOD_MASK     (0x0000FFFFu)
#define OBJECT_OP_METHODID(op)    ((op) & OBJECT_OP_METHOD_MASK)
#define OBJECT_OP_RELEASE       (OBJECT_OP_METHOD_MASK - 0)
#define OBJECT_OP_RETAIN        (OBJECT_OP_METHOD_MASK - 1)
#define OBJECT_OP_MAP_REGION    0

#define object_counts_max_BI   0xF
#define object_counts_max_BO   0xF
#define object_counts_max_OI   0xF
#define object_counts_max_OO   0xF
#define OBJECT_COUNTS_MAX_BI   0xF
#define OBJECT_COUNTS_MAX_BO   0xF
#define OBJECT_COUNTS_MAX_OI   0xF
#define OBJECT_COUNTS_MAX_OO   0xF

/* unpack counts */

#define object_counts_num_BI(k)  ((size_t) (((k) >> 0) & object_counts_max_BI))
#define object_counts_num_BO(k)  ((size_t) (((k) >> 4) & object_counts_max_BO))
#define object_counts_num_OI(k)  ((size_t) (((k) >> 8) & object_counts_max_OI))
#define object_counts_num_OO(k)  ((size_t) (((k) >> 12) & object_counts_max_OO))
#define object_counts_num_buffers(k)	\
			(object_counts_num_BI(k) + object_counts_num_BO(k))
#define OBJECT_COUNTS_NUM_BI(k)  ((size_t) (((k) >> 0) & OBJECT_COUNTS_MAX_BI))
#define OBJECT_COUNTS_NUM_BO(k)  ((size_t) (((k) >> 4) & OBJECT_COUNTS_MAX_BO))
#define OBJECT_COUNTS_NUM_OI(k)  ((size_t) (((k) >> 8) & OBJECT_COUNTS_MAX_OI))
#define OBJECT_COUNTS_NUM_OO(k)  ((size_t) (((k) >> 12) & OBJECT_COUNTS_MAX_OO))
#define OBJECT_COUNTS_NUM_buffers(k)	\
			(OBJECT_COUNTS_NUM_BI(k) + OBJECT_COUNTS_NUM_BO(k))

#define object_counts_num_objects(k)	\
			(object_counts_num_OI(k) + object_counts_num_OO(k))
#define OBJECT_COUNTS_NUM_objects(k)	\
			(OBJECT_COUNTS_NUM_OI(k) + OBJECT_COUNTS_NUM_OO(k))

/* Indices into args[] */

#define object_counts_index_BI(k)   0
#define object_counts_index_BO(k)		\
			(object_counts_index_BI(k) + object_counts_num_BI(k))
#define object_counts_index_OI(k)		\
			(object_counts_index_BO(k) + object_counts_num_BO(k))
#define object_counts_index_OO(k)		\
			(object_counts_index_OI(k) + object_counts_num_OI(k))
#define object_counts_total(k)		\
			(object_counts_index_OO(k) + object_counts_num_OO(k))
#define OBJECT_COUNTS_INDEX_BI(k)   0
#define OBJECT_COUNTS_INDEX_BO(k)		\
			(OBJECT_COUNTS_INDEX_BI(k) + OBJECT_COUNTS_NUM_BI(k))
#define OBJECT_COUNTS_INDEX_OI(k)		\
			(OBJECT_COUNTS_INDEX_BO(k) + OBJECT_COUNTS_NUM_BO(k))
#define OBJECT_COUNTS_INDEX_OO(k)		\
			(OBJECT_COUNTS_INDEX_OI(k) + OBJECT_COUNTS_NUM_OI(k))
#define OBJECT_COUNTS_TOTAL(k)		\
			(OBJECT_COUNTS_INDEX_OO(k) + OBJECT_COUNTS_NUM_OO(k))

#define OBJECT_COUNTS_PACK(in_bufs, out_bufs, in_objs, out_objs) \
	((uint32_t) ((in_bufs) | ((out_bufs) << 4) | \
			((in_objs) << 8) | ((out_objs) << 12)))


/* Object_invoke return codes */

#define OBJECT_isOK(err)        ((err) == 0)
#define OBJECT_isERROR(err)     ((err) != 0)

/* Generic error codes */

#define OBJECT_OK                  0   /* non-specific success code */
#define OBJECT_ERROR               1   /* non-specific error */
#define OBJECT_ERROR_INVALID       2   /* unsupported/unrecognized request */
#define OBJECT_ERROR_SIZE_IN       3   /* supplied buffer/string too large */
#define OBJECT_ERROR_SIZE_OUT      4   /* supplied output buffer too small */

#define OBJECT_ERROR_USERBASE     10   /* start of user-defined error range */

/* Transport layer error codes */

#define OBJECT_ERROR_DEFUNCT     -90   /* object no longer exists */
#define OBJECT_ERROR_ABORT       -91   /* calling thread must exit */
#define OBJECT_ERROR_BADOBJ      -92   /* invalid object context */
#define OBJECT_ERROR_NOSLOTS     -93   /* caller's object table full */
#define OBJECT_ERROR_MAXARGS     -94   /* too many args */
#define OBJECT_ERROR_MAXDATA     -95   /* buffers too large */
#define OBJECT_ERROR_UNAVAIL     -96   /* the request could not be processed */
#define OBJECT_ERROR_KMEM        -97   /* kernel out of memory */
#define OBJECT_ERROR_REMOTE      -98   /* local method sent to remote object */
#define OBJECT_ERROR_BUSY        -99   /* Object is busy */

#endif /* __SMCINVOKE_OBJECT_H */
+57 −11
Original line number Diff line number Diff line
@@ -13,7 +13,8 @@ struct smcinvoke_buf {

struct smcinvoke_obj {
	int64_t fd;
	int64_t		reserved;
	int32_t cb_server_fd;
	int32_t reserved;
};

union smcinvoke_arg {
@@ -34,7 +35,43 @@ struct smcinvoke_cmd_req {
	uint32_t counts;
	int32_t result;
	uint32_t argsize;
	uint64_t __user args;
	uint64_t args;
};

/*
 * struct smcinvoke_accept: structure to process CB req from TEE
 * @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
 * @cbobj_id: OUT: Callback object which is target of operation op
 * @op: OUT: Operation to be performed on target object
 * @counts: OUT: Number of arguments, embedded in buffer pointed by
 *               buf_addr, to complete operation
 * @reserved: IN/OUT: Usage is not defined but should be set to 0.
 * @argsize: IN: Size of any argument, all of equal size, embedded
 *               in 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
 *                to complete operation op
 */
struct smcinvoke_accept {
	uint32_t has_resp;
	uint32_t txn_id;
	int32_t result;
	int32_t cbobj_id;
	uint32_t op;
	uint32_t counts;
	int32_t reserved;
	uint32_t argsize;
	uint64_t buf_len;
	uint64_t buf_addr;
};

/*
 * @cb_buf_size: IN: Max buffer size for any callback obj implemented by client
 */
struct smcinvoke_server {
	uint32_t cb_buf_size;
};

#define SMCINVOKE_IOC_MAGIC    0x98
@@ -42,4 +79,13 @@ struct smcinvoke_cmd_req {
#define SMCINVOKE_IOCTL_INVOKE_REQ \
	_IOWR(SMCINVOKE_IOC_MAGIC, 1, struct smcinvoke_cmd_req)

#define SMCINVOKE_IOCTL_ACCEPT_REQ \
	_IOWR(SMCINVOKE_IOC_MAGIC, 2, struct smcinvoke_accept)

#define SMCINVOKE_IOCTL_SERVER_REQ \
	_IOWR(SMCINVOKE_IOC_MAGIC, 3, struct smcinvoke_server)

#define SMCINVOKE_IOCTL_ACK_LOCAL_OBJ \
	_IOWR(SMCINVOKE_IOC_MAGIC, 4, int32_t)

#endif /* _UAPI_SMCINVOKE_H_ */