drivers/dma/xgene-dma.c
Source file repositories/reference/linux-study-clean/drivers/dma/xgene-dma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/dma/xgene-dma.c- Extension
.c- Size
- 50046 bytes
- Lines
- 1833
- Domain
- Driver Families
- Bucket
- drivers/dma
- 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.
- 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/acpi.hlinux/clk.hlinux/delay.hlinux/dma-mapping.hlinux/dmaengine.hlinux/dmapool.hlinux/interrupt.hlinux/io.hlinux/irq.hlinux/mod_devicetable.hlinux/module.hlinux/platform_device.hdmaengine.h
Detected Declarations
struct xgene_dma_desc_hwstruct xgene_dma_ringstruct xgene_dma_desc_swstruct xgene_dma_chanstruct xgene_dmaenum xgene_dma_ring_cfgsizefunction is_pq_enabledfunction xgene_dma_encode_lenfunction xgene_dma_encode_xor_flybyfunction xgene_dma_set_src_bufferfunction xgene_dma_init_descfunction xgene_dma_prep_xor_descfunction xgene_dma_tx_submitfunction xgene_dma_clean_descriptorfunction xgene_dma_clean_completed_descriptorfunction xgene_dma_run_tx_complete_actionsfunction xgene_dma_clean_running_descriptorfunction xgene_chan_xfer_requestfunction xgene_chan_xfer_ld_pendingfunction xgene_dma_cleanup_descriptorsfunction xgene_dma_alloc_chan_resourcesfunction xgene_dma_free_desc_listfunction xgene_dma_free_chan_resourcesfunction xgene_dma_issue_pendingfunction xgene_dma_tx_statusfunction xgene_dma_tasklet_cbfunction xgene_dma_chan_ring_isrfunction xgene_dma_err_isrfunction xgene_dma_wr_ring_statefunction xgene_dma_clr_ring_statefunction xgene_dma_setup_ringfunction xgene_dma_clear_ringfunction xgene_dma_set_ring_cmdfunction xgene_dma_get_ring_sizefunction xgene_dma_delete_ring_onefunction xgene_dma_delete_chan_ringsfunction xgene_dma_create_ring_onefunction xgene_dma_create_chan_ringsfunction xgene_dma_init_ringsfunction xgene_dma_enablefunction xgene_dma_disablefunction xgene_dma_mask_interruptsfunction xgene_dma_unmask_interruptsfunction xgene_dma_init_hwfunction xgene_dma_init_ring_mngrfunction xgene_dma_init_memfunction xgene_dma_request_irqsfunction xgene_dma_free_irqs
Annotated Snippet
struct xgene_dma_desc_hw {
__le64 m0;
__le64 m1;
__le64 m2;
__le64 m3;
};
enum xgene_dma_ring_cfgsize {
XGENE_DMA_RING_CFG_SIZE_512B,
XGENE_DMA_RING_CFG_SIZE_2KB,
XGENE_DMA_RING_CFG_SIZE_16KB,
XGENE_DMA_RING_CFG_SIZE_64KB,
XGENE_DMA_RING_CFG_SIZE_512KB,
XGENE_DMA_RING_CFG_SIZE_INVALID
};
struct xgene_dma_ring {
struct xgene_dma *pdma;
u8 buf_num;
u16 id;
u16 num;
u16 head;
u16 owner;
u16 slots;
u16 dst_ring_num;
u32 size;
void __iomem *cmd;
void __iomem *cmd_base;
dma_addr_t desc_paddr;
u32 state[XGENE_DMA_RING_NUM_CONFIG];
enum xgene_dma_ring_cfgsize cfgsize;
union {
void *desc_vaddr;
struct xgene_dma_desc_hw *desc_hw;
};
};
struct xgene_dma_desc_sw {
struct xgene_dma_desc_hw desc1;
struct xgene_dma_desc_hw desc2;
u32 flags;
struct list_head node;
struct list_head tx_list;
struct dma_async_tx_descriptor tx;
};
/**
* struct xgene_dma_chan - internal representation of an X-Gene DMA channel
* @dma_chan: dmaengine channel object member
* @pdma: X-Gene DMA device structure reference
* @dev: struct device reference for dma mapping api
* @id: raw id of this channel
* @rx_irq: channel IRQ
* @name: name of X-Gene DMA channel
* @lock: serializes enqueue/dequeue operations to the descriptor pool
* @pending: number of transaction request pushed to DMA controller for
* execution, but still waiting for completion,
* @max_outstanding: max number of outstanding request we can push to channel
* @ld_pending: descriptors which are queued to run, but have not yet been
* submitted to the hardware for execution
* @ld_running: descriptors which are currently being executing by the hardware
* @ld_completed: descriptors which have finished execution by the hardware.
* These descriptors have already had their cleanup actions run. They
* are waiting for the ACK bit to be set by the async tx API.
* @desc_pool: descriptor pool for DMA operations
* @tasklet: bottom half where all completed descriptors cleans
* @tx_ring: transmit ring descriptor that we use to prepare actual
* descriptors for further executions
* @rx_ring: receive ring descriptor that we use to get completed DMA
* descriptors during cleanup time
*/
struct xgene_dma_chan {
struct dma_chan dma_chan;
struct xgene_dma *pdma;
struct device *dev;
int id;
int rx_irq;
char name[10];
spinlock_t lock;
int pending;
int max_outstanding;
struct list_head ld_pending;
struct list_head ld_running;
struct list_head ld_completed;
struct dma_pool *desc_pool;
struct tasklet_struct tasklet;
struct xgene_dma_ring tx_ring;
struct xgene_dma_ring rx_ring;
};
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/clk.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/dmaengine.h`, `linux/dmapool.h`, `linux/interrupt.h`, `linux/io.h`.
- Detected declarations: `struct xgene_dma_desc_hw`, `struct xgene_dma_ring`, `struct xgene_dma_desc_sw`, `struct xgene_dma_chan`, `struct xgene_dma`, `enum xgene_dma_ring_cfgsize`, `function is_pq_enabled`, `function xgene_dma_encode_len`, `function xgene_dma_encode_xor_flyby`, `function xgene_dma_set_src_buffer`.
- Atlas domain: Driver Families / drivers/dma.
- 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.