# How do I find out if DMA is enabled?

## rajl

I installed a new cd-burner...and it seems to read cd's and write cd's much slower than it should.  I have a sneaky suspicion that DMA may have some how not been turned on for the device.  is there someway I can check to see if it uses DMA when in linux?

----------

## MasonMouse

hdparm /dev/hdc should tell you. You can then enable it with hdparm -d1 /dev/hdc if necessary.

If you don't know which drive your CD/DVD is on, you may be able to find out with dmesg | grep ROM

----------

## rajl

Ok, so DMA is not wanting to work for me.  First, when I do hdparm /dev/hdc or hdparm /dev/hdd on my two cd-burners, I get the following error:

/dev/hdc: No such file or directory.

Also, when I do hdparm /dev/hda (my hard disk), I see that dma is not enabled.  I then try to enable it and get this:

```

bash-2.05b# hdparm -d1 /dev/hda

/dev/hda:

 setting using_dma to 1 (on)

 HDIO_SET_DMA failed: Operation not permitted

 using_dma    =  0 (off)

```

Since I know that all my drives permit dma, how can I go about getting dma to work?  My cd-burners are setup under scsi emulation.  Will this cause a problem and if so how do I get around it?  My hard drives are regular ide drives, so why won't hdparm set dma on them?

Also, on a side note: is there anyway I can get my hard-disks to idle down after a long time of inactivity like windows does?  I live in a dorm room and the extra noise is killing my roommate when he goes to sleep.  In addition, air circulation is bad in the room, so anyway to use less power and generate less heat is a plus.

----------

## Valen

Did you compile support for your chipset into the kernel?  This can be found under ATA/IDE/MFM/RLL support  ---> in the kernel config.  This was happening to me when I forgot to compile support for my VIA chipset.

----------

## bsolar

 *Valen wrote:*   

> Did you compile support for your chipset into the kernel?  This can be found under ATA/IDE/MFM/RLL support  ---> in the kernel config.  This was happening to me when I forgot to compile support for my VIA chipset.

 

Also if you enable the right chipset support DMA should be enabled automatically (unless you specify you don't want that).

----------

## rajl

I'm going to guess the answer is no and I don't have the proper chipset support compiled in.   I don't even know what chipset I use.  I'm running a P4 1.7 on a Dell desktop.  How do I found out what chipset I need to use?

----------

## bsolar

 *rajl wrote:*   

> I'm going to guess the answer is no and I don't have the proper chipset support compiled in.   I don't even know what chipset I use.  I'm running a P4 1.7 on a Dell desktop.  How do I found out what chipset I need to use?

 

You might check the specs of your mobo or do 'lspci' as root. It should print out also the information you need, i.e. mine is the line:

```
00:1f.1 IDE interface: Intel Corp. 82801CAM IDE U100 (rev 01)
```

Then check the section in menuconfig for something related.

BTW since it's a cdburner you should enable SCSI emulation (unless you want to try the ATAPI alpha support).

----------

## rajl

I did an lspci and it says I'm running an intel 850 chipset.  This is not listed in the make menuconfig though.  Any ideas on what I should go with?

I ask about my cd-burners because they are indeed running under scsi emulation, but as I understand it, dma doesn't work with scsi.  So I ask if this would be a problem or not.

----------

## bsolar

 *rajl wrote:*   

> I did an lspci and it says I'm running an intel 850 chipset.  This is not listed in the make menuconfig though.  Any ideas on what I should go with?
> 
> I ask about my cd-burners because they are indeed running under scsi emulation, but as I understand it, dma doesn't work with scsi.  So I ask if this would be a problem or not.

 

For an intel chipset you should enable:

```
[*]     Intel PIIXn chipsets support

[*]       PIIXn Tuning support
```

Then you can check 'dmesg' or 'cat /proc/ide/hdc/settings' (assuming hdc your drive).

----------

## rajl

Ok, I don't have PIIX chipsets enabled, just all the generic stuff, and when I do "cat /proc/ide/hdc/settings" it tells me that dma is enabled.  However, when I do the same command for hda, I find that dma is not enabled.  Is there a way to make sure that dman is enabled by default on all my drives when booting up?  Note that I have the use dma by default button clicked in my kernel config.

----------

## Valen

I'm not sure why your drive isn't getting picked up on boot up, do you see any related errors in dmesg?  I get something like this when it autodetects the dma settings (NOTE: this is with a 2.5.67 kernel, yours might look different):

```

VP_IDE: VIA vt8233 (rev 00) IDE UDMA100 controller on pci00:11.1

    ide0: BM-DMA at 0xa800-0xa807, BIOS settings: hda:DMA, hdb:pio

    ide1: BM-DMA at 0xa808-0xa80f, BIOS settings: hdc:DMA, hdd:pio

<snip>

hda: 156301488 sectors (80026 MB) w/2048KiB Cache, CHS=155061/16/63, UDMA(100)

 /dev/ide/host0/bus0/target0/lun0: p1 p2 < p5 p6 p7 p8 >

hdc: ATAPI 40X DVD-ROM drive, 256kB Cache, UDMA(33)

```

As a work around for getting autodetect working, if hdparm -d 1 /dev/hda works, you can always run hdparm at boot time: rc-update add hdparm default and edit /etc/init.d/hdparm to set values for your system if necesary.  Another way to do it is by just editting /etc/conf.d/local.start and add the 'hdparm -d 1' line in there.

----------

## rajl

Here's what I get when I do dmesg:

```

Linux version 2.4.19-gentoo-r10 (root@marduk.resnet.gatech.edu) (gcc version 3.2.2) #11 Sat Apr 19 16:02:24 EDT 2003

BIOS-provided physical RAM map:

 BIOS-e820: 0000000000000000 - 00000000000a0000 (usable)

 BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)

 BIOS-e820: 0000000000100000 - 000000002ff77000 (usable)

 BIOS-e820: 000000002ff77000 - 000000002ff96000 (ACPI data)

 BIOS-e820: 000000002ff96000 - 0000000030000000 (reserved)

 BIOS-e820: 00000000fec00000 - 00000000fec10000 (reserved)

 BIOS-e820: 00000000fee00000 - 00000000fee10000 (reserved)

 BIOS-e820: 00000000ffb00000 - 0000000100000000 (reserved)

767MB LOWMEM available.

Advanced speculative caching feature not present

On node 0 totalpages: 196471

zone(0): 4096 pages.

zone(1): 192375 pages.

zone(2): 0 pages.

Kernel command line: root=/dev/hda6 hdc=ide-scsi hdd=ide-scsi

ide_setup: hdc=ide-scsi

ide_setup: hdd=ide-scsi

Found and enabled local APIC!

Initializing CPU#0

Detected 1680.853 MHz processor.

Console: colour VGA+ 80x25

Calibrating delay loop... 3355.44 BogoMIPS

Memory: 770456k/785884k available (1832k kernel code, 12868k reserved, 619k data, 92k init, 0k highmem)

Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes)

Inode cache hash table entries: 65536 (order: 7, 524288 bytes)

Mount-cache hash table entries: 16384 (order: 5, 131072 bytes)

Buffer-cache hash table entries: 65536 (order: 6, 262144 bytes)

Page-cache hash table entries: 262144 (order: 8, 1048576 bytes)

CPU: Before vendor init, caps: 3febfbff 00000000 00000000, vendor = 0

CPU: L1 I cache: 12K, L1 D cache: 8K

CPU: L2 cache: 256K

CPU: After vendor init, caps: 3febfbff 00000000 00000000 00000000

Intel machine check architecture supported.

Intel machine check reporting enabled on CPU#0.

CPU:     After generic, caps: 3febfbff 00000000 00000000 00000000

CPU:             Common caps: 3febfbff 00000000 00000000 00000000

CPU: Intel(R) Pentium(R) 4 CPU 1700MHz stepping 0a

Enabling fast FPU save and restore... done.

Enabling unmasked SIMD FPU exception support... done.

Checking 'hlt' instruction... OK.

POSIX conformance testing by UNIFIX

enabled ExtINT on CPU#0

ESR value before enabling vector: 00000000

ESR value after enabling vector: 00000000

Using local APIC timer interrupts.

calibrating APIC timer ...

..... CPU clock speed is 1680.8027 MHz.

..... host bus clock speed is 98.8707 MHz.

cpu: 0, clocks: 988707, slice: 494353

CPU0<T0:988704,T1:494336,D:15,S:494353,C:988707>

mtrr: v1.40 (20010327) Richard Gooch (rgooch@atnf.csiro.au)

mtrr: detected mtrr type: Intel

PCI: PCI BIOS revision 2.10 entry at 0xfc03e, last bus=2

PCI: Using configuration type 1

PCI: Probing PCI hardware

Unknown bridge resource 0: assuming transparent

Unknown bridge resource 2: assuming transparent

PCI: Using IRQ router PIIX [8086/2440] at 00:1f.0

PCI: Cannot allocate resource region 8 of bridge 00:01.0

Linux NET4.0 for Linux 2.4

Based upon Swansea University Computer Society NET3.039

Initializing RT netlink socket

apm: BIOS version 1.2 Flags 0x03 (Driver version 1.16)

Starting kswapd

Journalled Block Device driver loaded

devfs: v1.12a (20020514) Richard Gooch (rgooch@atnf.csiro.au)

devfs: boot_options: 0x1

NTFS driver 2.1.0a [Flags: R/O].

udf: registering filesystem

Detected PS/2 Mouse Port.

Uniform Multi-Platform E-IDE driver Revision: 6.31

ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx

ICH2: IDE controller on PCI bus 00 dev f9

ICH2: detected chipset, but driver not compiled in!

ICH2: chipset revision 4

ICH2: not 100% native mode: will probe irqs later

    ide0: BM-DMA at 0xffa0-0xffa7, BIOS settings: hda:DMA, hdb:DMA

    ide1: BM-DMA at 0xffa8-0xffaf, BIOS settings: hdc:DMA, hdd:DMA

hda: MAXTOR 6L040J2, ATA DISK drive

hdb: IC35L020AVER07-0, ATA DISK drive

hdc: SAMSUNG CDRW/DVD SM-308B, ATAPI CD/DVD-ROM drive

hdd: 52X24X52 CD-RW 1.04 20021127, ATAPI CD/DVD-ROM drive

ide0 at 0x1f0-0x1f7,0x3f6 on irq 14

ide1 at 0x170-0x177,0x376 on irq 15

hda: 78177792 sectors (40027 MB) w/1819KiB Cache, CHS=4866/255/63

hdb: 39102336 sectors (20020 MB) w/1916KiB Cache, CHS=2434/255/63

Partition check:

 /dev/ide/host0/bus0/target0/lun0: p1 p2 < p5 p6 >

 /dev/ide/host0/bus0/target1/lun0: p1 p2

Floppy drive(s): fd0 is 1.44M

FDC 0 is a National Semiconductor PC87306

PCI: Found IRQ 11 for device 02:0c.0

3c59x: Donald Becker and others. www.scyld.com/network/vortex.html

02:0c.0: 3Com PCI 3c905C Tornado at 0xec00. Vers LK1.1.16

Linux agpgart interface v0.99 (c) Jeff Hartmann

agpgart: Maximum main memory to use for agp memory: 690M

agpgart: Detected Intel i850 chipset

agpgart: AGP aperture is 64M @ 0xf8000000

SCSI subsystem driver Revision: 1.00

scsi0 : SCSI host adapter emulation for IDE ATAPI devices

  Vendor: SAMSUNG   Model: CDRW/DVD SM-308B  Rev: M002

  Type:   CD-ROM                             ANSI SCSI revision: 02

  Vendor:           Model: 52X24X52 CD-RW    Rev: 1.04

  Type:   CD-ROM                             ANSI SCSI revision: 02

Attached scsi CD-ROM sr0 at scsi0, channel 0, id 0, lun 0

Attached scsi CD-ROM sr1 at scsi0, channel 0, id 1, lun 0

sr0: scsi3-mmc drive: 0x/32x writer cd/rw xa/form2 cdda tray

Uniform CD-ROM driver Revision: 3.12

sr1: scsi3-mmc drive: 52x/52x writer cd/rw xa/form2 cdda tray

Linux Kernel Card Services 3.1.22

  options:  [pci] [cardbus] [pm]

usb.c: registered new driver hub

uhci.c: USB Universal Host Controller Interface driver v1.1

PCI: Found IRQ 11 for device 00:1f.2

PCI: Setting latency timer of device 00:1f.2 to 64

uhci.c: USB UHCI at I/O 0xff80, IRQ 11

usb.c: new USB bus registered, assigned bus number 1

hub.c: USB hub found

hub.c: 2 ports detected

PCI: Found IRQ 9 for device 00:1f.4

PCI: Setting latency timer of device 00:1f.4 to 64

uhci.c: USB UHCI at I/O 0xff60, IRQ 9

usb.c: new USB bus registered, assigned bus number 2

hub.c: USB hub found

hub.c: 2 ports detected

usb.c: registered new driver hid

hid-core.c: v1.8.1 Andreas Gal, Vojtech Pavlik <vojtech@suse.cz>

hid-core.c: USB HID support drivers

usb.c: registered new driver usblp

printer.c: v0.11: USB Printer Device Class driver

mice: PS/2 mouse device common for all mice

NET4: Linux TCP/IP 1.0 for NET4.0

IP Protocols: ICMP, UDP, TCP

IP: routing cache hash table of 8192 buckets, 64Kbytes

TCP: Hash tables configured (established 262144 bind 65536)

ip_conntrack version 2.1 (6139 buckets, 49112 max) - 304 bytes per conntrack

ip_tables: (C) 2000-2002 Netfilter core team

ipt_time loading

ipt_random match loaded

netfilter PSD loaded - (c) astaro AG

ipt_nth match loaded

ipt_ipv4options loading

ipt_IPV4OPTSSTRIP loaded

arp_tables: (C) 2002 David S. Miller

NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.

cryptoapi: loaded

cryptoapi: Registered aes-ecb (0)

cryptoapi: Registered aes-cbc (65536)

cryptoapi: Registered aes-cfb (262144)

cryptoapi: Registered blowfish-ecb (0)

cryptoapi: Registered blowfish-cbc (65536)

cryptoapi: Registered blowfish-cfb (262144)

cryptoapi: Registered cast5-ecb (0)

cryptoapi: Registered cast5-cbc (65536)

cryptoapi: Registered cast5-cfb (262144)

cryptoapi: Registered des-ecb (0)

cryptoapi: Registered des-cbc (65536)

cryptoapi: Registered des-cfb (262144)

cryptoapi: Registered des_ede3-ecb (0)

cryptoapi: Registered des_ede3-cbc (65536)

cryptoapi: Registered des_ede3-cfb (262144)

cryptoapi: Registered dfc-ecb (0)

cryptoapi: Registered dfc-cbc (65536)

cryptoapi: Registered dfc-cfb (262144)

cryptoapi: Registered idea-ecb (0)

cryptoapi: Registered idea-cbc (65536)

cryptoapi: Registered idea-cfb (262144)

cryptoapi: Registered mars-ecb (0)

cryptoapi: Registered mars-cbc (65536)

cryptoapi: Registered mars-cfb (262144)

cryptoapi: Registered rc5-ecb (0)

cryptoapi: Registered rc5-cbc (65536)

cryptoapi: Registered rc6-ecb (0)

cryptoapi: Registered rc6-cbc (65536)

cryptoapi: Registered rc6-cfb (262144)

cryptoapi: Registered serpent-ecb (0)

cryptoapi: Registered serpent-cbc (65536)

cryptoapi: Registered serpent-cfb (262144)

cryptoapi: Registered twofish-ecb (0)

cryptoapi: Registered twofish-cbc (65536)

cryptoapi: Registered twofish-cfb (262144)

MD5 Message Digest Algorithm (c) RSA Systems, Inc

cryptoapi: Registered md5 (0)

cryptoapi: Registered sha1 (0)

ds: no socket drivers loaded!

FAT: bogus logical sector size 0

kmod: failed to exec /sbin/modprobe -s -k nls_iso8859-1, errno = 2

UDF-fs DEBUG lowlevel.c:65:udf_get_last_session: CDROMMULTISESSION not supported: rc=-5

UDF-fs DEBUG super.c:1421:udf_read_super: Multi-session=0

UDF-fs DEBUG super.c:410:udf_vrs: Starting at sector 16 (2048 byte sectors)

UDF-fs DEBUG super.c:1157:udf_check_valid: Failed to read byte 32768. Assuming open disc. Skipping validity check

UDF-fs DEBUG misc.c:285:udf_read_tagged: location mismatch block 256, tag 2475922323 != 256

UDF-fs DEBUG super.c:1211:udf_load_partition: No Anchor block found

UDF-fs: No partition found (1)

hub.c: USB new device connect on bus1/1, assigned device number 2

printer.c: usblp0: USB Bidirectional printer dev 2 if 0 alt 0 proto 2 vid 0x043D pid 0x0014

hub.c: USB new device connect on bus1/2, assigned device number 3

input0,hiddev0: USB HID v1.10 Mouse [Microsoft Microsoft Wireless Intellimouse Explorer® 1.0A] on usb1:3.0

reiserfs: checking transaction log (device 03:06) ...

Using r5 hash to sort names

ReiserFS version 3.6.25

VFS: Mounted root (reiserfs filesystem) readonly.

Mounted devfs on /dev

Freeing unused kernel memory: 92k freed

Adding Swap: 385520k swap-space (priority -1)

0: nvidia: loading NVIDIA Linux x86 nvidia.o Kernel Module  1.0-4349  Thu Mar 27 19:00:02 PST 2003

PCI: Found IRQ 11 for device 02:07.0

PCI: Sharing IRQ 11 with 01:00.0

```

The above was my whole output...this is the part from above that seems relevant:

```

Uniform Multi-Platform E-IDE driver Revision: 6.31

ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx

ICH2: IDE controller on PCI bus 00 dev f9

ICH2: detected chipset, but driver not compiled in!

ICH2: chipset revision 4

ICH2: not 100% native mode: will probe irqs later

    ide0: BM-DMA at 0xffa0-0xffa7, BIOS settings: hda:DMA, hdb:DMA

    ide1: BM-DMA at 0xffa8-0xffaf, BIOS settings: hdc:DMA, hdd:DMA

hda: MAXTOR 6L040J2, ATA DISK drive

hdb: IC35L020AVER07-0, ATA DISK drive

hdc: SAMSUNG CDRW/DVD SM-308B, ATAPI CD/DVD-ROM drive

hdd: 52X24X52 CD-RW 1.04 20021127, ATAPI CD/DVD-ROM drive

ide0 at 0x1f0-0x1f7,0x3f6 on irq 14

ide1 at 0x170-0x177,0x376 on irq 15

hda: 78177792 sectors (40027 MB) w/1819KiB Cache, CHS=4866/255/63

hdb: 39102336 sectors (20020 MB) w/1916KiB Cache, CHS=2434/255/63

Partition check:

/dev/ide/host0/bus0/target0/lun0: p1 p2 < p5 p6 >

/dev/ide/host0/bus0/target1/lun0: p1 p2

Floppy drive(s): fd0 is 1.44M

FDC 0 is a National Semiconductor PC87306

PCI: Found IRQ 11 for device 02:0c.0

3c59x: Donald Becker and others. www.scyld.com/network/vortex.html

02:0c.0: 3Com PCI 3c905C Tornado at 0xec00. Vers LK1.1.16

Linux agpgart interface v0.99 (c) Jeff Hartmann

agpgart: Maximum main memory to use for agp memory: 690M

agpgart: Detected Intel i850 chipset

agpgart: AGP aperture is 64M @ 0xf8000000

SCSI subsystem driver Revision: 1.00

scsi0 : SCSI host adapter emulation for IDE ATAPI devices

  Vendor: SAMSUNG   Model: CDRW/DVD SM-308B  Rev: M002

  Type:   CD-ROM                             ANSI SCSI revision: 02

  Vendor:           Model: 52X24X52 CD-RW    Rev: 1.04

  Type:   CD-ROM                             ANSI SCSI revision: 02

Attached scsi CD-ROM sr0 at scsi0, channel 0, id 0, lun 0

Attached scsi CD-ROM sr1 at scsi0, channel 0, id 1, lun 0

sr0: scsi3-mmc drive: 0x/32x writer cd/rw xa/form2 cdda tray

Uniform CD-ROM driver Revision: 3.12

sr1: scsi3-mmc drive: 52x/52x writer cd/rw xa/form2 cdda tray 

```

I'm wondering if because I have my cd-drives under scsi-emulation if that might effect performance by not allowing dma?  But at the same time, it seems that dma is enabled.  But before I added hdparm to my start-up sequence, if I ever did an hdparm /dev/hdc or /dev/sr0 I'd get an error of "No such file or directory" or "hdparm does not work with scsi devices" respectively.

----------

## Valen

Ok, I don't know why you aren't getting your hard drives automatically enabled -- maybe someone else can help if you really don't like the idea of having hdparm in your startup sequence.  For your cd drives, try to see if the node /dev/ide/host0/bus1/target0/lun0/ exists, if it does it should contain a node inside it called 'cd' or something similar.  You can try hdparm on that -- it should still work (I haven't played with scsi-emulation so I can't be sure).  But I'm fairly sure your cd is working correctly if /proc says dma is enabled.

----------

## taskara

when you re-compiled your kernel, did you copy over the new bzImage file ?

and if so, did you mount /boot first!?

----------

## wHAcKer

thanks valen, that did the trick, everything was enabled except for -u, i was just looking at it to optimize everything  :Smile: 

----------

## Nkill

For some reason I need to manually enable DMA everytime I start up. I had the enable DMA when available flag checked when I compiled the kernel so I dont know what gives.

----------

## taskara

 *Nkill wrote:*   

> For some reason I need to manually enable DMA everytime I start up. I had the enable DMA when available flag checked when I compiled the kernel so I dont know what gives.

 

this is prob cause it's using a generic ide driver.. but it's no matter, I get a better performance out of a generic ide driver with dma manually enabled than out of the actual driver! so I leave it out  :Smile: 

if u have to enable it each time you boot, just add it to /etc/autostart.local

hdparm -d1 /dev/hdx (I put in other options too like -X69 etc)

----------

## duff

 *Nkill wrote:*   

> For some reason I need to manually enable DMA everytime I start up. I had the enable DMA when available flag checked when I compiled the kernel so I dont know what gives.

 

```
# rc-update add hdparm boot
```

This will enable DMA on all your devices for you.

----------

## marshall_j

 *rajl wrote:*   

> 
> 
> Also, on a side note: is there anyway I can get my hard-disks to idle down after a long time of inactivity like windows does?  I live in a dorm room and the extra noise is killing my roommate when he goes to sleep.  In addition, air circulation is bad in the room, so anyway to use less power and generate less heat is a plus.

 

hdparm -S <time> <device> should cause the disk to spin down after the specified time. man pages should tell you if I'm wrong  :Smile: 

M

----------

