# HDIO_SET_DMA failed: Operation not permitted

## ions

Recently reinstalled Gentoo due to me being an idiot. <- Different story.

Anyway my new install is much slower than my old install was. In fact a Gnoppix disc is FAR faster than my Gentoo install.

The good news is I'm not getting the DMA errors I once was. The bad news is my system performance BLOWS. Trying to enable DMA keeps failing. FWIW using the PC with the DMA errors I used to have caused absolutely no problems. And for the performance sacrifice that not running DMA causes I am more than willing to put up with that error spamming my dmesg.

Here's what I gots:

Relevent bits in the kernel (afaik):

```

[*]       Generic PCI bus-master DMA support 

[*]         Use PCI DMA by default when available 

<*>         VIA82CXXX chipset support                                       

<*>         Intel PIIXn chipsets support 

```

```

# lspci

0000:00:00.0 Host bridge: VIA Technologies, Inc. VT8363/8365 [KT133/KM133] (rev 02)

0000:00:01.0 PCI bridge: VIA Technologies, Inc. VT8363/8365 [KT133/KM133 AGP]

0000:00:07.0 ISA bridge: VIA Technologies, Inc. VT82C686 [Apollo Super South] (rev 22)

0000:00:07.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 10)

0000:00:07.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 10)

0000:00:07.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 10)

0000:00:07.4 Host bridge: VIA Technologies, Inc. VT82C686 [Apollo Super ACPI] (rev 30)

0000:00:0d.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8029(AS)

0000:00:0f.0 Multimedia audio controller: Creative Labs SB Live! EMU10k1 (rev 08)

0000:00:0f.1 Input device controller: Creative Labs SB Live! MIDI/Game Port (rev 08)

0000:00:13.0 Unknown mass storage controller: Triones Technologies, Inc. HPT366/368/370/370A/372 (rev 03)

0000:01:00.0 VGA compatible controller: nVidia Corporation NV11 [GeForce2 MX/MX 400] (rev b2)

```

```

# hdparm -i /dev/hda

/dev/hda:

 Model=WDC WD400BB-00AUA1, FwRev=18.20D18, SerialNo=WD-WMA6R2066421

 Config={ HardSect NotMFM HdSw>15uSec SpinMotCtl Fixed DTR>5Mbs FmtGapReq }

 RawCHS=16383/16/63, TrkSize=57600, SectSize=600, ECCbytes=40

 BuffType=DualPortCache, BuffSize=2048kB, MaxMultSect=16, MultSect=16

 CurCHS=4047/16/255, CurSects=16511760, LBA=yes, LBAsects=78165360

 IORDY=on/off, tPIO={min:120,w/IORDY:120}, tDMA={min:120,rec:120}

 PIO modes:  pio0 pio1 pio2 pio3 pio4

 DMA modes:  mdma0 mdma1 mdma2

 UDMA modes: udma0 udma1 udma2 udma3 *udma4 udma5

 AdvancedPM=no WriteCache=enabled

 Drive conforms to: device does not report version:

 * signifies the current active mode

```

Attempting to enable DMA leads to this:

```

# hdparm -d 1 /dev/hda

/dev/hda:

 setting using_dma to 1 (on)

 HDIO_SET_DMA failed: Operation not permitted

 using_dma    =  0 (off)

```

----------

## Bob P

kernel 2.6.9?

----------

## ions

Oops!  Yeah, 2.6.9.  That's what I forgot.   :Embarassed: 

Previous install with working DMA was also 2.6.9.

----------

## Bob P

yeah, i have had the same problems with 2.6.9 -- i was never able to overcome them after a kernel upgrade, and i am re-bootstrapping as i type this.

you may want to do a search for the strings "2.6.9 AND DMA".  i think you'll get lots of hits.  sorry i didn't have a better answer.

----------

## Bob P

can you boot an older kernel that still has DMA functioning properly?

do you have the ability to compare the output of "dmesg" with your kernel where DMA does not work wtih the output from your kernel where DMA does work?

----------

## tuam

How is your controller recognized in dmesg?

FF,

 Daniel

----------

## ions

This is a fresh install with only one working kernel installed.  The old install, unfortunately, is long gone.  So I won't be comparing dmesg outputs.  

Here is theh dmesg I have now:

```

<snip>

DMA zone: 4096 pages, LIFO batch:1

<snip>

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

Probing IDE interface ide0...

hda: WDC WD400BB-00AUA1, ATA DISK drive

hdb: IC35L040AVVN07-0, ATA DISK drive

Probing IDE interface ide1...

hdc: LITE-ON LTR-52327S, ATAPI CD/DVD-ROM drive

Probing IDE interface ide2...

ide2: Wait for ready failed before probe !

Probing IDE interface ide3...

ide3: Wait for ready failed before probe !

Probing IDE interface ide4...

ide4: Wait for ready failed before probe !

Probing IDE interface ide5...

ide5: Wait for ready failed before probe !

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

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

hda: max request size: 128KiB

hda: 78165360 sectors (40020 MB) w/2048KiB Cache, CHS=65535/16/63

hda: cache flushes not supported

 hda: hda1 hda2 hda3

```

Hope I got all that's useful in there.

----------

## ions

 *Bob P wrote:*   

> 
> 
> you may want to do a search for the strings "2.6.9 AND DMA".  i think you'll get lots of hits.  sorry i didn't have a better answer.

 

hehe, figures:

"No topics or posts met your search criteria"

Edit:  I don't mean to say that searching is useless.  I have searched and most often people solve this problem by making sure that one/all of the kernel options I listed are selected.  Mine are.  I did search but I couldn't find anything that worked.   :Sad: 

----------

## Bob P

removed

----------

## Bob P

Tuam, if you look at dmesg you'll see that some kernels turn on the APIC while some don't.

 *ions wrote:*   

> 
> 
> ```
> 
> <snip>
> ...

 

well, its not complete.  post it all if you can. 

it looks like your IDE interface is initialized at UDMA33.  what kind of UDMA support do your controller and hard disk support?  ATA/66?  have you tried setting "idebus=66" as a kernel command line parameter?

----------

## tuam

There should be some chipset-specific messages, like mine

```
VP_IDE: IDE controller at PCI slot 0000:00:04.1

VP_IDE: chipset revision 16

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

VP_IDE: VIA vt82c686a (rev 22) IDE UDMA66 controller on pci0000:00:04.1

    ide0: BM-DMA at 0xd800-0xd807, BIOS settings: hda:DMA, hdb:DMA

    ide1: BM-DMA at 0xd808-0xd80f, BIOS settings: hdc:DMA, hdd:DMA

```

If they aren't there, you haven't loaded the right driver.

FF,

 Daniel

----------

## ions

Yeah it doesn't look like I have the right driver loaded.

Makes no sense to me though:

#lspci says this is what I have:

```
0000:00:07.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 10)
```

I do have "<*> VIA82CXXX chipset support" in my kernel....

The mobo is a ABit KT7.  

I'm gonna check those threads out now.

----------

## ions

dmesg in total:

```
$ dmesg

Linux version 2.6.9 (root@tux) (gcc version 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2, pie-8.7.6)) #6 Sat Nov 13 15:09:43 EST 2004

BIOS-provided physical RAM map:

 BIOS-e820: 0000000000000000 - 00000000000a0000 (usable)

 BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)

 BIOS-e820: 0000000000100000 - 0000000027ff0000 (usable)

 BIOS-e820: 0000000027ff0000 - 0000000027ff3000 (ACPI NVS)

 BIOS-e820: 0000000027ff3000 - 0000000028000000 (ACPI data)

 BIOS-e820: 00000000ffff0000 - 0000000100000000 (reserved)

639MB LOWMEM available.

On node 0 totalpages: 163824

  DMA zone: 4096 pages, LIFO batch:1

  Normal zone: 159728 pages, LIFO batch:16

  HighMem zone: 0 pages, LIFO batch:1

DMI 2.3 present.

ACPI: RSDP (v000 VT8371                                ) @ 0x000f7b70

ACPI: RSDT (v001 VT8371 AWRDACPI 0x42302e31 AWRD 0x00000000) @ 0x27ff3000

ACPI: FADT (v001 VT8371 AWRDACPI 0x42302e31 AWRD 0x00000000) @ 0x27ff3040

ACPI: DSDT (v001 VT8371 AWRDACPI 0x00001000 MSFT 0x0100000c) @ 0x00000000

Built 1 zonelists

Kernel command line: root=/dev/hda3 devfs=nomount

Initializing CPU#0

CPU 0 irqstacks, hard=c0581000 soft=c0580000

PID hash table entries: 4096 (order: 12, 65536 bytes)

Detected 800.571 MHz processor.

Using tsc for high-res timesource

Console: colour VGA+ 80x25

Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)

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

Memory: 644008k/655296k available (3345k kernel code, 10792k reserved, 1066k data, 172k init, 0k highmem)

Checking if this processor honours the WP bit even in supervisor mode... Ok.

Calibrating delay loop... 1568.76 BogoMIPS (lpj=784384)

Mount-cache hash table entries: 512 (order: 0, 4096 bytes)

CPU: After generic identify, caps: 0183f9ff c1c7f9ff 00000000 00000000

CPU: After vendor identify, caps:  0183f9ff c1c7f9ff 00000000 00000000

CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)

CPU: L2 Cache: 64K (64 bytes/line)

CPU: After all inits, caps:        0183f9ff c1c7f9ff 00000000 00000020

Intel machine check architecture supported.

Intel machine check reporting enabled on CPU#0.

CPU: AMD Duron(tm) Processor stepping 00

Enabling fast FPU save and restore... done.

Checking 'hlt' instruction... OK.

ACPI: IRQ9 SCI: Level Trigger.

NET: Registered protocol family 16

PCI: PCI BIOS revision 2.10 entry at 0xfb430, last bus=1

PCI: Using configuration type 1

mtrr: v2.0 (20020519)

ACPI: Subsystem revision 20040816

ACPI: Interpreter enabled

ACPI: Using PIC for interrupt routing

ACPI: PCI Root Bridge [PCI0] (00:00)

PCI: Probing PCI hardware (bus 00)

ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT]

ACPI: PCI Interrupt Link [LNKA] (IRQs 1 3 4 5 6 7 10 11 *12 14 15)

ACPI: PCI Interrupt Link [LNKB] (IRQs 1 3 4 5 6 7 *10 11 12 14 15)

ACPI: PCI Interrupt Link [LNKC] (IRQs 1 3 4 5 6 7 10 *11 12 14 15)

ACPI: PCI Interrupt Link [LNKD] (IRQs 1 3 4 *5 6 7 10 11 12 14 15)

Linux Plug and Play Support v0.97 (c) Adam Belay

SCSI subsystem initialized

usbcore: registered new driver usbfs

usbcore: registered new driver hub

PCI: Using ACPI for IRQ routing

ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 5

ACPI: PCI interrupt 0000:00:07.2[D] -> GSI 5 (level, low) -> IRQ 5

ACPI: PCI interrupt 0000:00:07.3[D] -> GSI 5 (level, low) -> IRQ 5

ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 10

ACPI: PCI interrupt 0000:00:0d.0[A] -> GSI 10 (level, low) -> IRQ 10

ACPI: PCI interrupt 0000:00:0f.0[A] -> GSI 10 (level, low) -> IRQ 10

ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 11

ACPI: PCI interrupt 0000:00:13.0[A] -> GSI 11 (level, low) -> IRQ 11

ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 12

ACPI: PCI interrupt 0000:01:00.0[A] -> GSI 12 (level, low) -> IRQ 12

pnp: the driver 'system' has been registered

Machine check exception polling timer started.

audit: initializing netlink socket (disabled)

audit(1100643858.4294966529:0): initialized

Installing knfsd (copyright (C) 1996 okir@monad.swb.de).

NTFS driver 2.1.20 [Flags: R/O].

SGI XFS with large block numbers, no debug enabled

vesafb: probe of vesafb0 failed with error -6

ACPI: Power Button (FF) [PWRF]

ACPI: Sleep Button (CM) [SLPB]

ACPI: Processor [CPU0] (supports C1 C2, 2 throttling states)

lp: driver loaded but no devices found

Linux agpgart interface v0.100 (c) Dave Jones

serio: i8042 AUX port at 0x60,0x64 irq 12

serio: i8042 KBD port at 0x60,0x64 irq 1

Serial: 8250/16550 driver $Revision: 1.90 $ 8 ports, IRQ sharing disabled

ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A

ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A

pnp: the driver 'serial' has been registered

parport0: PC-style at 0x378 [PCSPP(,...)]

lp0: using parport0 (polling).

parport_pc: Via 686A parallel port: io=0x378

Using anticipatory io scheduler

Floppy drive(s): fd0 is 1.44M

FDC 0 is a post-1991 82077

ne2k-pci.c:v1.03 9/22/2003 D. Becker/P. Gortmaker

  http://www.scyld.com/network/ne2k-pci.html

ACPI: PCI interrupt 0000:00:0d.0[A] -> GSI 10 (level, low) -> IRQ 10

eth0: RealTek RTL-8029 found at 0xcc00, IRQ 10, 00:80:C8:DD:4C:F6.

Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2

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

Probing IDE interface ide0...

hda: WDC WD400BB-00AUA1, ATA DISK drive

hdb: IC35L040AVVN07-0, ATA DISK drive

Probing IDE interface ide1...

hdc: LITE-ON LTR-52327S, ATAPI CD/DVD-ROM drive

Probing IDE interface ide2...

ide2: Wait for ready failed before probe !

Probing IDE interface ide3...

ide3: Wait for ready failed before probe !

Probing IDE interface ide4...

ide4: Wait for ready failed before probe !

Probing IDE interface ide5...

ide5: Wait for ready failed before probe !

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

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

hda: max request size: 128KiB

hda: 78165360 sectors (40020 MB) w/2048KiB Cache, CHS=65535/16/63

hda: cache flushes not supported

 hda: hda1 hda2 hda3

hdb: max request size: 128KiB

hdb: 80418240 sectors (41174 MB) w/1863KiB Cache, CHS=65535/16/63

hdb: cache flushes supported

 hdb: hdb1

hdc: ATAPI 52X CD-ROM CD-R/RW drive, 2048kB Cache

Uniform CD-ROM driver Revision: 3.20

libata version 1.02 loaded.

USB Universal Host Controller Interface driver v2.2

ACPI: PCI interrupt 0000:00:07.2[D] -> GSI 5 (level, low) -> IRQ 5

uhci_hcd 0000:00:07.2: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller

uhci_hcd 0000:00:07.2: irq 5, io base 0000c400

uhci_hcd 0000:00:07.2: new USB bus registered, assigned bus number 1

hub 1-0:1.0: USB hub found

hub 1-0:1.0: 2 ports detected

ACPI: PCI interrupt 0000:00:07.3[D] -> GSI 5 (level, low) -> IRQ 5

uhci_hcd 0000:00:07.3: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (#2)

uhci_hcd 0000:00:07.3: irq 5, io base 0000c800

uhci_hcd 0000:00:07.3: new USB bus registered, assigned bus number 2

hub 2-0:1.0: USB hub found

hub 2-0:1.0: 2 ports detected

usbcore: registered new driver usblp

drivers/usb/class/usblp.c: v0.13: USB Printer Device Class driver

Initializing USB Mass Storage driver...

usbcore: registered new driver usb-storage

USB Mass Storage support registered.

usbcore: registered new driver usbhid

drivers/usb/input/hid-core.c: v2.0:USB HID core driver

mice: PS/2 mouse device common for all mice

input: AT Translated Set 2 keyboard on isa0060/serio0

Advanced Linux Sound Architecture Driver Version 1.0.6 (Sun Aug 15 07:17:53 2004 UTC).

ACPI: PCI interrupt 0000:00:0f.0[A] -> GSI 10 (level, low) -> IRQ 10

ALSA device list:

  #0: Sound Blaster Live! (rev.8) at 0xd000, irq 10

oprofile: using timer interrupt.

NET: Registered protocol family 2

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

TCP: Hash tables configured (established 262144 bind 65536)

ip_conntrack version 2.1 (5119 buckets, 40952 max) - 300 bytes per conntrack

ip_tables: (C) 2000-2002 Netfilter core team

ipt_recent v0.3.1: Stephen Frost <sfrost@snowman.net>.  http://snowman.net/projects/ipt_recent/

arp_tables: (C) 2002 David S. Miller

NET: Registered protocol family 1

NET: Registered protocol family 17

ACPI: (supports S0 S1 S4 S5)

ACPI wakeup devices:

SLPB PCI0 USB0 USB1 MODM UAR1 UAR2 LPT1

EXT3-fs: mounted filesystem with ordered data mode.

VFS: Mounted root (ext3 filesystem) readonly.

Freeing unused kernel memory: 172k freed

kjournald starting.  Commit interval 5 seconds

usb 1-2: new low speed USB device using address 2

input: USB HID v1.11 Mouse [Microsoft Microsoft Wireless Optical Mouse� 1.0A] on usb-0000:00:07.2-2

spurious 8259A interrupt: IRQ7.

Adding 977248k swap on /dev/hda2.  Priority:-1 extents:1

EXT3 FS on hda3, internal journal

kjournald starting.  Commit interval 5 seconds

EXT3 FS on hdb1, internal journal

EXT3-fs: mounted filesystem with ordered data mode.

nvidia: module license 'NVIDIA' taints kernel.

ACPI: PCI interrupt 0000:01:00.0[A] -> GSI 12 (level, low) -> IRQ 12

NVRM: loading NVIDIA Linux x86 NVIDIA Kernel Module  1.0-6111  Tue Jul 27 07:55:38 PDT 2004

```

----------

## ions

It would appear that this problem is also causing my time to be affected: https://forums.gentoo.org/viewtopic.php?p=1775453#1775453

----------

## tuam

 *ions wrote:*   

> I do have "<*> VIA82CXXX chipset support" in my kernel....
> 
> 

 

That should be the right one. Have you tried to compile the drivers as modules? Why do you include the Intel PIIXn?

FF,

 Daniel

----------

## Bob P

obsolete information purged.

----------

## ions

I included Intel PIIXn because it was suggested in another thread I found while searching.  Apparently it does nothing for me.  No I haven't tried loading VIA82CXXX as a module.  Guess I could do that...seems kinda silly to have that as a module though doesn't it?  Or is that just me?  I'll try it and let you know.

I am certain that I have my time set correctly.  I can repeat the problem with an emerge if it's large enough.

----------

## Bob P

obsolete information purged.

----------

## ions

Removed the Intel bit and changed VIA82CXXX to a module and....nothing.

----------

## Bob P

try removing the intel bit and keeping via82cxxx in the kernel with <*> instead of <M>.  maybe that will help?

----------

## ions

Also no change.  

While I was restarting I double checked the bios.  DMA is enabled according to it.

----------

## tuam

 *ions wrote:*   

> Removed the Intel bit and changed VIA82CXXX to a module and....nothing.

 

Not even a failure message?

OK, then I'm starting try-and-error: What happens when you boot from the live CD?

FF,

 Daniel

----------

## Bob P

which 2.6.9 release are you using?  gentoo-dev-sources?  which r number?

i had the same problem with 2.6.9-gentoo-r3.   i filed a bug report on bugzilla, and receivced help from one of the kernel devleopers (dsd) but i could never find a solution.  i think yoiu'll find the link to the bug report in those hyperlinks i posted earlier.

i upgraded to 2.6.9-gentoo-r4 and DMA worked.  this makes absolutely no sense, as my computer has a "blacklisted" chipset and DMA should not work on it.  nonetheless, it works now, and the kernel delveopers have no idea why this has happened.  right now they're looking over my dmesg output and trying to make sense of the situation.

----------

## ions

 *tuam wrote:*   

>  *ions wrote:*   Removed the Intel bit and changed VIA82CXXX to a module and....nothing. 
> 
> Not even a failure message?
> 
> OK, then I'm starting try-and-error: What happens when you boot from the live CD?
> ...

 

Nope, no failure message.  DMA works with Live CDs.  2004.2 and Gnoppix as well.  Just of note Ubuntu also manages to enable it.

I believe I'm using the r1 kernel but I'm not positive.  I was gonna try and wait this out until 2.6.10 came out but the horrible performace and doing a ntpdate after every emerge is a RPITA.  It took nearly 15 minutes to mv some documents from one drive to another recently.

----------

## ions

I just ripped and encoded an album.  Before I started my time was within a few seconds of being accurate.  After the encode: offset 947.325579 sec.

----------

## jdiskywlkr

I the same problem when trying to enable dma on my drives.  I removed

     < >     generic/default IDE chipset support &&

     < >       Generic PCI IDE Chipset Support

and selected my chipset specific drivers (VIA)  along with the generic DMA

     [*]       Generic PCI bus-master DMA support

and I can now enable DMA on those drives attached to my VIA chipset.

----------

