drivers/dma/ioat/dma.c
Source file repositories/reference/linux-study-clean/drivers/dma/ioat/dma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/dma/ioat/dma.c- Extension
.c- Size
- 28458 bytes
- Lines
- 1063
- 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/slab.hlinux/pci.hlinux/interrupt.hlinux/dmaengine.hlinux/delay.hlinux/dma-mapping.hlinux/workqueue.hlinux/prefetch.hlinux/sizes.hdma.hregisters.hhw.h../dmaengine.h
Detected Declarations
function ioat_print_chanerrsfunction ioat_dma_do_interruptfunction ioat_dma_do_interrupt_msixfunction ioat_stopfunction __ioat_issue_pendingfunction ioat_issue_pendingfunction ioat_update_pendingfunction __ioat_start_null_descfunction ioat_start_null_descfunction __ioat_restart_chanfunction ioat_quiescefunction ioat_reset_syncfunction ioat_tx_submit_unlockfunction ioat_alloc_ring_entfunction ioat_free_ring_entfunction ioat_alloc_ringfunction ioat_check_space_lockfunction desc_has_extfunction ioat_free_sedfunction ioat_get_current_completionfunction ioat_cleanup_preamblefunction desc_get_errstatfunction __ioat_cleanupfunction ioat_cleanupfunction ioat_cleanup_eventfunction ioat_restart_channelfunction ioat_abort_descsfunction ioat_ehfunction check_activefunction ioat_reboot_chanfunction ioat_timer_eventfunction ioat_tx_statusfunction ioat_reset_hw
Annotated Snippet
if ((chanerr >> i) & 1) {
dev_err(to_dev(ioat_chan), "Err(%d): %s\n",
i, chanerr_str[i]);
}
}
}
/**
* ioat_dma_do_interrupt - handler used for single vector interrupt mode
* @irq: interrupt id
* @data: interrupt data
*/
irqreturn_t ioat_dma_do_interrupt(int irq, void *data)
{
struct ioatdma_device *instance = data;
struct ioatdma_chan *ioat_chan;
unsigned long attnstatus;
int bit;
u8 intrctrl;
intrctrl = readb(instance->reg_base + IOAT_INTRCTRL_OFFSET);
if (!(intrctrl & IOAT_INTRCTRL_MASTER_INT_EN))
return IRQ_NONE;
if (!(intrctrl & IOAT_INTRCTRL_INT_STATUS)) {
writeb(intrctrl, instance->reg_base + IOAT_INTRCTRL_OFFSET);
return IRQ_NONE;
}
attnstatus = readl(instance->reg_base + IOAT_ATTNSTATUS_OFFSET);
for_each_set_bit(bit, &attnstatus, BITS_PER_LONG) {
ioat_chan = ioat_chan_by_index(instance, bit);
if (test_bit(IOAT_RUN, &ioat_chan->state))
tasklet_schedule(&ioat_chan->cleanup_task);
}
writeb(intrctrl, instance->reg_base + IOAT_INTRCTRL_OFFSET);
return IRQ_HANDLED;
}
/**
* ioat_dma_do_interrupt_msix - handler used for vector-per-channel interrupt mode
* @irq: interrupt id
* @data: interrupt data
*/
irqreturn_t ioat_dma_do_interrupt_msix(int irq, void *data)
{
struct ioatdma_chan *ioat_chan = data;
if (test_bit(IOAT_RUN, &ioat_chan->state))
tasklet_schedule(&ioat_chan->cleanup_task);
return IRQ_HANDLED;
}
void ioat_stop(struct ioatdma_chan *ioat_chan)
{
struct ioatdma_device *ioat_dma = ioat_chan->ioat_dma;
struct pci_dev *pdev = ioat_dma->pdev;
int chan_id = chan_num(ioat_chan);
struct msix_entry *msix;
/* 1/ stop irq from firing tasklets
* 2/ stop the tasklet from re-arming irqs
*/
clear_bit(IOAT_RUN, &ioat_chan->state);
/* flush inflight interrupts */
switch (ioat_dma->irq_mode) {
case IOAT_MSIX:
msix = &ioat_dma->msix_entries[chan_id];
synchronize_irq(msix->vector);
break;
case IOAT_MSI:
case IOAT_INTX:
synchronize_irq(pdev->irq);
break;
default:
break;
}
/* flush inflight timers */
timer_delete_sync(&ioat_chan->timer);
/* flush inflight tasklet runs */
tasklet_kill(&ioat_chan->cleanup_task);
/* final cleanup now that everything is quiesced and can't re-arm */
ioat_cleanup_event(&ioat_chan->cleanup_task);
Annotation
- Immediate include surface: `linux/init.h`, `linux/module.h`, `linux/slab.h`, `linux/pci.h`, `linux/interrupt.h`, `linux/dmaengine.h`, `linux/delay.h`, `linux/dma-mapping.h`.
- Detected declarations: `function ioat_print_chanerrs`, `function ioat_dma_do_interrupt`, `function ioat_dma_do_interrupt_msix`, `function ioat_stop`, `function __ioat_issue_pending`, `function ioat_issue_pending`, `function ioat_update_pending`, `function __ioat_start_null_desc`, `function ioat_start_null_desc`, `function __ioat_restart_chan`.
- 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.