# VIA82cXXX: HDIO_SET_DMA failed: Operation not permitted

## nuclearsandbox

To start off I have an Epox MVP3-G2 with and AMD K6-2 500. 

The Hard Drive is a Western Digital 40 GB 5400. 

I am using kernel linux-2.4.26-gentoo-r13 with Grub as the boot loader. 

Everything was compiled from stage 1. 

The problem I am experiencing is that DMA will not enable under the current configuration:

-------------------------------------------------------------------------------

sg5 root # hdparm -d1 /dev/hda

/dev/hda:

 setting using_dma to 1 (on)

 HDIO_SET_DMA failed: Operation not permitted

 using_dma    =  0 (off)

-------------------------------------------------------------------------------

sg5 root # /etc/init.d/hdparm start

 * Starting hdparm...                                                     [ ok ]

 * Running hdparm on /dev/discs/disc0/disc...

 HDIO_SET_DMA failed: Operation not permitted

 * Running hdparm on /dev/discs/disc1/disc...

 HDIO_SET_DMA failed: Operation not permitted

 * Running hdparm on /dev/discs/disc2/disc...

 HDIO_SET_DMA failed: Operation not permitted

 * Running hdparm on /dev/cdroms/cdrom0...

 HDIO_SET_DMA failed: Operation not permitted

---------------------------------------------------------------------------------

sg5 root # hdparm /dev/hda

/dev/hda:

 multcount    = 16 (on)

 IO_support   =  0 (default 16-bit)

 unmaskirq    =  0 (off)

 using_dma    =  0 (off)

 keepsettings =  0 (off)

 readonly     =  0 (off)

 readahead    =  8 (on)

 geometry     = 4865/255/63, sectors = 40020664320, start = 0

---------------------------------------------------------------------------------

This causes a decrease in speed and performance:

*Performance of hda booting from the compiled kernel (DMA Disabled):

sg5 root # hdparm -tT /dev/hda

/dev/hda:

 Timing cached reads:   184 MB in  2.00 seconds =  92.00 MB/sec

 Timing buffered disk reads:   16 MB in  3.18 seconds =   5.03 MB/sec

     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

*Performance of hda booting from the Gentoo Live CD (after mounting hda's partitions):

(DMA Enabled)

root # hdparm -tT /dev/hda

/dev/hda:

 Timing cached reads:   236 MB in  2.01 seconds =  117.31 MB/sec

 Timing buffered disk reads:   72 MB in  3.04 seconds =   23.68 MB/sec

---------------------------------------------------------------------------------

Before rechecking the kernel I decided to make sure I had the correct chipsets:

sg5 root # lspci | grep -i via

0000:00:00.0 Host bridge: VIA Technologies, Inc. VT82C598 [Apollo MVP3] (rev 04

0000:00:01.0 PCI bridge: VIA Technologies, Inc. VT82C598/694x [Apollo MVP3/Pro13x AGP]

0000:00:07.0 ISA bridge: VIA Technologies, Inc. VT82C596 ISA [Mobile South] (re 21)

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

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

0000:00:07.3 Host bridge: VIA Technologies, Inc. VT82C596 Power Management (rev30)

---------------------------------------------------------------------------------

I then recompiled the kernel a couple times using different options each time but no dice! My current kernel configuration for this box is:

ATA/IDE/MFM/RLL support --->

<*> ATA/IDE/MFM/RLL support

IDE,ATA and ATAPI Block devices --->

<*> Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support

<*> Include IDE/ATA-2 DISK support

<*> Include IDE/ATAPI CDROM support

<*> SCSI emulation support

[*] PCI IDE Chipset Support

[*] Generic PCI IDE Chipset Support

[*] Sharing PCI IDE interrupts support

[*] Generic PCI bus-master DMA support

[*] Use PCI DMA by default when available

[ ] Enable DMA only for disks (This is currently off but I have tried it on as well)

< > HPT36X/37X chipset support (This is currently off but I have tried it on as well)

<*> VIA82CXXX chipset support

---------------------------------------------------------------------------------

I know that this is most likely a n00b mistake in my kernel since I didn't have this problem with W2k, SuSE, Redhat, or Mandrake on this same box, and since I don't have this problem when I boot from a Gentoo Live CD, but I haven't been able to figure out what my mistake is. 

I want to stay with the 2.4 kernel since it is the kernel recommended for several software programs that I plan to use. I also want to stick with Gentoo since Gentoo seems much more responsive than other Linux's, even with the DMA turned off, not to mention I have hardware that now works perfectly in Gentoo which is flaky in other OS's.

If anyone knows what I have incorrectly configured it would be greatly appreciated.

----------

## cygnae

I have exact the same problem, no success yet. I tried to load VIA82XX stuff to kernel, rebooted, but cannot enable DMA. It worked when I 1st time installed Gentoo. Then I noticed this system is _laggy_ and just looked to hdparm... 

Starnge thing is, I know dma CAN be enabled, but it doesnt let me =/    Any help appreciated !!

----------

## zinion

I had the same problem and I solved it yesterday!

You have to compile Chipset support for via82cxxx IN your Kernel NOT AS MODULE. And then - it worked automagically for me.

Since I use genkernel, I used

```
genkernel --menuconfig --bootsplash all
```

selected via82cxxx to be compiled into the kernel, rebooted and finally it was working after days.

```

thomas-km61 root # hdparm -Tt /dev/hda

/dev/hda:

 Timing cached reads:   2736 MB in  2.00 seconds = 1368.21 MB/sec

 Timing buffered disk reads:  170 MB in  3.00 seconds =  56.62 MB/sec

thomas-km61 root # hdparm -d /dev/hda

/dev/hda:

 using_dma    =  1 (on)

```

- Before buffered readings were ~6MB...

Additionally try to set UDMAx in BIOS, thats what I did furthermore.. Maybe he does not like "Auto", find this in another Thread when searching...

----------

## cygnae

Hi, actually I solved this already.

I didnt remember to boot with my new kernel bzImage  :Embarassed: 

So everything is now good, and test ( -Tt ) (Buffered reads) shows up around ~30MB-40MB/Sec.

----------

## zinion

Yeah so the solution is, that the driver has to be compiled INTO the Kernel.

Finally here is a thread with the clear solution  :Smile: 

Because when I searched the forum before I found th error but not the solution  :Very Happy: 

----------

## nuclearsandbox

Here is some further info: I am not using the genkernel. The via82cxxx has never been installed / compiled as a module but only as part of the kernel. I do not have this problem when using the genkernel: I do not want to use genkernel.

----------

## zinion

When you did NOT use the genkernel, did you remember to copy the Image after compiling the driver into the Kernel?

----------

## allydm

What menu is this under on genkernel? Forgive my ignorence but i can't seem to find anything with via in it   :Confused: 

----------

## nekromancer

Hi I use the VIA82Cxxx chipset too. I also found out that you get better performance by not using the Generic PCI IDE Chipset Support  and the Generic PCI chipset support. I just use the generic pci busmaster support + the via82cxxx chipset support.. dma and udma still works good or even better as I saw while burning dvds.

----------

## zinion

 *allydm wrote:*   

> What menu is this under on genkernel? Forgive my ignorence but i can't seem to find anything with via in it  

 

device driver -> ata/atapi...

----------

## nuclearsandbox

To answer the first question:

The bzImage was copied to /boot: #cp arch/i386/boot/bzImage /boot

To answer the second question:

With genkernel, I just leave the kernel alone and everything automatically boots and most things work, including DMA (This means however, that the automatic detection phase during boot takes longer and looks like the Gentoo Live CD's boot process). 

This was the reason I didn't want to use genkernel ... longer boot and less control over what goes on during boot (and my DLink R100 doesn't work under genkernel but does under gentoo-sources).

I wouldn't know if the genkernel can be cutomized / optimized / specialized as neatly as the gentoo-sources kernel, because I have never tried... genkernel just works with DMA enabled.

In other words, (after my long-winded response) I don't know where a person would configure via82cxxx in genkernel. I have never had to configure that kernel for the via82cxxx chipset because of the automatic detection process.

----------

## Phonics3k

 *Quote:*   

> 
> 
> To answer the first question:
> 
> The bzImage was copied to /boot: #cp arch/i386/boot/bzImage /boot 
> ...

 

try this instead

```

# cp arch/i386/bzImage /boot/vmlinuz

```

I think you might find that genkernel calls the kernel that or atleast your bootloader does.

Secondly do you copy System.map?

```
# cp System.map /boot/System.map
```

PS. do these commands from /usr/src/linux

I dont use genkernel myself so I am just assuming this is correct..

hope this helps   :Smile: 

----------

## zinion

 *nuclearsandbox wrote:*   

> 
> 
> In other words, (after my long-winded response) I don't know where a person would configure via82cxxx in genkernel. I have never had to configure that kernel for the via82cxxx chipset because of the automatic detection process.

 

If you start genkernel with --menuconfig, you get the menu to configure your kernel. I disabled everything I don't need and selected via82cxxx to be compiled into the kernel, because genkernel only did it as a module by default. And then - DMA won't work  :Wink: 

----------

## nuclearsandbox

I guess at this point, I could print out both the gentoo-sources kernel and the genkernel and find out where the differences are. That would at least let me know what items I could try to remove, one-by-one, until I found out why genkernel works with DMA and the gentoo sources doesn't.  Unfortunately, I don't have that kind of time at the moment, so I have decided to use the next best thing:

#emerge genkernel

#genkernel --menuconfig all

[removed the stuff that I know I don't have... and added what I need. Extensive kernel editing... mostly a lot of removal of stuff my box doesn't need. The only modules created are Sound/Creative SBLive! Emu10k1 and Sound/Creative SBLive! Midi. Everything else is built-in the kernel.]

[genkernel does the" make dep && make bzImage modules modules_install" for you]

#reboot

DMA works... everything else works as well including my D-Link R-100 USB radio... closest solution to using the gentoo-sources kernel. I didn't emerge coldplug this time... keeps the bootup as fast as the gentoo sources, and as mentioned everything still works.

Anyway, it looks like for the moment genkernel has to be the fix. Since it can be customized like the gentoo-sources kernel, I guess it will do.

Vielen Dank Zinion ... Thanks everybody!

----------

## bet1m

try to enable:

```

 Character devices  --->

  <*>   VIA chipset support                                            

```

 :Wink: 

----------

## vanquish

I had the same problem, this fixed it up good  :Very Happy:   :Very Happy:   :Very Happy: 

I ended up putting both via82cxxx and "other ide drivers" in the kernel. I don't think i really needed the via chipset drivers, my motherboard is a gigabyte 875p, and to the best of my knowledge, it is mostly intel chipsets. but i did it anyway cuz i really wanted dma to work. loaded up new kernel and pow! everything worked like awesomeness. Thanks a bunch guys!

----------

## YeahSure

Remember to enable the VIA IDE chipset support in the kernel and not a module and disable "Generic PCI IDE Chipset Support ".  If you don't disable it, you're gonna get shit for DMA (as in none).

Take out the generic and put in the VIA.  They don't work together at all.  They're not friends.  So, yes, the proper solution is many posts before this one.

----------

## YeahSure

 *vanquish wrote:*   

> I had the same problem, this fixed it up good   
> 
> I ended up putting both via82cxxx and "other ide drivers" in the kernel. I don't think i really needed the via chipset drivers, my motherboard is a gigabyte 875p, and to the best of my knowledge, it is mostly intel chipsets. but i did it anyway cuz i really wanted dma to work. loaded up new kernel and pow! everything worked like awesomeness. Thanks a bunch guys!

 If you pry your case open, the northbridge should have the brand name on it.  Southbridge often has a heatsink on it, though.  

```
lspci
```

should tell you what you really have, though.

----------

