drivers/media/platform/qcom/iris/iris_hfi_queue.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/qcom/iris/iris_hfi_queue.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/qcom/iris/iris_hfi_queue.c- Extension
.c- Size
- 8411 bytes
- Lines
- 318
- Domain
- Driver Families
- Bucket
- drivers/media
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/pm_runtime.hiris_core.hiris_hfi_queue.hiris_vpu_common.h
Detected Declarations
function Copyrightfunction iris_hfi_queue_readfunction iris_hfi_queue_cmd_write_lockedfunction iris_hfi_queue_cmd_writefunction iris_hfi_queue_msg_readfunction iris_hfi_queue_dbg_readfunction iris_hfi_queue_set_headerfunction iris_hfi_queue_initfunction iris_hfi_queue_deinitfunction iris_hfi_queues_initfunction iris_hfi_queues_deinit
Annotated Snippet
if (new_read_idx < IFACEQ_QUEUE_SIZE) {
memcpy(packet, read_ptr, packet_size);
} else {
residue = new_read_idx - IFACEQ_QUEUE_SIZE;
memcpy(packet, read_ptr, (packet_size - residue));
memcpy((packet + (packet_size - residue)),
qinfo->kernel_vaddr, residue);
new_read_idx = residue;
}
} else {
new_read_idx = write_idx;
ret = -EBADMSG;
}
queue->rx_req = receive_request;
queue->read_idx = new_read_idx / sizeof(u32);
/* Ensure qhdr is updated in main memory */
mb();
return ret;
}
int iris_hfi_queue_cmd_write_locked(struct iris_core *core, void *pkt, u32 pkt_size)
{
struct iris_iface_q_info *q_info = &core->command_queue;
if (core->state == IRIS_CORE_ERROR || core->state == IRIS_CORE_DEINIT)
return -EINVAL;
if (!iris_hfi_queue_write(q_info, pkt, pkt_size)) {
iris_vpu_raise_interrupt(core);
} else {
dev_err(core->dev, "queue full\n");
return -ENODATA;
}
return 0;
}
int iris_hfi_queue_cmd_write(struct iris_core *core, void *pkt, u32 pkt_size)
{
int ret;
ret = pm_runtime_resume_and_get(core->dev);
if (ret < 0)
goto exit;
mutex_lock(&core->lock);
ret = iris_hfi_queue_cmd_write_locked(core, pkt, pkt_size);
if (ret) {
mutex_unlock(&core->lock);
goto exit;
}
mutex_unlock(&core->lock);
pm_runtime_put_autosuspend(core->dev);
return 0;
exit:
pm_runtime_put_sync(core->dev);
return ret;
}
int iris_hfi_queue_msg_read(struct iris_core *core, void *pkt)
{
struct iris_iface_q_info *q_info = &core->message_queue;
int ret = 0;
mutex_lock(&core->lock);
if (core->state != IRIS_CORE_INIT) {
ret = -EINVAL;
goto unlock;
}
if (iris_hfi_queue_read(q_info, pkt)) {
ret = -ENODATA;
goto unlock;
}
unlock:
mutex_unlock(&core->lock);
return ret;
}
int iris_hfi_queue_dbg_read(struct iris_core *core, void *pkt)
{
Annotation
- Immediate include surface: `linux/pm_runtime.h`, `iris_core.h`, `iris_hfi_queue.h`, `iris_vpu_common.h`.
- Detected declarations: `function Copyright`, `function iris_hfi_queue_read`, `function iris_hfi_queue_cmd_write_locked`, `function iris_hfi_queue_cmd_write`, `function iris_hfi_queue_msg_read`, `function iris_hfi_queue_dbg_read`, `function iris_hfi_queue_set_header`, `function iris_hfi_queue_init`, `function iris_hfi_queue_deinit`, `function iris_hfi_queues_init`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.