# No DMA alim15x3.c driver - Kernel: 2.6.11-gentoo-r5

## b0nzo

I'm running an ASUS A7A266 motherboard with an Athlon XP1700+ CPU and the linux-2.6.11-gentoo-r5 kernel though I have had the same problem with linux-2.6.10-gentoo-r6  linux-2.6.11-gentoo-r4 kernels.  hda: Maxtor 6B200P0, ATA DISK drive 200 gb.

The problem is that I cannot get DMA to work either during boot or after using hdparm.  I'll place my dmesg and relevant .config lines in a moment.  You will see that I do have the correct chipset selected and that it is built in, not a module.  When I try hdparm it says that it has turned on dma however hdparm -t /dev/hda gives me results that are anywhere between 1/10 and 1/20 of the speed that I can attain with dma on this disk.  If I run hdparm /dev/hda after running hdparm -t /dev/hda it tells me that DMA is no longer turned on.

I tried to boot Knoppix (v3.7) from the CD, it booted into the 2.4 kernel and ran DMA without a problem, however when I tried to boot into 2.6 it just hung.  I could see the hard drive L.E.D.S lit up but it would not boot 2.6

I have googled this problem to death and found alot of people having this same problem on various kernels going back to 1999 but not one solution.

In searching through these forums I thought I had found the solution here : 

https://forums.gentoo.org/viewtopic-t-301098-highlight-m5229+dma.html

"...hack drivers/ide/pci/alim15x3.c in order to bypass the checks for buggy revisions" despite the warnings about the possibility of losing my data I plowed ahead with the suggested hack.  It didn't work, so I commented out the entire section, still no luck.

Here's the relevant line from lspci

```
Relevant line from lspci:

0000:00:04.0 IDE interface: ALi Corporation M5229 IDE (rev c4)

```

The output of hdparm -I /dev/hda

```
  hdparm -I /dev/hda

/dev/hda:

ATA device, with non-removable media

        Model Number:       Maxtor 6B200P0

        Serial Number:      B40WJMYH

        Firmware Revision:  BAH41B70

Standards:

        Supported: 7 6 5 4

        Likely used: 7

Configuration:

        Logical         max     current

        cylinders       16383   65535

        heads           16      1

        sectors/track   63      63

        --

        CHS current addressable sectors:    4128705

        LBA    user addressable sectors:  268435455

        LBA48  user addressable sectors:  398297088

        device size with M = 1024*1024:      194481 MBytes

        device size with M = 1000*1000:      203928 MBytes (203 GB)

Capabilities:

        LBA, IORDY(can be disabled)

        Queue depth: 32

        Standby timer values: spec'd by Standard, no device specific minimum

        R/W multiple sector transfer: Max = 16  Current = 16

        Advanced power management level: unknown setting (0x0000)

        Recommended acoustic management value: 192, current value: 254

        DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 *udma5 udma6

             Cycle time: min=120ns recommended=120ns

        PIO: pio0 pio1 pio2 pio3 pio4

             Cycle time: no flow control=120ns  IORDY flow control=120ns

Commands/features:

        Enabled Supported:

           *    NOP cmd

           *    READ BUFFER cmd

           *    WRITE BUFFER cmd

           *    Host Protected Area feature set

           *    Look-ahead

           *    Write cache

           *    Power Management feature set

                Security Mode feature set

           *    SMART feature set

           *    FLUSH CACHE EXT command

           *    Mandatory FLUSH CACHE command

           *    Device Configuration Overlay feature set

           *    48-bit Address feature set

           *    Automatic Acoustic Management feature set

                SET MAX security extension

                Advanced Power Management feature set

           *    DOWNLOAD MICROCODE cmd

           *    SMART self-test

           *    SMART error logging

Security:

        Master password revision code = 65534

                supported

        not     enabled

        not     locked

        not     frozen

        not     expired: security count

        not     supported: enhanced erase

HW reset results:

        CBLID- above Vih

        Device num = 0 determined by the jumper

Checksum: correct

```

The relevant lines form my .config file:

```
CONFIG_GENERIC_ISA_DMA=y

# IDE chipset support/bugfixes

#

CONFIG_BLK_DEV_IDEPCI=y

CONFIG_IDEPCI_SHARE_IRQ=y

CONFIG_BLK_DEV_IDEDMA_PCI=y

CONFIG_IDEDMA_PCI_AUTO=y

CONFIG_BLK_DEV_ALI15X3=y

CONFIG_BLK_DEV_IDEDMA=y

CONFIG_IDEDMA_AUTO=y

```

Probably more of my dmesg than you need:

(Better Safe Than Sorry)

```

PCI: Probing PCI hardware

PCI: Probing PCI hardware (bus 00)

PCI: Using ALI IRQ Router

PCI: Using IRQ router ALI [10b9/1533] at 0000:00:07.0

Machine check exception polling timer started.

highmem bounce pool size: 64 pages

inotify device minor=63

devfs: 2004-01-31 Richard Gooch (rgooch@atnf.csiro.au)

devfs: boot_options: 0x1

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

Initializing Cryptographic API

Limiting direct PCI/PCI transfers.

Activating ISA DMA hang workarounds.

lp: driver loaded but no devices found

Linux agpgart interface v0.100 (c) Dave Jones

[drm] Initialized drm 1.0.0 20040925

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

mice: PS/2 mouse device common for all mice

input: AT Translated Set 2 keyboard on isa0060/serio0

input: ImPS/2 Generic Wheel Mouse on isa0060/serio1

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

parport0: irq 7 detected

lp0: using parport0 (polling).

io scheduler noop registered

Floppy drive(s): fd0 is 1.44M

FDC 0 is a post-1991 82077

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

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

ALI15X3: IDE controller at PCI slot 0000:00:04.0

ALI15X3: chipset revision 196

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

    ide0: BM-DMA at 0xd400-0xd407, BIOS settings: hda:DMA, hdb:DMA

    ide1: BM-DMA at 0xd408-0xd40f, BIOS settings: hdc:DMA, hdd:DMA

Probing IDE interface ide0...

hda: Maxtor 6B200P0, ATA DISK drive

hdb: WDC WD1000BB-32CCB0, ATA DISK drive

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

Probing IDE interface ide1...

hdc: DVD-ROM DDU1621, ATAPI CD/DVD-ROM drive

hdd: SONY CD-RW CRX175A1, ATAPI CD/DVD-ROM drive

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

hda: max request size: 128KiB

hda: cannot use LBA48 DMA - PIO mode will be used for accessing sectors > 268435456

hda: 398297088 sectors (203928 MB) w/8192KiB Cache, CHS=24792/255/63, UDMA(100)

hda: cache flushes supported

 /dev/ide/host0/bus0/target0/lun0:<4>hda: dma_timer_expiry: dma status == 0x61

hda: DMA timeout error

hda: dma timeout error: status=0x58 { DriveReady SeekComplete DataRequest }

ide: failed opcode was: unknown

 p1 p2 p3

hdb: max request size: 128KiB

hdb: 195371568 sectors (100030 MB) w/2048KiB Cache, CHS=65535/16/63, UDMA(100)

hdb: cache flushes not supported

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

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

Uniform CD-ROM driver Revision: 3.20

hdd: ATAPI 40X CD-ROM CD-R/RW drive, 2048kB Cache, UDMA(33)

ide-floppy driver 0.99.newide

libata version 1.10 loaded.

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

Advanced Linux Sound Architecture Driver Version 1.0.8 (Thu Jan 13 09:39:32 2005 UTC).

ALSA device list:

  No soundcards found.

NET: Registered protocol family 2

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

TCP established hash table entries: 262144 (order: 9, 2097152 bytes)

TCP bind hash table entries: 65536 (order: 6, 262144 bytes)

TCP: Hash tables configured (established 262144 bind 65536)

ip_conntrack version 2.1 (8191 buckets, 65528 max) - 212 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

hda: dma_timer_expiry: dma status == 0x61

hda: DMA timeout error

hda: dma timeout error: status=0x58 { DriveReady SeekComplete DataRequest }

ide: failed opcode was: unknown

hda: dma_timer_expiry: dma status == 0x61

hda: DMA timeout error

hda: dma timeout error: status=0x58 { DriveReady SeekComplete DataRequest }

ide: failed opcode was: unknown

hda: dma_timer_expiry: dma status == 0x61

hda: DMA timeout error

hda: dma timeout error: status=0x58 { DriveReady SeekComplete DataRequest }

ide: failed opcode was: unknown

ReiserFS: hda3: found reiserfs format "3.6" with standard journal

ReiserFS: hda3: using ordered data mode

ReiserFS: hda3: journal params: device hda3, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30

ReiserFS: hda3: checking transaction log (hda3)

ReiserFS: hda3: Using r5 hash to sort names

VFS: Mounted root (reiserfs filesystem) readonly.

Mounted devfs on /dev

Freeing unused kernel memory: 160k freed

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

ReiserFS: hda1: found reiserfs format "3.6" with standard journal

ReiserFS: hda1: using ordered data mode

ReiserFS: hda1: journal params: device hda1, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30

ReiserFS: hda1: checking transaction log (hda1)

ReiserFS: hda1: Using r5 hash to sort names

agpgart: Detected ALi M1647 chipset

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

agpgart: AGP aperture is 128M @ 0xf0000000

PCI: Found IRQ 10 for device 0000:00:0a.0

ohci1394: $Rev: 1223 $ Ben Collins <bcollins@debian.org>

PCI: Found IRQ 5 for device 0000:00:0a.2

ohci1394: fw-host0: OHCI-1394 1.1 (PCI): IRQ=[5]  MMIO=[e3800000-e38007ff]  Max Packet=[2048]

PCI: Found IRQ 9 for device 0000:00:0d.0

PCI: Sharing IRQ 9 with 0000:00:05.0

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

0000:00:0d.0: 3Com PCI 3c905C Tornado at 0xa800. Vers LK1.1.19

PCI: Found IRQ 9 for device 0000:00:0d.0

PCI: Sharing IRQ 9 with 0000:00:05.0

nvidia: module license 'NVIDIA' taints kernel.

PCI: Found IRQ 11 for device 0000:01:00.0

NVRM: loading NVIDIA Linux x86 NVIDIA Kernel Module  1.0-7174  Tue Mar 22 06:44:39 PST 2005

ieee1394: Host added: ID:BUS[0-00:1023]  GUID[00023c0020003e34]

spurious 8259A interrupt: IRQ7.

agpgart: Found an AGP 2.0 compliant device at 0000:00:00.0.

agpgart: Putting AGP V2 device at 0000:00:00.0 into 4x mode

agpgart: Putting AGP V2 device at 0000:01:00.0 into 4x mode

agpgart: Found an AGP 2.0 compliant device at 0000:00:00.0.

agpgart: Putting AGP V2 device at 0000:00:00.0 into 4x mode

agpgart: Putting AGP V2 device at 0000:01:00.0 into 4x mode

Losing too many ticks!

TSC cannot be used as a timesource.  

Possible reasons for this are:

  You're running with Speedstep,

  You don't have DMA enabled for your hard disk (see hdparm),

  Incorrect TSC synchronization on an SMP system (see dmesg).

Falling back to a sane timesource now.
```

I think that I have been pretty thorough and tried everything but have not had any success.  Any help would be greatly appreciated.

B0nzo

----------

## Master Shake

Did you compile dma into your kernel?

----------

## b0nzo

Master Snake,

I did indeed:

```
PCI IDE chipset support (BLK_DEV_IDEPCI)

Generic PCI bus-master DMA support (BLK_DEV_IDEDMA_PCI)

Use PCI DMA by default when available (IDEDMA_PCI_AUTO)

ALI M15x3 chipset support (BLK_DEV_ALI15X3)

```

B0nzo

----------

## Master Shake

 *b0nzo wrote:*   

> Master Snake,

 

It's Master Shake like in AquaTeen Hungar Force the cartoon  :Very Happy: 

Does your dma work for your cdrom drive or drives?  If it does then I'm completely perplexed.  BTW 2.6 kernel in knoppix crashes on my computer too...maybe a bug?  Wait, you said it works with the 2.4 kernel right?  can you take the conf file from that and use it on the 2.6 kernel?  I'm positive this is a kernel bus/issue, because as far as I know only the kernel deals with dma.  Maybe for your system you need some really obscure option checked, i.e. scsi-emulation support, or support for large disc.  Try messing with the kernel, or find a stock kernel that supports your dma and use it.  Sorry I can't be of any more assistance.

----------

## b0nzo

Master Shake,

First and foremost please accept my apologies for getting your name wrong.  I appreciate your help and that was thoughtless of me.

I just checked and my CD-ROM is running with DMA on, I didn't check them both, but I think it is a safe bet that they both have DMA working.  The CD-Roms are both on a separate cable from the hard drives.

I have two hard drives they are on their own cable also.  I tried removing the second drive and changed the jumper on the one drive left to see if that made a difference but it didn't.  I'm pretty sure that this is an issue with the alim15x3.c driver and the kernel.  Like I said DMA works fine on both drives with the 2.4 kernel.

There have been patches written for earlier kernels, but they are kernel specific and wouldn't work with any of the 2.6 kernels that I have.  Also I'd rather go back to the 2.4 kernel than go as far back as the patches would have me go.

I may have to file a kernel bug report.

B0nzo

----------

## Hunter555

I have the exact same problem on my box.

However... I have found that the DMA works on the kernel 2.6.8-gentoo-r10.

If you can get your hands on that version then I bet your DMA will work. Any kernel later than that and the DMA doesn't work properly. I'm thinking of pulling the source files through from the 2.6.8 version to see what happens. I don't think it is my config as I'm copying the same config file from my (DMA Working) 2.6.8 kernel.

I think a kernel bug report should be filed. 

Let me know if you figure anything out.

----------

## nukem996

Hunter555

This is b0nzo on my son's laptop (too lazy to log out and log in as me)  Your idea of pulling source from 2.6.8-r10 to get dma working makes a lot of sense to me.  At the moment I am re-installing X on the machine that has the borked dma, I think that I broke X trying all sorts of different patches and kernel sources to fix my dma problem.  At least I hope that is what is broken.  I may not have time to test your theory about the 2.6.8 source till Sunday or Monday but absent another solution I will try it.  I have reported a bug to the gentoo kernel team and to the kernel team.  To be fair I don't think this is a Gentoo problem.

I am really determined to find a solution to this problem cause running at between 1/10 and 1/20 the speed I should have sucks.

When I find the solution I will post it here.

----------

## Hunter555

I just found a solution!

Even though my drive is less than 200Gb, this patch fixed my problem. I hope it ends up in the official kernel.

http://www.mail-archive.com/linux-ide@vger.kernel.org/msg00704.html

----------

## b0nzo

Hunter555,

I had tried the patch posted at " http://www.mail-archive.com/linux-ide@vger.kernel.org/msg00744.html " which claims to be a slightly modified version of the patch that you succesfully used.  Until I read your post I hadn't thought to try the earlier patch.  Today after having rebuilt my machine and installed almost everything that was there before I decided to try the version of the patch that worked for you ( http://www.mail-archive.com/linux-ide@vger.kernel.org/msg00704.html ) and it worked for me too.  YEAH!!!

Thanks for the push.  I will now go back and revise both bug reports that I filed to include this solution.

----------

## amand

I've got the same problem...

And applying this patch seems to work. But I fear some corruption with my data...

Do you have this kind of problem now that you use this patch too ?

----------

## b0nzo

 *amand wrote:*   

> I've got the same problem...
> 
> And applying this patch seems to work. But I fear some corruption with my data...
> 
> Do you have this kind of problem now that you use this patch too ?

 amand,

So far all is well, no corruption or any other problems related to the dma patch.  Everything seems to be rock solid.

----------

## amand

Ok... It seems to work fine !

I have done some big data movement, and there is no corruption so far !

Thanx a lot !

----------

