drivers/accel/qaic/qaic_control.c
Source file repositories/reference/linux-study-clean/drivers/accel/qaic/qaic_control.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/accel/qaic/qaic_control.c- Extension
.c- Size
- 43633 bytes
- Lines
- 1605
- Domain
- Driver Families
- Bucket
- drivers/accel
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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.
- 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
asm/byteorder.hlinux/completion.hlinux/crc32.hlinux/delay.hlinux/dma-mapping.hlinux/kref.hlinux/list.hlinux/mhi.hlinux/mm.hlinux/moduleparam.hlinux/mutex.hlinux/overflow.hlinux/pci.hlinux/scatterlist.hlinux/sched/signal.hlinux/types.hlinux/uaccess.hlinux/workqueue.hlinux/wait.hdrm/drm_device.hdrm/drm_file.huapi/drm/qaic_accel.hqaic.h
Detected Declarations
struct manage_msgstruct wire_msg_hdrstruct wire_msgstruct wire_trans_hdrstruct wrapper_msgstruct wrapper_liststruct wire_trans_passthroughstruct wire_addr_size_pairstruct wire_trans_dma_xferstruct wire_trans_dma_xfer_contstruct wire_trans_activate_to_devstruct wire_trans_activate_from_devstruct wire_trans_deactivate_from_devstruct wire_trans_terminate_to_devstruct wire_trans_terminate_from_devstruct wire_trans_status_to_devstruct wire_trans_status_from_devstruct wire_trans_validate_part_to_devstruct wire_trans_validate_part_from_devstruct xfer_queue_elemstruct dma_xferstruct ioctl_resourcesstruct resp_workfunction onefunction gen_crcfunction gen_crc_stubfunction valid_crcfunction valid_crc_stubfunction free_wrapperfunction save_dbc_buffunction free_dbc_buffunction free_dma_xfersfunction list_for_each_entry_safefunction encode_passthroughfunction find_and_map_user_pagesfunction encode_addr_size_pairsfunction cleanup_xferfunction encode_dmafunction encode_activatefunction encode_deactivatefunction encode_statusfunction encode_messagefunction decode_passthroughfunction decode_activatefunction decode_deactivatefunction decode_statusfunction decode_messagefunction list_for_each_entry
Annotated Snippet
struct manage_msg {
u32 len;
u32 count;
u8 data[];
};
/*
* wire encoding structures for the manage protocol.
* All fields are little endian on the wire
*/
struct wire_msg_hdr {
__le32 crc32; /* crc of everything following this field in the message */
__le32 magic_number;
__le32 sequence_number;
__le32 len; /* length of this message */
__le32 count; /* number of transactions in this message */
__le32 handle; /* unique id to track the resources consumed */
__le32 partition_id; /* partition id for the request (signed) */
__le32 padding; /* must be 0 */
} __packed;
struct wire_msg {
struct wire_msg_hdr hdr;
u8 data[];
} __packed;
struct wire_trans_hdr {
__le32 type;
__le32 len;
} __packed;
/* Each message sent from driver to device are organized in a list of wrapper_msg */
struct wrapper_msg {
struct list_head list;
struct kref ref_count;
u32 len; /* length of data to transfer */
struct wrapper_list *head;
union {
struct wire_msg msg;
struct wire_trans_hdr trans;
};
};
struct wrapper_list {
struct list_head list;
spinlock_t lock; /* Protects the list state during additions and removals */
};
struct wire_trans_passthrough {
struct wire_trans_hdr hdr;
u8 data[];
} __packed;
struct wire_addr_size_pair {
__le64 addr;
__le64 size;
} __packed;
struct wire_trans_dma_xfer {
struct wire_trans_hdr hdr;
__le32 tag;
__le32 count;
__le32 dma_chunk_id;
__le32 padding;
struct wire_addr_size_pair data[];
} __packed;
/* Initiated by device to continue the DMA xfer of a large piece of data */
struct wire_trans_dma_xfer_cont {
struct wire_trans_hdr hdr;
__le32 dma_chunk_id;
__le32 padding;
__le64 xferred_size;
} __packed;
struct wire_trans_activate_to_dev {
struct wire_trans_hdr hdr;
__le64 req_q_addr;
__le64 rsp_q_addr;
__le32 req_q_size;
__le32 rsp_q_size;
__le32 buf_len;
__le32 options; /* unused, but BIT(16) has meaning to the device */
} __packed;
struct wire_trans_activate_from_dev {
struct wire_trans_hdr hdr;
__le32 status;
__le32 dbc_id;
__le64 options; /* unused */
Annotation
- Immediate include surface: `asm/byteorder.h`, `linux/completion.h`, `linux/crc32.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/kref.h`, `linux/list.h`, `linux/mhi.h`.
- Detected declarations: `struct manage_msg`, `struct wire_msg_hdr`, `struct wire_msg`, `struct wire_trans_hdr`, `struct wrapper_msg`, `struct wrapper_list`, `struct wire_trans_passthrough`, `struct wire_addr_size_pair`, `struct wire_trans_dma_xfer`, `struct wire_trans_dma_xfer_cont`.
- Atlas domain: Driver Families / drivers/accel.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.