drivers/tee/qcomtee/qcomtee_object.h

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

File Facts

System
Linux kernel
Corpus path
drivers/tee/qcomtee/qcomtee_object.h
Extension
.h
Size
10272 bytes
Lines
317
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_buffer {
	union {
		void *addr;
		void __user *uaddr;
	};
	size_t size;
};

/**
 * struct qcomtee_arg - Argument for QTEE object invocation.
 * @type: type of argument as &enum qcomtee_arg_type.
 * @flags: extra flags.
 * @b: address and size if the type of argument is a buffer.
 * @o: object instance if the type of argument is an object.
 *
 * &qcomtee_arg.flags only accepts %QCOMTEE_ARG_FLAGS_UADDR for now, which
 * states that &qcomtee_arg.b contains a userspace address in uaddr.
 */
struct qcomtee_arg {
	enum qcomtee_arg_type type;
/* 'b.uaddr' holds a __user address. */
#define QCOMTEE_ARG_FLAGS_UADDR BIT(0)
	unsigned int flags;
	union {
		struct qcomtee_buffer b;
		struct qcomtee_object *o;
	};
};

static inline int qcomtee_args_len(struct qcomtee_arg *args)
{
	int i = 0;

	while (args[i].type != QCOMTEE_ARG_TYPE_INV)
		i++;
	return i;
}

/* Context is busy (callback is in progress). */
#define QCOMTEE_OIC_FLAG_BUSY BIT(1)
/* Context needs to notify the current object. */
#define QCOMTEE_OIC_FLAG_NOTIFY BIT(2)
/* Context has shared state with QTEE. */
#define QCOMTEE_OIC_FLAG_SHARED BIT(3)

/**
 * struct qcomtee_object_invoke_ctx - QTEE context for object invocation.
 * @ctx: TEE context for this invocation.
 * @flags: flags for the invocation context.
 * @errno: error code for the invocation.
 * @object: current object invoked in this callback context.
 * @u: array of arguments for the current invocation (+1 for ending arg).
 * @in_msg: inbound buffer shared with QTEE.
 * @out_msg: outbound buffer shared with QTEE.
 * @in_shm: TEE shm allocated for inbound buffer.
 * @out_shm: TEE shm allocated for outbound buffer.
 * @data: extra data attached to this context.
 */
struct qcomtee_object_invoke_ctx {
	struct tee_context *ctx;
	unsigned long flags;
	int errno;

	struct qcomtee_object *object;
	struct qcomtee_arg u[QCOMTEE_ARGS_MAX + 1];

	struct qcomtee_buffer in_msg;
	struct qcomtee_buffer out_msg;
	struct tee_shm *in_shm;
	struct tee_shm *out_shm;

	void *data;
};

static inline struct qcomtee_object_invoke_ctx *
qcomtee_object_invoke_ctx_alloc(struct tee_context *ctx)
{
	struct qcomtee_object_invoke_ctx *oic;

	oic = kzalloc_obj(*oic);
	if (oic)
		oic->ctx = ctx;
	return oic;
}

/**
 * qcomtee_object_do_invoke() - Submit an invocation for an object.
 * @oic: context to use for the current invocation.
 * @object: object being invoked.
 * @op: requested operation on the object.

Annotation

Implementation Notes