DMA

From LQWiki
Jump to navigation Jump to search

DMA (Direct Memory Access) is a function of the memory bus in the computer that lets connected devices like hard disks transfer data to the memory without the intervention of the CPU, thus speeding up the transfer. This is superior to the way PIO works.

Features

There are two distinct types of direct memory access, DMA and bus mastering DMA. The plain DMA relies on the DMA controller on the motherboard to grab the system bus and transfer the data. In bus mastering DMA all this is done by the logic on the interface card itself. Bus mastering allows the hard disk and memory to work without relying on the old DMA controller built into the system, or needing any support from the CPU.

Ultra DMA

The key technological advance introduced to ATA in Ultra DMA was double transition clocking. Notice the double transfer rates per cycle time compared to older DMA modes.

DMA Modes

Two types of DMA modes have been defined in the ATA interface; single word DMA modes and multiword DMA modes. Since multiword DMA transfers are more efficient, single word DMA modes were abandoned after ATA-2 was widely adopted.

DMA modes
DMA Mode Cycle time
(ns)
Transfer rate
(MB/s)
Interface hdparm option
Single word
0 960 2.1 ATA -X16
1 480 4.2 ATA -X17
2 240 8.3 ATA -X18
Multiword
0 480 4.2 ATA -X32
1 150 13.3 ATA-2 -X33
2 120 16.6 ATA-2 -X34
Ultra DMA
0 240 16.7 ATA-4 -X64
1 160 25.0 ATA-4 -X65
2 120 33.3 ATA-4 -X66
3 90 44.4 ATA-5 -X67
4 60 66.7 ATA-5 -X68
5 40 100.0 ATA-6 -X69

DMA Support in Linux

Usually, DMA -aware kernel will automatically enable DMA support for the drives and interfaces that support it. Nevertheless, in some cases DMA support is not enabled, perhaps due to the fact that support for the correct chipset needs to be compiled in the kernel. First check that both the chipset and the drive support DMA. In these situations one may choose to tweak the hard drive settings by using hdparm -program.

To enable DMA type

# hdparm -d1 /dev/hda

It may also be useful to set the DMA to a higher mode

# hdparm -X34 /dev/hda

External links

This article is a stub and needs to be finished. Plunge forward and help it grow!