DMA

Differences between revisions 19 and 20
Revision 19 as of 2006-06-07 09:40:43
Size: 3282
Editor: mailgate
Comment: adding note that this works out of the box in dapper
Revision 20 as of 2006-06-09 01:53:16
Size: 2885
Editor: S0106001150603f7d
Comment: general cleanup - not needed for 6.06 or later
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
DMA is automatically enabled for drives that support it as from Ubuntu 6.06 (Dapper Drake). Ubuntu 6.06 (Dapper Drake) has DMA '''automatically''' enabled for drives that support it.
Line 7: Line 7:
'''Warning: Enabling DMA can be dangerous in some cases. Usually issues are directly related to faulty hardware, poorly written drivers, or using settings that are unsupported by your system. USING HDPARM INCORRECTLY CAN CAUSE MAJOR DATA CORRUPTION AND/OR LOSS. Most systems newer than 4 years support DMA.''' attachment:IconsPage/IconDialog-Warning1.png '''Warning:''' Enabling DMA can be dangerous in some cases. Usually issues are directly related to faulty hardware, poorly written drivers, or using settings that are unsupported by your system.

'''
USING HDPARM INCORRECTLY CAN CAUSE MAJOR DATA CORRUPTION AND/OR LOSS. Most systems newer than 4 years support DMA.'''
Line 27: Line 29:
   {{{
   /dev/hdc {
   dma = on
   }
   }}}
{{{
/dev/hdc {
dma = on
}
}}}
Line 33: Line 35:
(another way avoiding edit of hdparm.conf file is to simply run {{{sudo hdparm -d1 -k1 /dev/hdc}}} to keep saved the dma flag). (another way of avoiding editing of the hdparm.conf file is to simply run {{{sudo hdparm -d1 -k1 /dev/hdc}}} to keep the DMA flag).
Line 39: Line 41:
Sometimes step 3 above can fail with a "operation not permitted" message. You can fix this by editing the file /etc/modules:
For an intel cpu put the lines

{{{piix}}}

{{{
ide-core}}}
Sometimes step 3 above can fail with an "Operation Not Permitted" message. You can fix this by editing the file /etc/modules:
For an Intel CPU put the lines
{{{
piix
ide-core
}}}
Line 47: Line 48:
Line 50: Line 50:

For an amd cpu put the line
For an AMD CPU put the line
Line 54: Line 52:
Line 56: Line 53:
Line 59: Line 55:
Line 61: Line 56:
Line 63: Line 57:
Line 65: Line 58:
Line 70: Line 62:

Line 74: Line 64:
The hdparm has a further options that may be more risky. They can be seen using the {{{man hdparm}}} command in the terminal. The hdparm has further options that may be more risky. They can be seen using the {{{man hdparm}}} command in the terminal.
Line 81: Line 71:


== Problems ==
* My new 200G SATA drive does not support DMA at all.
{{{
$ sudo hdparm -d1 /dev/sda

/dev/sda:
 setting using_dma to 1 (on)
 HDIO_SET_DMA failed: Inappropriate ioctl for device
$ cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA Model: SAMSUNG SP2004C Rev: VM10
  Type: Direct-Access ANSI SCSI revision: 05
}}}
----

Introduction

If you experience jumpy DVD playback, slow CD ripping, or a general slow down when accessing optical drive(s) it may be because DMA is not enabled. DMA, or Direct Memory Access, lets hard drives and CD/DVD drives access the system memory.

Ubuntu 6.06 (Dapper Drake) has DMA automatically enabled for drives that support it.

attachment:IconsPage/IconDialog-Warning1.png Warning: Enabling DMA can be dangerous in some cases. Usually issues are directly related to faulty hardware, poorly written drivers, or using settings that are unsupported by your system.

USING HDPARM INCORRECTLY CAN CAUSE MAJOR DATA CORRUPTION AND/OR LOSS. Most systems newer than 4 years support DMA.

Enabling DMA

To enable DMA, you need to use the hdparm command and the configuration file hdparm.conf.

These instructions assume that you are trying to enable DMA on hdc, usually the CD-rom drive.

  1. See the what the settings are on /dev/hdc

    •    sudo hdparm /dev/hdc
  2. If you get a line like  using_dma    =  1 (on), DMA is already enabled. Skip to step 4 to see if it has been enabled at boot time.

  3. Enable DMA on /dev/hdc

    •    sudo hdparm -d1 /dev/hdc
  4. You have now enabled DMA for the drive. However, in order for the settings to be automatically applied at boot there you need to edit the /etc/hdparm.conf script. To do this use this command: sudo gedit /etc/hdparm.conf

Add the following to the end of your hdparm.conf

/dev/hdc {
dma = on
}

(another way of avoiding editing of the hdparm.conf file is to simply run sudo hdparm -d1 -k1 /dev/hdc to keep the DMA flag).

Troubleshooting

If your drives are configured in [Cable Select] mode and while running hdparm commands you receive errors related to timeouts or drive not ready, try changing the drive to be a master or slave device depending on your system configuration. This does require opening the case and as far as I know most drives are set to Cable Select from the manufacturer.

Sometimes step 3 above can fail with an "Operation Not Permitted" message. You can fix this by editing the file /etc/modules: For an Intel CPU put the lines

piix
ide-core

above the line ide-cd

For an AMD CPU put the line amd74xx above ide-cd

For a VIA Chipset put via82cxxx above ide-cd

Then reboot and try steps 3-4 again....

Further reading

The hdparm has further options that may be more risky. They can be seen using the man hdparm command in the terminal.

For a detailed description of DMA visit the IEEE http://standards.ieee.org/reading/ieee/std_public/description/busarch/1212.1-1993_desc.html

IDE, EIDE and UDMA http://www.spcug.org/reviews/bl0108.htm


CategoryDocumentation

DMA (last edited 2008-08-06 16:20:37 by localhost)