drivers/misc/bcm-vk/bcm_vk_msg.h
Source file repositories/reference/linux-study-clean/drivers/misc/bcm-vk/bcm_vk_msg.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/misc/bcm-vk/bcm_vk_msg.h- Extension
.h- Size
- 4486 bytes
- Lines
- 164
- Domain
- Driver Families
- Bucket
- drivers/misc
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
uapi/linux/misc/bcm_vk.hbcm_vk_sg.h
Detected Declarations
struct bcm_vk_msgqstruct bcm_vk_sync_qinfostruct vk_msg_blkstruct bcm_vk_ctxstruct bcm_vk_ht_entrystruct bcm_vk_wkentstruct bcm_vk_qs_cntsstruct bcm_vk_msg_chan
Annotated Snippet
struct bcm_vk_msgq {
u16 type; /* queue type */
u16 num; /* queue number */
u32 start; /* offset in BAR1 where the queue memory starts */
u32 rd_idx; /* read idx */
u32 wr_idx; /* write idx */
u32 size; /*
* size, which is in number of 16byte blocks,
* to align with the message data structure.
*/
u32 nxt; /*
* nxt offset to the next msg queue struct.
* This is to provide flexibity for alignment purposes.
*/
/* Least significant 16 bits in below field hold doorbell register offset */
#define DB_SHIFT 16
u32 db_offset; /* queue doorbell register offset in BAR0 */
u32 rsvd;
};
/*
* Structure to record static info from the msgq sync. We keep local copy
* for some of these variables for both performance + checking purpose.
*/
struct bcm_vk_sync_qinfo {
void __iomem *q_start;
u32 q_size;
u32 q_mask;
u32 q_low;
u32 q_db_offset;
};
#define VK_MSGQ_MAX_NR 4 /* Maximum number of message queues */
/*
* message block - basic unit in the message where a message's size is always
* N x sizeof(basic_block)
*/
struct vk_msg_blk {
u8 function_id;
#define VK_FID_TRANS_BUF 5
#define VK_FID_SHUTDOWN 8
#define VK_FID_INIT 9
u8 size; /* size of the message in number of vk_msg_blk's */
u16 trans_id; /* transport id, queue & msg_id */
u32 context_id;
#define VK_NEW_CTX 0
u32 cmd;
#define VK_CMD_PLANES_MASK 0x000f /* number of planes to up/download */
#define VK_CMD_UPLOAD 0x0400 /* memory transfer to vk */
#define VK_CMD_DOWNLOAD 0x0500 /* memory transfer from vk */
#define VK_CMD_MASK 0x0f00 /* command mask */
u32 arg;
};
/* vk_msg_blk is 16 bytes fixed */
#define VK_MSGQ_BLK_SIZE (sizeof(struct vk_msg_blk))
/* shift for fast division of basic msg blk size */
#define VK_MSGQ_BLK_SZ_SHIFT 4
/* use msg_id 0 for any simplex host2vk communication */
#define VK_SIMPLEX_MSG_ID 0
/* context per session opening of sysfs */
struct bcm_vk_ctx {
struct list_head node; /* use for linkage in Hash Table */
unsigned int idx;
bool in_use;
pid_t pid;
u32 hash_idx;
u32 q_num; /* queue number used by the stream */
struct miscdevice *miscdev;
atomic_t pend_cnt; /* number of items pending to be read from host */
atomic_t dma_cnt; /* any dma transaction outstanding */
wait_queue_head_t rd_wq;
};
/* pid hash table entry */
struct bcm_vk_ht_entry {
struct list_head head;
};
#define VK_DMA_MAX_ADDRS 4 /* Max 4 DMA Addresses */
/* structure for house keeping a single work entry */
struct bcm_vk_wkent {
Annotation
- Immediate include surface: `uapi/linux/misc/bcm_vk.h`, `bcm_vk_sg.h`.
- Detected declarations: `struct bcm_vk_msgq`, `struct bcm_vk_sync_qinfo`, `struct vk_msg_blk`, `struct bcm_vk_ctx`, `struct bcm_vk_ht_entry`, `struct bcm_vk_wkent`, `struct bcm_vk_qs_cnts`, `struct bcm_vk_msg_chan`.
- Atlas domain: Driver Families / drivers/misc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.