drivers/tee/qcomtee/qcomtee.h

Source file repositories/reference/linux-study-clean/drivers/tee/qcomtee/qcomtee.h

File Facts

System
Linux kernel
Corpus path
drivers/tee/qcomtee/qcomtee.h
Extension
.h
Size
6106 bytes
Lines
186
Domain
Driver Families
Bucket
drivers/tee
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct qcomtee {
	struct tee_device *teedev;
	struct tee_shm_pool *pool;
	struct tee_context *ctx;
	struct qcomtee_object_invoke_ctx oic;
	struct workqueue_struct *wq;
	struct xarray xa_local_objects;
	u32 xa_last_id;
	u32 qtee_version;
};

void qcomtee_fetch_async_reqs(struct qcomtee_object_invoke_ctx *oic);
struct qcomtee_object *qcomtee_idx_erase(struct qcomtee_object_invoke_ctx *oic,
					 u32 idx);

struct tee_shm_pool *qcomtee_shm_pool_alloc(void);
void qcomtee_msg_buffers_free(struct qcomtee_object_invoke_ctx *oic);
int qcomtee_msg_buffers_alloc(struct qcomtee_object_invoke_ctx *oic,
			      struct qcomtee_arg *u);

/**
 * qcomtee_object_do_invoke_internal() - Submit an invocation for an object.
 * @oic: context to use for the current invocation.
 * @object: object being invoked.
 * @op: requested operation on the object.
 * @u: array of arguments for the current invocation.
 * @result: result returned from QTEE.
 *
 * The caller is responsible for keeping track of the refcount for each
 * object, including @object. On return, the caller loses ownership of all
 * input objects of type %QCOMTEE_OBJECT_TYPE_CB.
 *
 * Return: On success, returns 0; on failure, returns < 0.
 */
int qcomtee_object_do_invoke_internal(struct qcomtee_object_invoke_ctx *oic,
				      struct qcomtee_object *object, u32 op,
				      struct qcomtee_arg *u, int *result);

/**
 * struct qcomtee_context_data - Clients' or supplicants' context.
 * @qtee_objects_idr: QTEE objects in this context.
 * @qtee_lock: mutex for @qtee_objects_idr.
 * @reqs_idr: requests in this context that hold ID.
 * @reqs_list: FIFO for requests in PROCESSING or QUEUED state.
 * @reqs_lock: mutex for @reqs_idr, @reqs_list and request states.
 * @req_c: completion used when the supplicant is waiting for requests.
 * @released: state of this context.
 */
struct qcomtee_context_data {
	struct idr qtee_objects_idr;
	/* Synchronize access to @qtee_objects_idr. */
	struct mutex qtee_lock;

	struct idr reqs_idr;
	struct list_head reqs_list;
	/* Synchronize access to @reqs_idr, @reqs_list and updating requests states. */
	struct mutex reqs_lock;

	struct completion req_c;

	bool released;
};

int qcomtee_context_add_qtee_object(struct tee_param *param,
				    struct qcomtee_object *object,
				    struct tee_context *ctx);
int qcomtee_context_find_qtee_object(struct qcomtee_object **object,
				     struct tee_param *param,
				     struct tee_context *ctx);
void qcomtee_context_del_qtee_object(struct tee_param *param,
				     struct tee_context *ctx);

int qcomtee_objref_to_arg(struct qcomtee_arg *arg, struct tee_param *param,
			  struct tee_context *ctx);
int qcomtee_objref_from_arg(struct tee_param *param, struct qcomtee_arg *arg,
			    struct tee_context *ctx);

/* OBJECTS: */

/* (1) User Object API. */

int is_qcomtee_user_object(struct qcomtee_object *object);
void qcomtee_user_object_set_notify(struct qcomtee_object *object, bool notify);
void qcomtee_requests_destroy(struct qcomtee_context_data *ctxdata);
int qcomtee_user_param_to_object(struct qcomtee_object **object,
				 struct tee_param *param,
				 struct tee_context *ctx);
int qcomtee_user_param_from_object(struct tee_param *param,
				   struct qcomtee_object *object,
				   struct tee_context *ctx);

Annotation

Implementation Notes