drivers/tee/qcomtee/call.c
Source file repositories/reference/linux-study-clean/drivers/tee/qcomtee/call.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/tee/qcomtee/call.c- Extension
.c- Size
- 22546 bytes
- Lines
- 819
- 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.
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/slab.hlinux/tee.hlinux/platform_device.hlinux/xarray.hqcomtee.h
Detected Declarations
function Copyrightfunction del_qtee_objectfunction qcomtee_context_add_qtee_objectfunction qcomtee_context_find_qtee_objectfunction qcomtee_context_del_qtee_objectfunction qcomtee_objref_to_argfunction qcomtee_objref_from_argfunction qcomtee_params_to_argsfunction qcomtee_params_from_argsfunction qcomtee_arg_for_eachfunction qcomtee_params_checkfunction qcomtee_root_object_checkfunction qcomtee_object_invokefunction qcomtee_arg_for_each_input_objectfunction qcomtee_supp_recvfunction qcomtee_supp_sendfunction qcomtee_openfunction qcomtee_close_contextfunction qcomtee_releasefunction qcomtee_get_versionfunction qcomtee_get_qtee_feature_listfunction qcomtee_probefunction qcomtee_remove
Annotated Snippet
switch (params[i].attr) {
case TEE_IOCTL_PARAM_ATTR_TYPE_UBUF_INPUT:
case TEE_IOCTL_PARAM_ATTR_TYPE_UBUF_OUTPUT:
u[i].flags = QCOMTEE_ARG_FLAGS_UADDR;
u[i].b.uaddr = params[i].u.ubuf.uaddr;
u[i].b.size = params[i].u.ubuf.size;
if (params[i].attr ==
TEE_IOCTL_PARAM_ATTR_TYPE_UBUF_INPUT)
u[i].type = QCOMTEE_ARG_TYPE_IB;
else /* TEE_IOCTL_PARAM_ATTR_TYPE_UBUF_OUTPUT */
u[i].type = QCOMTEE_ARG_TYPE_OB;
break;
case TEE_IOCTL_PARAM_ATTR_TYPE_OBJREF_INPUT:
u[i].type = QCOMTEE_ARG_TYPE_IO;
if (qcomtee_objref_to_arg(&u[i], ¶ms[i], ctx))
goto out_failed;
break;
case TEE_IOCTL_PARAM_ATTR_TYPE_OBJREF_OUTPUT:
u[i].type = QCOMTEE_ARG_TYPE_OO;
u[i].o = NULL_QCOMTEE_OBJECT;
break;
default:
goto out_failed;
}
}
return 0;
out_failed:
/* Undo qcomtee_objref_to_arg(). */
for (i--; i >= 0; i--) {
if (u[i].type != QCOMTEE_ARG_TYPE_IO)
continue;
qcomtee_user_object_set_notify(u[i].o, false);
/* See docs for qcomtee_objref_to_arg() for double put. */
if (typeof_qcomtee_object(u[i].o) == QCOMTEE_OBJECT_TYPE_CB)
qcomtee_object_put(u[i].o);
qcomtee_object_put(u[i].o);
}
return -EINVAL;
}
/**
* qcomtee_params_from_args() - Convert QTEE arguments to TEE parameters.
* @params: TEE parameters.
* @u: QTEE arguments.
* @num_params: number of elements in the parameter array.
* @ctx: context in which the conversion should happen.
*
* @u should have already been initialized by qcomtee_params_to_args().
* This also represents the end of a QTEE invocation that started with
* qcomtee_params_to_args() by releasing %QCOMTEE_ARG_TYPE_IO objects.
*
* Return: On success, returns 0; on failure, returns < 0.
*/
static int qcomtee_params_from_args(struct tee_param *params,
struct qcomtee_arg *u, int num_params,
struct tee_context *ctx)
{
int i, np;
qcomtee_arg_for_each(np, u) {
switch (u[np].type) {
case QCOMTEE_ARG_TYPE_OB:
/* TEE_IOCTL_PARAM_ATTR_TYPE_UBUF_OUTPUT */
params[np].u.ubuf.size = u[np].b.size;
break;
case QCOMTEE_ARG_TYPE_IO:
/* IEE_IOCTL_PARAM_ATTR_TYPE_OBJREF_INPUT */
qcomtee_object_put(u[np].o);
break;
case QCOMTEE_ARG_TYPE_OO:
/* TEE_IOCTL_PARAM_ATTR_TYPE_OBJREF_OUTPUT */
if (qcomtee_objref_from_arg(¶ms[np], &u[np], ctx))
goto out_failed;
break;
case QCOMTEE_ARG_TYPE_IB:
default:
break;
}
}
Annotation
- Immediate include surface: `linux/slab.h`, `linux/tee.h`, `linux/platform_device.h`, `linux/xarray.h`, `qcomtee.h`.
- Detected declarations: `function Copyright`, `function del_qtee_object`, `function qcomtee_context_add_qtee_object`, `function qcomtee_context_find_qtee_object`, `function qcomtee_context_del_qtee_object`, `function qcomtee_objref_to_arg`, `function qcomtee_objref_from_arg`, `function qcomtee_params_to_args`, `function qcomtee_params_from_args`, `function qcomtee_arg_for_each`.
- Atlas domain: Driver Families / drivers/tee.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.