drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c
Source file repositories/reference/linux-study-clean/drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/dma/fsl-dpaa2-qdma/dpaa2-qdma.c- Extension
.c- Size
- 21859 bytes
- Lines
- 841
- 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/init.hlinux/module.hlinux/dmapool.hlinux/of_irq.hlinux/iommu.hlinux/sys_soc.hlinux/fsl/mc.hsoc/fsl/dpaa2-io.h../virt-dma.hdpdmai.hdpaa2-qdma.h
Detected Declarations
function dpaa2_qdma_alloc_chan_resourcesfunction dpaa2_qdma_free_chan_resourcesfunction dpaa2_qdma_request_descfunction dpaa2_qdma_populate_fdfunction dpaa2_qdma_populate_first_framelfunction dpaa2_qdma_populate_framesfunction dpaa2_qdma_issue_pendingfunction dpaa2_qdma_setupfunction dpaa2_qdma_fqdan_cbfunction list_for_each_entry_safefunction dpaa2_qdma_dpio_setupfunction dpaa2_dpmai_store_freefunction dpaa2_dpdmai_dpio_freefunction dpaa2_dpdmai_bindfunction dpaa2_dpdmai_dpio_unbindfunction dpaa2_dpdmai_free_compfunction list_for_each_entry_safefunction dpaa2_dpdmai_free_channelsfunction dpaa2_qdma_free_descfunction dpaa2_dpdmai_init_channelsfunction dpaa2_qdma_probefunction dpaa2_qdma_removefunction dpaa2_qdma_shutdownfunction dpaa2_qdma_driver_initfunction fsl_qdma_exit
Annotated Snippet
if (err) {
list_move_tail(&dpaa2_comp->list,
&dpaa2_chan->comp_free);
}
}
err_enqueue:
spin_unlock(&dpaa2_chan->vchan.lock);
spin_unlock_irqrestore(&dpaa2_chan->queue_lock, flags);
}
static int __cold dpaa2_qdma_setup(struct fsl_mc_device *ls_dev)
{
struct dpaa2_qdma_priv_per_prio *ppriv;
struct device *dev = &ls_dev->dev;
struct dpaa2_qdma_priv *priv;
u8 prio_def = DPDMAI_PRIO_NUM;
int err = -EINVAL;
int i;
priv = dev_get_drvdata(dev);
priv->dev = dev;
priv->dpqdma_id = ls_dev->obj_desc.id;
/* Get the handle for the DPDMAI this interface is associate with */
err = dpdmai_open(priv->mc_io, 0, priv->dpqdma_id, &ls_dev->mc_handle);
if (err) {
dev_err(dev, "dpdmai_open() failed\n");
return err;
}
dev_dbg(dev, "Opened dpdmai object successfully\n");
err = dpdmai_get_attributes(priv->mc_io, 0, ls_dev->mc_handle,
&priv->dpdmai_attr);
if (err) {
dev_err(dev, "dpdmai_get_attributes() failed\n");
goto exit;
}
if (priv->dpdmai_attr.version.major > DPDMAI_VER_MAJOR) {
err = -EINVAL;
dev_err(dev, "DPDMAI major version mismatch\n"
"Found %u.%u, supported version is %u.%u\n",
priv->dpdmai_attr.version.major,
priv->dpdmai_attr.version.minor,
DPDMAI_VER_MAJOR, DPDMAI_VER_MINOR);
goto exit;
}
if (priv->dpdmai_attr.version.minor > DPDMAI_VER_MINOR) {
err = -EINVAL;
dev_err(dev, "DPDMAI minor version mismatch\n"
"Found %u.%u, supported version is %u.%u\n",
priv->dpdmai_attr.version.major,
priv->dpdmai_attr.version.minor,
DPDMAI_VER_MAJOR, DPDMAI_VER_MINOR);
goto exit;
}
priv->num_pairs = min(priv->dpdmai_attr.num_of_priorities, prio_def);
ppriv = kzalloc_objs(*ppriv, priv->num_pairs);
if (!ppriv) {
err = -ENOMEM;
goto exit;
}
priv->ppriv = ppriv;
for (i = 0; i < priv->num_pairs; i++) {
err = dpdmai_get_rx_queue(priv->mc_io, 0, ls_dev->mc_handle,
i, 0, &priv->rx_queue_attr[i]);
if (err) {
dev_err(dev, "dpdmai_get_rx_queue() failed\n");
goto exit;
}
ppriv->rsp_fqid = priv->rx_queue_attr[i].fqid;
err = dpdmai_get_tx_queue(priv->mc_io, 0, ls_dev->mc_handle,
i, 0, &priv->tx_queue_attr[i]);
if (err) {
dev_err(dev, "dpdmai_get_tx_queue() failed\n");
goto exit;
}
ppriv->req_fqid = priv->tx_queue_attr[i].fqid;
ppriv->prio = DPAA2_QDMA_DEFAULT_PRIORITY;
ppriv->priv = priv;
ppriv++;
}
return 0;
Annotation
- Immediate include surface: `linux/init.h`, `linux/module.h`, `linux/dmapool.h`, `linux/of_irq.h`, `linux/iommu.h`, `linux/sys_soc.h`, `linux/fsl/mc.h`, `soc/fsl/dpaa2-io.h`.
- Detected declarations: `function dpaa2_qdma_alloc_chan_resources`, `function dpaa2_qdma_free_chan_resources`, `function dpaa2_qdma_request_desc`, `function dpaa2_qdma_populate_fd`, `function dpaa2_qdma_populate_first_framel`, `function dpaa2_qdma_populate_frames`, `function dpaa2_qdma_issue_pending`, `function dpaa2_qdma_setup`, `function dpaa2_qdma_fqdan_cb`, `function list_for_each_entry_safe`.
- 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.