include/linux/iio/buffer-dma.h
Source file repositories/reference/linux-study-clean/include/linux/iio/buffer-dma.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/iio/buffer-dma.h- Extension
.h- Size
- 6079 bytes
- Lines
- 184
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- 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
linux/atomic.hlinux/list.hlinux/kref.hlinux/spinlock.hlinux/mutex.hlinux/iio/buffer_impl.h
Detected Declarations
struct iio_dma_buffer_queuestruct iio_dma_buffer_opsstruct devicestruct dma_buf_attachmentstruct dma_fencestruct sg_tablestruct iio_dma_buffer_blockstruct iio_dma_buffer_queue_fileiostruct iio_dma_buffer_queuestruct iio_dma_buffer_opsenum iio_block_state
Annotated Snippet
struct iio_dma_buffer_block {
/* May only be accessed by the owner of the block */
struct list_head head;
size_t bytes_used;
/*
* Set during allocation, constant thereafter. May be accessed read-only
* by anybody holding a reference to the block.
*/
void *vaddr;
dma_addr_t phys_addr;
size_t size;
struct iio_dma_buffer_queue *queue;
/* Must not be accessed outside the core. */
struct kref kref;
/*
* Must not be accessed outside the core. Access needs to hold
* queue->list_lock if the block is not owned by the core.
*/
enum iio_block_state state;
bool cyclic;
bool fileio;
struct sg_table *sg_table;
struct dma_fence *fence;
};
/**
* struct iio_dma_buffer_queue_fileio - FileIO state for the DMA buffer
* @blocks: Buffer blocks used for fileio
* @active_block: Block being used in read()
* @pos: Read offset in the active block
* @block_size: Size of each block
* @next_dequeue: index of next block that will be dequeued
* @enabled: Whether the buffer is operating in fileio mode
*/
struct iio_dma_buffer_queue_fileio {
struct iio_dma_buffer_block *blocks[2];
struct iio_dma_buffer_block *active_block;
size_t pos;
size_t block_size;
unsigned int next_dequeue;
bool enabled;
};
/**
* struct iio_dma_buffer_queue - DMA buffer base structure
* @buffer: IIO buffer base structure
* @dev: Parent device
* @ops: DMA buffer callbacks
* @lock: Protects the incoming list, active and the fields in the fileio
* substruct
* @list_lock: Protects lists that contain blocks which can be modified in
* atomic context as well as blocks on those lists. This is the outgoing queue
* list and typically also a list of active blocks in the part that handles
* the DMA controller
* @incoming: List of buffers on the incoming queue
* @active: Whether the buffer is currently active
* @num_dmabufs: Total number of DMABUFs attached to this queue
* @fileio: FileIO state
*/
struct iio_dma_buffer_queue {
struct iio_buffer buffer;
struct device *dev;
const struct iio_dma_buffer_ops *ops;
/*
* A mutex to protect accessing, configuring (eg: enqueuing DMA blocks)
* and do file IO on struct iio_dma_buffer_queue objects.
*/
struct mutex lock;
/* A spin lock to protect adding/removing blocks to the queue list */
spinlock_t list_lock;
struct list_head incoming;
bool active;
atomic_t num_dmabufs;
struct iio_dma_buffer_queue_fileio fileio;
};
/**
* struct iio_dma_buffer_ops - DMA buffer callback operations
* @submit: Called when a block is submitted to the DMA controller
* @abort: Should abort all pending transfers
*/
struct iio_dma_buffer_ops {
Annotation
- Immediate include surface: `linux/atomic.h`, `linux/list.h`, `linux/kref.h`, `linux/spinlock.h`, `linux/mutex.h`, `linux/iio/buffer_impl.h`.
- Detected declarations: `struct iio_dma_buffer_queue`, `struct iio_dma_buffer_ops`, `struct device`, `struct dma_buf_attachment`, `struct dma_fence`, `struct sg_table`, `struct iio_dma_buffer_block`, `struct iio_dma_buffer_queue_fileio`, `struct iio_dma_buffer_queue`, `struct iio_dma_buffer_ops`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.