drivers/dma/ioat/init.c
Source file repositories/reference/linux-study-clean/drivers/dma/ioat/init.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/dma/ioat/init.c- Extension
.c- Size
- 38954 bytes
- Lines
- 1456
- Domain
- Driver Families
- Bucket
- drivers/dma
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/dca.hlinux/sizes.hdma.hregisters.hhw.h../dmaengine.h
Detected Declarations
function is_jf_ioatfunction is_snb_ioatfunction is_ivb_ioatfunction is_hsw_ioatfunction is_bdx_ioatfunction is_skx_ioatfunction is_xeon_cb32function is_bwd_ioatfunction is_bwd_noraidfunction ioat_dma_test_callbackfunction ioat_dma_self_testfunction ioat_dma_setup_interruptsfunction ioat_disable_interruptsfunction ioat_probefunction ioat_dma_removefunction ioat_enumerate_channelsfunction ioat_free_chan_resourcesfunction ioat_alloc_chan_resourcesfunction ioat_init_channelfunction ioat_xor_val_self_testfunction ioat3_dma_self_testfunction ioat_intr_quirkfunction list_for_each_entryfunction ioat3_dma_probefunction list_for_each_entryfunction ioat_shutdownfunction ioat_resumefunction ioat_pcie_error_detectedfunction ioat_pcie_error_slot_resetfunction ioat_pcie_error_resumefunction release_ioatdmafunction alloc_ioatdmafunction ioat_pci_probefunction ioat_removefunction ioat_init_modulefunction ioat_exit_modulemodule init ioat_init_module
Annotated Snippet
static struct pci_driver ioat_pci_driver = {
.name = DRV_NAME,
.id_table = ioat_pci_tbl,
.probe = ioat_pci_probe,
.remove = ioat_remove,
.shutdown = ioat_shutdown,
.err_handler = &ioat_err_handler,
};
static void release_ioatdma(struct dma_device *device)
{
struct ioatdma_device *d = to_ioatdma_device(device);
int i;
for (i = 0; i < IOAT_MAX_CHANS; i++)
kfree(d->idx[i]);
dma_pool_destroy(d->completion_pool);
kfree(d);
}
static struct ioatdma_device *
alloc_ioatdma(struct pci_dev *pdev, void __iomem *iobase)
{
struct ioatdma_device *d = kzalloc_obj(*d);
if (!d)
return NULL;
d->pdev = pdev;
d->reg_base = iobase;
d->dma_dev.device_release = release_ioatdma;
return d;
}
static int ioat_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
void __iomem * const *iomap;
struct device *dev = &pdev->dev;
struct ioatdma_device *device;
unsigned int i;
u8 version;
int err;
err = pcim_enable_device(pdev);
if (err)
return err;
err = pcim_iomap_regions(pdev, 1 << IOAT_MMIO_BAR, DRV_NAME);
if (err)
return err;
iomap = pcim_iomap_table(pdev);
if (!iomap)
return -ENOMEM;
version = readb(iomap[IOAT_MMIO_BAR] + IOAT_VER_OFFSET);
if (version < IOAT_VER_3_0)
return -ENODEV;
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (err)
return err;
device = alloc_ioatdma(pdev, iomap[IOAT_MMIO_BAR]);
if (!device)
return -ENOMEM;
pci_set_master(pdev);
pci_set_drvdata(pdev, device);
device->version = version;
if (device->version >= IOAT_VER_3_4)
ioat_dca_enabled = 0;
if (is_skx_ioat(pdev))
device->version = IOAT_VER_3_2;
err = ioat3_dma_probe(device, ioat_dca_enabled);
if (err) {
for (i = 0; i < IOAT_MAX_CHANS; i++)
kfree(device->idx[i]);
kfree(device);
dev_err(dev, "Intel(R) I/OAT DMA Engine init failed\n");
return -ENODEV;
}
return 0;
}
static void ioat_remove(struct pci_dev *pdev)
{
struct ioatdma_device *device = pci_get_drvdata(pdev);
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 is_jf_ioat`, `function is_snb_ioat`, `function is_ivb_ioat`, `function is_hsw_ioat`, `function is_bdx_ioat`, `function is_skx_ioat`, `function is_xeon_cb32`, `function is_bwd_ioat`, `function is_bwd_noraid`, `function ioat_dma_test_callback`.
- Atlas domain: Driver Families / drivers/dma.
- Implementation status: pattern 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.