# HDIO_SET_DMA failed: Operation not permitted

## IvanYosifov

Hello Everyone,

I am trying to enable dma on my cdrom

localhost ~ # hdparm -d 1 /dev/hdc

/dev/hdc:

 setting using_dma to 1 (on)

 HDIO_SET_DMA failed: Operation not permitted

 using_dma    =  0 (off)

I am using a GA-8IPE1000 motherboard , chipset is Intel i865PE , ATAPI cdrom LG GCE-8525B. Perhaps something is wrong with my kernel config, but I have no idea what. DMA support ( I think ) is enabled.

Kernel is 2.6.9-r9. Thanks. Config is at http://www.jec-bg.com/ivan/configLast edited by IvanYosifov on Tue Dec 14, 2004 8:55 am; edited 1 time in total

----------

## adaptr

A friendly word of advice: posting a full kernel config like you just did practically ensures that not too many people will take the time needed to sift through it.

At least half the reason I responded at all was to tell you this.

Put it on a web site somewhere, or snip the relevant bits, but unless asked to or absolutely desparate don't post 500-line config files!

Nobody will thank you for it.

Really.

Seriously.

No, really.

Really really.

Now then, onto your plight: don't think you have enabled DMA in the BIOS - make sure of it.

You can always see this on startup when the summary screen scrolls by - just pause it to take a good look.

And - the CD drive ?

How do you know it does DMA in the first place ?

----------

## alkan

what would be the output of 

```

hdparm -i /dev/hdc

hdparm -i /dev/hdd

```

Last edited by alkan on Tue Dec 14, 2004 9:19 am; edited 1 time in total

----------

## IvanYosifov

You were right about the config , sorry. 

Now , ontopic:

 *Quote:*   

> 
> 
> Now then, onto your plight: don't think you have enabled DMA in the BIOS - make sure of it.
> 
> You can always see this on startup when the summary screen scrolls by - just pause it to take a good look. 
> ...

 

The "I think" was about the kernel config , not the BIOS. In my BIOS there are no options for enabling/disabling DMA. 

Neither is any DMA info in the "fly by messages". The only thing that has to do with my cdrom there is this line:

 *Quote:*   

> 
> 
> Sec. Master Disk: CD-RW,ATA33 
> 
> 

 

Is that what you meant ?

 *Quote:*   

> 
> 
> And - the CD drive ?
> 
> How do you know it does DMA in the first place ?
> ...

 

The FAQ at http://www.lge.com/catalog/prodmodeldetail?catModel=0&actType=&modelName=&globalCode=GCE-8525B&modelPrefix=40CWDA&globalSuffix=000000&currentPage=&categoryId=CTG1000500&parentId=CTG1000439&modelCategoryId=CTG1000502&page=

says so. 

On the other hand , this a 52x32x52 burner ,

you cant get that without DMA.

----------

## IvanYosifov

localhost / # hdparm -i /dev/hda

/dev/hda: No such device or address

The harddisk is a SATA drive and is /dev/sda

localhost / # hdparm -i /dev/hdc

/dev/hdc:

 Model=HL-DT-ST GCE-8526B, FwRev=1.02, SerialNo=

 Config={ Fixed Removeable DTR<=5Mbs DTR>10Mbs nonMagnetic }

 RawCHS=0/0/0, TrkSize=0, SectSize=0, ECCbytes=0

 BuffType=unknown, BuffSize=0kB, MaxMultSect=0

 (maybe): CurCHS=0/0/0, CurSects=0, LBA=yes, LBAsects=0

 IORDY=yes, tPIO={min:227,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

 AdvancedPM=no

 Drive conforms to: ATA/ATAPI-6 T13 1410D revision 3a:

 * signifies the current active mode

I dont why this says that udma is enabled. It does not seem so:

localhost / # hdparm -t /dev/hdc

/dev/hdc:

 Timing buffered disk reads:    8 MB in  3.04 seconds =   2.63 MB/sec

----------

## dsd

can you please post output of "lspci" and "lspci -n"

----------

## IvanYosifov

localhost / # lspci

0000:00:00.0 Host bridge: Intel Corp. 82865G/PE/P DRAM Controller/Host-Hub Interface (rev 02)

0000:00:01.0 PCI bridge: Intel Corp. 82865G/PE/P PCI to AGP Controller (rev 02)

0000:00:1d.0 USB Controller: Intel Corp. 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #1 (rev 02)

0000:00:1d.1 USB Controller: Intel Corp. 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #2 (rev 02)

0000:00:1d.2 USB Controller: Intel Corp. 82801EB/ER (ICH5/ICH5R) USB UHCI #3 (rev 02)

0000:00:1d.3 USB Controller: Intel Corp. 82801EB/ER (ICH5/ICH5R) USB UHCI Controller #4 (rev 02)

0000:00:1d.7 USB Controller: Intel Corp. 82801EB/ER (ICH5/ICH5R) USB2 EHCI Controller (rev 02)

0000:00:1e.0 PCI bridge: Intel Corp. 82801 PCI Bridge (rev c2)

0000:00:1f.0 ISA bridge: Intel Corp. 82801EB/ER (ICH5/ICH5R) LPC Interface Bridge (rev 02)

0000:00:1f.2 IDE interface: Intel Corp. 82801EB (ICH5) SATA Controller (rev 02)

0000:00:1f.3 SMBus: Intel Corp. 82801EB/ER (ICH5/ICH5R) SMBus Controller (rev 02)

0000:00:1f.5 Multimedia audio controller: Intel Corp. 82801EB/ER (ICH5/ICH5R) AC'97 Audio Controller (rev 02)

0000:01:00.0 VGA compatible controller: nVidia Corporation NV18 [GeForce4 MX 440 AGP 8x] (rev c1)

0000:02:09.0 Ethernet controller: Marvell Technology Group Ltd. Yukon Gigabit Ethernet 10/100/1000Base-T Adapter (rev 13)

localhost / # lspci -n

0000:00:00.0 Class 0600: 8086:2570 (rev 02)

0000:00:01.0 Class 0604: 8086:2571 (rev 02)

0000:00:1d.0 Class 0c03: 8086:24d2 (rev 02)

0000:00:1d.1 Class 0c03: 8086:24d4 (rev 02)

0000:00:1d.2 Class 0c03: 8086:24d7 (rev 02)

0000:00:1d.3 Class 0c03: 8086:24de (rev 02)

0000:00:1d.7 Class 0c03: 8086:24dd (rev 02)

0000:00:1e.0 Class 0604: 8086:244e (rev c2)

0000:00:1f.0 Class 0601: 8086:24d0 (rev 02)

0000:00:1f.2 Class 0101: 8086:24d1 (rev 02)

0000:00:1f.3 Class 0c05: 8086:24d3 (rev 02)

0000:00:1f.5 Class 0401: 8086:24d5 (rev 02)

0000:01:00.0 Class 0300: 10de:0181 (rev c1)

0000:02:09.0 Class 0200: 11ab:4320 (rev 13)

----------

## dsd

is your cdrom connected through sata?

----------

## IvanYosifov

I dont know for sure. The SATA disk is /dev/sda and the cdrom is /dev/hdc (not sdX) , so I suppose it is connected NOT through SATA. How do I check this ?

----------

## Zyne

I was having the exact same problem a few weeks ago, but I managed to solve this somehow...

a few things that come to mind right now:

1. do you have hdparm set to start on boot? 

```

bash-2.05b# rc-update show |grep hdparm

              hdparm | boot       

```

2. have you edited /ect/conf.d/hdparm to set the right parameters?

here's what mine says:

```

all_args="-d1"

hda_args="-d1 -X69"

hdb_args="-d1 -X69"

sda_args="-d1 -X70"

```

that's about all I can think of right now...

----------

## IvanYosifov

I added hdparm to the boot runlevel. My conf is just: 

```
 all_args="-d1" 
```

I did a reboot and got "DIO_SET_DMA failed: Operation not permitted" during startup.

 *Quote:*   

> 
> 
> I was having the exact same problem a few weeks ago, but I managed to solve this somehow...
> 
> 

 

Did you touch the kernel or BIOS as part of the solution ?

I just found one more thing:

```

localhost / # hdparm -i /dev/sda

/dev/sda:

 HDIO_GET_IDENTITY failed: Operation not supported

```

Doesn't hdparm work on SATA drives ?

----------

## Zyne

 *IvanYosifov wrote:*   

> 
> 
> Did you touch the kernel or BIOS as part of the solution ?
> 
> I just found one more thing:
> ...

 

nope... I hardly ever touch the bios, since it's set at it's best values imho  :Smile: 

as for the kernel... I might have changed a few things, but I don't remember changing anything. I've compiled a few kernels to get vesafb going, but even that's running good now  :Smile: 

as for hdparm: I'm getting the exact same error now, but since the data transfer on the hd seems good enough to me, I'm not going to check up on that right now. I *think* hdparm used to work great with my old love-kernel, but in a stupid "update & clean up" situation, I got rid of all my old kernels (including the love one  :Sad: )

----------

## IvanYosifov

Zyne,

What hardware are you running ? 

Please send me your kernel config at ivan@yosifov.net .

Thanks.

----------

## Zyne

 *IvanYosifov wrote:*   

> Zyne,
> 
> What hardware are you running ? 
> 
> Please send me your kernel config at ivan@yosifov.net .
> ...

 

mobo: A7N8X-deluxe (SIL3112A chipset)

hardware: 1 SATA hd (Western Digital) 2 ATA100 hd's (IBM)

sending you the kernel config in a few seconds...  :Wink: 

----------

## IvanYosifov

Got your mail , thanks  :Smile:  Will test it later today. In the meantime - I have tested 2004.3 and 2004.2 LiveCDs - they dont work.

----------

## IvanYosifov

I have reconfigured my kernel. 

The config is at http://yosifov.net/ivan/config1.

It should be analougus to zyne's and obviosly correct(TM)  :Very Happy:  . DMA still failing. 

I may have found the problem. I have this in my dmesg :

```
ata_piix: combined mode detected
```

Some google-ing showed me that this combined

mode somehow messes up the piix driver. I am still not sure what this is and how to change it.

Any sugestions ?

----------

## Karsten1973

I have the same problem; PIII system on AOpen AX37 Plus Motherboard with a Samsung Spinpoint as hda. Not SATA, the old parallel system. Hard does allow this; DMA is possible under Win98.

I use a 2.6.9 kernel. Any other data that might help to solve the problem?

bash-2.05b# hdparm /dev/hda

/dev/hda:

 multcount    = 16 (on)

 IO_support   =  1 (32-bit)

 unmaskirq    =  0 (off)

 using_dma    =  0 (off)

 keepsettings =  0 (off)

 readonly     =  0 (off)

 readahead    = 256 (on)

 geometry     = 16383/255/63, sectors = 120060444672, start = 0

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

/dev/hda:

 Model=SAMSUNG SP1213N, FwRev=TL100-24, SerialNo=S00UJ10X602666

 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs }

 RawCHS=16383/16/63, TrkSize=34902, SectSize=554, ECCbytes=4

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

 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=234493056

 IORDY=on/off, tPIO={min:240,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: (null):

 * signifies the current active mode

----------

## IvanYosifov

Hello Guys   :Cool:   ,

I managed to solve this , at least for me. 

This was not a kernel problem after all , 

rather a BIOS one.

Here is some (I hope usefull) explanation.

I had in BIOS->IntegratedPeripherials

```
On-Chip SATA: Auto
```

When booting the BIOS displays a table of found disk drives. There it told me I had an IDE HD and an IDE CD.

When booting I had the dmesg:

```
ata_piix: combined mode detected
```

I still dont know what this means , but it appears that either the chip is not capable of DMA in this mode , or the linux drivers cant handle this mode properly. You will get:

```
localhost ~ # hdparm -d 1 /dev/hdc

/dev/hdc:

setting using_dma to 1 (on)

HDIO_SET_DMA failed: Operation not permitted

using_dma = 0 (off) 
```

I changed the BIOS to :

```
On-Chip SATA: Manual
```

In the previously non-writable next field i place:

```
SATA Port 0 configure as: SATA PORT 0
```

The autodetection had previously placed there IDE 1 , which (I think) means that the SATA HD will pretend to be IDE Master 1 (with the CD - Master 2).

In the next reboot I got TWO device tables. One of IDE devices , and only the CD is there , and an other one for SATA devices , and the SATA disk is there.

There combined-mode-message is no longer in dmesg , and: 

```
localhost / # hdparm -d1 /dev/hdc

/dev/hdc:

 setting using_dma to 1 (on)

 using_dma    =  1 (on)
```

The final kernel config is at http://www.yosifov.net/ivan/config_work .

A few words about it :

```
obelix@localhost ~ $ grep DMA config

CONFIG_GENERIC_ISA_DMA=y

CONFIG_BLK_DEV_IDEDMA_PCI=y

# CONFIG_BLK_DEV_IDEDMA_FORCED is not set

CONFIG_IDEDMA_PCI_AUTO=y

# CONFIG_IDEDMA_ONLYDISK is not set

CONFIG_BLK_DEV_IDEDMA=y

CONFIG_IDEDMA_IVB=y

CONFIG_IDEDMA_AUTO=y
```

The generic* options under ATA/ATAPI/MFM/RLL **ARE** enabled. The piix (the controler) modules are also built-in.

I am still not sure what causes the "HDIO_SET_DMA failed" in general , but at least for ICH5 chips - it is the combined mode.

In general - build the controler modules in the kernel ( the generic options dont hurt) and check the BIOS. Look for my-chip-generated-messages in the dmesg.

Thanks everyone for the help ,

Ivan Yosifov.

P.S. Belive it or not , the BIOS-tweak also fixes https://bugs.gentoo.org/show_bug.cgi?id=73876

----------

## dsd

the explanation is:

the IDE piix driver refuses to claim any devices if you are using the libata ich SATA

the libata ich SATA claimed your hard disk, but the bios told the system that the cdrom drive was connected through IDE

the *generic* IDE driver (which doesnt support DMA on many chipsets) was claiming the cdrom

----------

## Karsten1973

But then why do I have that problem? I don't have SATA drives at all!

----------

## Karsten1973

Anyway, I did the same with my PATA HD. And - it worked. Seems to be a problem of the BIOS.

Yet, Firebird takes still longer to load on gentoo then on Win98....

----------

## Karsten1973

I am not sure if there is a connection, but my Win98 SE died after changing the bios. Trying to copy my data from the vfat partion on my reiserfs linux partion led to many errors. So be carefull !

----------

## IvanYosifov

For the load time - check out http://www.gentoo.org/doc/en/prelink-howto.xml

And what are these errors you mention ? I have copied my (ex)fat partitions on reiser too , and it was a breeze.

----------

## Karsten1973

The file system was totally messed. Windows would not boot anymore (it showed the desktop background, but nothing else. Even booting in secure mode would not help. I plugged the disk in another computer and had a win xp scandisk run over it. Now a lot of filenames are crooked, but at least I can read stuff again, right now i copy everything on my reiser partition.

An open question to the developers:

Why does dma work with bios detected drive and liveCD kernel but not with a regular 2.6.9 gentoo-dev kernel?

----------

## IvanYosifov

Dumb WindoZe   :Twisted Evil:   . Probably the fs was all right and when win booted - win killed it. You should have booted in directly into gentoo.

I didn't have DMA even with the LiveCD. 

Have you configured your kernel yourself ? 

If this is the case , it should be very different from the LiveCD anyway. 

AFAIK you can use sys-kernel/genkernel to generate a LiveCD-like kernel for the system.

 You might want to try this , consult the install handbook on how to use genkernel.

Ivan Yosifov.

----------

## Karsten1973

It seems I have to! I can't even format the disk under windows, I just tried. Damn. 

Anyway, the kernel on the LiveCD allows to mount windows shares, something my selfbaked kernel does not do...

Can I modify the genkernel for my needs? IE the right networking card, USB...

----------

## IvanYosifov

Well , like most of gentoo genkernel is opensource - you shure can modify it   :Cool:   .

AFAIK when you use genkernel you will run the same hw autodetection sequence as the cd - the right modules are supposed to be loaded automatically. However I sugest that you first find out what is in the box , then which modules are responsible ( a simple grep in /usr/src/linux/Documentation can do ) and build those in the your self-made-kernel. 

About the win shares - what shares ? smb shares or fat partions ? In either case you must have the fat or smb modules in the kernel (loaded or built in). Check the kernel config under File Systems.

----------

## Kgjersda

Hello  :Smile: 

I have the same problem with my machine.

I'm using a Western Digital (200g,7200rpm,8mb Cache) and an Abit KD7-RAID motherboard.

I do not use the RAID on the motherboard as I have no use for RAID.

```
bash-2.05b# hdparm -tT /dev/hda
```

Gives me a terrible low result

```
/dev/hda:

 Timing cached reads:   672 MB in  2.26 seconds = 297.65 MB/sec

 Timing buffered disk reads:   12 MB in  4.07 seconds =   2.95 MB/sec

```

My brother is astonished over this headcracking low result.

I have enabled DMA-support on all levels in my BIOS, but still, when I try

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

The output is the same error

```
/dev/hda:

 setting using_dma to 1 (on)

 HDIO_SET_DMA failed: Operation not permitted

 using_dma    =  0 (off)
```

I cannot see anything wrong in my BIOS config, and DMA is enabled in my kernel (which by the way is 2.6.11).

What is/could be wrong?

Thanks  :Smile: 

----------

