dmaengine_p...nfig_sg_safe(9)
π NAME π
dmaengine_prep_config_sg_safe β bestie, this one prepares a scatter-gather DMA transfer and does an atomic slave configuration update at the same time β¨
β¨ SYNOPSIS β¨
struct dma_async_tx_descriptor * dmaengine_prep_config_sg_safe (struct
dma_chan *chan , struct scatterlist *sgl , unsigned int sg_len , enum
dma_transfer_direction dir , unsigned long flags , struct
dma_slave_config *config );
π ARGUMENTS π
chanβ the DMA channel. your main character π«Άsglβ the scatterlist for the transfer. it's giving "here's all the places the data lives" πsg_lenβ literally how many entries are insgl. count 'em, don't guess πdirβ the DMA transfer direction π₯flagsβ transfer preparation flags βconfigβ the DMA slave configuration for this transfer π¦
πΈ DESCRIPTION πΈ
okay so picture this: you wanna prepare a DMA scatter-gather transfer, and you need the corresponding slave configuration update to happen with it β and you need the whole thing to be re-entrant and race-safe. that's the whole vibe. no cap π
DMA engine drivers can implement the optional device_prep_config_sg callback to do both the slave configuration and the descriptor preparation atomically. if they do, the operation is fully handled by the DMA engine driver. iconic behavior, honestly π
but if the DMA engine driver doesn't implement device_prep_config_sg, it falls back to calling dmaengine_slave_config followed by dmaengine_prep_slave_sg. and listen β that fallback path is protected by a per-channel spinlock, so concurrent callers can't interleave configuration and descriptor preparation on the same DMA channel. the way it just locks it down ππ
β RETURN β
You get a pointer to a prepared DMA async transaction descriptor on success β slay. Or NULL if the transfer could not be prepared. we don't love that, but we respect it π
π¦ SEE ALSO π¦
All of this lives in the kernel file ./include/linux/dmaengine.h, and it lowkey has the whole friend group with it:
dma_cookie_t(9),enum dma_status(9),enum dma_transaction_type(9),enum dma_transfer_direction(9),struct data_chunk(9),struct dma_interleaved_template(9),struct dma_vec(9)enum dma_ctrl_flags(9),enum sum_check_bits(9),enum sum_check_flags(9),enum dma_desc_metadata_mode(9),struct dma_chan_percpu(9),struct dma_router(9)struct dma_chan(9),struct dma_chan_dev(9),enum dma_slave_buswidth(9),struct dma_slave_config(9),enum dma_residue_granularity(9),struct dma_slave_caps(9)dma_filter_fn(9),struct dma_async_tx_descriptor(9),struct dma_tx_state(9),enum dmaengine_alignment(9),struct dma_slave_map(9),struct dma_filter(9),struct dma_device(9)dmaengine_prep_peripheral_dma_vec(9),dmaengine_prep_config_single_safe(9),dmaengine_prep_dma_memset(9)dmaengine_terminate_all(9),dmaengine_terminate_async(9),dmaengine_synchronize(9),dmaengine_terminate_sync(9)dma_async_issue_pending(9),dma_async_is_tx_complete(9),dma_async_is_complete(9)
and that's the page, bestie π this lil entry comes straight out of the ./include/linux tree, October 2026, Kernel API Manual era β go forth and prep your scatter-gather transfers safely, ily, mwah πβ¨π¦
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms