# IDE DMA support in the new 2.6.19 kernel

## apberzerk

Ok, I just upgraded to the 2.6.19-gentoo-r5 kernel, and I am confused about the way SATA/PATA support appears in the kernel.

After reading some posts, I decided that I should disable ATA/ATAPI and only use "Serial ATA and Parallel ATA drivers".  However, there is no option to enable DMA support anywhere (not under ATA/ATAPI, and not under Serial ATA")!  My cdrom is working, but I cannot turn DMA on using hdparm....

- Phil

----------

## apberzerk

Let's pretend I never made that post, and that it didn't take me over an hour of browsing the kernel menu to find the option  :Smile: 

----------

## Cyker

How's it running for you?

I'm using libata for my SATA drives, but I've stuck with the old IDE driver for my ATA drives until I'm sure it's stable.

The fact that almost everything for PATA in libata is marked Experimental kinda puts me off  :Wink: 

Plus I'm a big fan of the "Not broke, Don't fix" line of thought  :Wink: 

But where is the DMA support option for libata? I can't see one either... (Although I have a vague recollection of reading that you can't turn it on/off - It always runs with it on?)

Does hdparm even work with libata? I know it doesn't (mostly) for SATA stuff on libata...

----------

## apberzerk

 *Cyker wrote:*   

> I'm using libata for my SATA drives, but I've stuck with the old IDE driver for my ATA drives until I'm sure it's stable.

 

Same here.  I could not get the experimental PATA drivers in libata to work.  I have an nvidia nforce2 chipset with AMD processor, so I use BLK_DEV_AMD74xx (the old module) or PATA_AMD (the new module).  The PATA_AMD module loads, but the drive does not show up in /dev.  It used to be /dev/hdx, would it now be /dev/sdx?

 *Cyker wrote:*   

> But where is the DMA support option for libata? I can't see one either...

 

I swear it wasn't there when I first compiled my 2.6.19 kernel, but now it is.  Maybe because I copied my .config from 2.6.18.  Anyway, here's where it is:  Device Drivers -> ATA/ATAPI/MFM/RLL Support -> PCI IDE Chipset Support -> Generic PCI bus-master DMA support.

 *Cyker wrote:*   

> Does hdparm even work with libata? I know it doesn't (mostly) for SATA stuff on libata...

 

DMA does not apply to SATA drives.  However, we still need it for the PATA drives, but there does not seem to be any way to enable it in libata for PATA drives!

 *Cyker wrote:*   

> How's it running for you?

 

Even though I found DMA support and enabled it, it is still turned off for my cdrom and hdparm cannot turn it back on.  :*(

----------

## apberzerk

All right, I decided to boot into Knoppix 5.1.1 to see how it handles my cdrom in the 2.6.19 kernel.

First of all, I do indeed have dma support:

```
knoppix@Knoppix:~$ hdparm /dev/hda

/dev/hda:

 IO_support   =  1 (32-bit)

 unmaskirq    =  1 (on)

 using_dma    =  1 (on)

 keepsettings =  0 (off)

 readonly     =  0 (off)

 readahead    = 256 (on)

 HDIO_GETGEO failed: Inappropriate ioctl for device
```

And now, to see which module (libata or old) knoppix is using, I ran lsmod.  However, it doesn't look like it's compiled as a module:

```
Module                  Size  Used by

via                    46976  0

drm                    78612  1 via

sworks_agp             13472  0

intel_agp              27420  0

ati_agp                13068  0

amd_k7_agp             12812  0

ali_agp                11136  0

ipv6                  279616  10

dm_mod                 60440  0

af_packet              29960  0

8250_pnp               13440  0

8250                   28164  1 8250_pnp

serial_core            25216  1 8250

parport_pc             43492  0

parport                40008  1 parport_pc

snd_intel8x0           37020  1

snd_ac97_codec         97188  1 snd_intel8x0

snd_ac97_bus            6528  1 snd_ac97_codec

snd_pcm_oss            45728  0

snd_mixer_oss          20224  1 snd_pcm_oss

snd_pcm                80004  3 snd_intel8x0,snd_ac97_codec,snd_pcm_oss

shpchp                 41380  0

pci_hotplug            36424  1 shpchp

snd_timer              26500  1 snd_pcm

snd                    55396  8 snd_intel8x0,snd_ac97_codec,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer

soundcore              12512  1 snd

snd_page_alloc         13960  2 snd_intel8x0,snd_pcm

forcedeth              45188  0

i2c_nforce2            11520  0

nvidia_agp             12316  1

agpgart                36044  7 drm,sworks_agp,intel_agp,ati_agp,amd_k7_agp,ali_agp,nvidia_agp

tsdev                  11840  0

eth1394                23556  0

evdev                  14208  1

pcmcia                 41132  0

firmware_class         14208  1 pcmcia

yenta_socket           30220  0

rsrc_nonstatic         17408  1 yenta_socket

pcmcia_core            43800  3 pcmcia,yenta_socket,rsrc_nonstatic

cpufreq_ondemand       12300  0

speedstep_lib           8836  0

cpufreq_nforce2         9488  0

freq_table              9088  1 cpufreq_ondemand

video                  19460  0

thermal                17928  0

sbs                    18856  0

processor              36200  1 thermal

i2c_ec                  9216  1 sbs

i2c_core               25984  2 i2c_nforce2,i2c_ec

fan                     8836  0

container               8576  0

button                 10768  0  

battery                14084  0

ac                      9348  0

aufs                   88244  1

cloop                  18208  1

sbp2                   28292  0

ohci1394               38960  0

ieee1394              300760  3 eth1394,sbp2,ohci1394

usb_storage            73408  0

usbhid                 56928  0

ff_memless              9992  1 usbhid

libusual               20624  1 usb_storage

ohci_hcd               24580  0

uhci_hcd               27788  0

ehci_hcd               35848  0

usbcore               135812  7 usb_storage,usbhid,libusual,ohci_hcd,uhci_hcd,ehci_hcd
```

By the way, here's the relevant info from lspci:

```
00:09.0 IDE interface: nVidia Corporation MCP2A IDE (rev a3)

00:0b.0 IDE interface: nVidia Corporation nForce2 Serial ATA Controller (rev a3)
```

----------

## apberzerk

Aha, I fixed it, finally!

I use the module called amd74xx under ATA/ATAPI support.  The module did not automatically load in the 2.6.19 kernel, so I ran "modprobe amd74xx" and immediately I got the /dev/hda entry, as well as working dma support.

Any idea why the module did not load automatically?

- Phil

----------

## Cyker

 *apberzerk wrote:*   

>  *Cyker wrote:*   I'm using libata for my SATA drives, but I've stuck with the old IDE driver for my ATA drives until I'm sure it's stable. 
> 
> Same here.  I could not get the experimental PATA drivers in libata to work.  I have an nvidia nforce2 chipset with AMD processor, so I use BLK_DEV_AMD74xx (the old module) or PATA_AMD (the new module).  The PATA_AMD module loads, but the drive does not show up in /dev.  It used to be /dev/hdx, would it now be /dev/sdx?

 

I recall reading someplace that, yes, it becomes "sd?" instead of "hd?"

I hope it isn't true 'tho because that's a pain in the ass. Really it should make everything "hd?" (sd? is supposed to be for SCSI, not ATA!).

 *apberzerk wrote:*   

>  *Cyker wrote:*   But where is the DMA support option for libata? I can't see one either... 
> 
> I swear it wasn't there when I first compiled my 2.6.19 kernel, but now it is.  Maybe because I copied my .config from 2.6.18.  Anyway, here's where it is:  Device Drivers -> ATA/ATAPI/MFM/RLL Support -> PCI IDE Chipset Support -> Generic PCI bus-master DMA support.

 

That's the DMA setting for the 'old' IDE driver, not libata's  :Wink: 

I think you're right about libata not having one, but auto config'ing it...

The easiest way to check which driver is doing what is to look in the dmesg - Lines that start with ide?: are the stable driver. Stuff with ata?: are the libata driver.

 *apberzerk wrote:*   

>  *Cyker wrote:*   How's it running for you? 
> 
> Even though I found DMA support and enabled it, it is still turned off for my cdrom and hdparm cannot turn it back on.  :*(

 

As you found it's because you needed the AMD/nVidia driver  :Wink: 

I compile all my drivers into the kernel so my mod-foo is weak  :Sad: 

I suspect something needs to be added to /etc/modules.autoload.d/kernel-2.6

Or possible just /etc/modules.conf

----------

## depontius

 *Cyker wrote:*   

>  *apberzerk wrote:*    *Cyker wrote:*   I'm using libata for my SATA drives, but I've stuck with the old IDE driver for my ATA drives until I'm sure it's stable. 
> 
> Same here.  I could not get the experimental PATA drivers in libata to work.  I have an nvidia nforce2 chipset with AMD processor, so I use BLK_DEV_AMD74xx (the old module) or PATA_AMD (the new module).  The PATA_AMD module loads, but the drive does not show up in /dev.  It used to be /dev/hdx, would it now be /dev/sdx? 
> 
> I recall reading someplace that, yes, it becomes "sd?" instead of "hd?"
> ...

 

The idea here is to set partition labels, and use the labels in /etc/fstab instead of device names. Once you're converted to device labels, you can swap back and forth between IDE and libata kernels with ease. Grub needs to be tweaked for hd/sd, but that matches the kernel. Beyond that, the only thing I've got that is sensitive to hd/sd is smartd.

Look first to "e2label", then there's the "-L" parameter to "mkswap", and the "LABEL=" notation in "/etc/fstab". I also have some xfs, and there's a utility to do that, too. You can use e2label on mounted partitions, but xfs and swap require partitions to be unmounted or taken offline.

 *Cyker wrote:*   

>  *apberzerk wrote:*    *Cyker wrote:*   But where is the DMA support option for libata? I can't see one either... 
> 
> I swear it wasn't there when I first compiled my 2.6.19 kernel, but now it is.  Maybe because I copied my .config from 2.6.18.  Anyway, here's where it is:  Device Drivers -> ATA/ATAPI/MFM/RLL Support -> PCI IDE Chipset Support -> Generic PCI bus-master DMA support. 
> 
> That's the DMA setting for the 'old' IDE driver, not libata's 
> ...

 

OK. Last week, I converted my laptop (piix) over to libata with no problems, about as soon as 2.6.19-r5 went stable. After, I tried to convert my nForce 2 machine at home. It's not working. For the laptop, I picked the anticipated drivers as modules, udev loaded them, and it all just worked. For the nForce2, that didn't work. Then I tried building the anticipated drivers directly into the kernel, instead of modules, still no-go. Finally I just build ALL of the sata/pata modules, still no-go.

I'm interested to see you say that nForce2 libata/pata, with apparently the same symptoms as me. I get no disks in /dev, either. So far google tells me nothing. Do you know any more about this?

----------

## zaai

 *Quote:*   

> After, I tried to convert my nForce 2 machine at home. It's not working.

 

Same here with an nForce3 athlon64 mobo with a PATA and a SATA drive. The solution was to keep the old PATA drivers and enable the new drivers for SATA only.

----------

## omega5

I'm using an ASUS A7N8X Del r2 mobo with 2.6.19 and I have disabled all the old ata support and am using the new libata support completely with no issues (after a bit of tweaking for my system with /dev/hdaX becoming /dev/sdcX and so on) but I just use the Silicon Image SATA driver and the AMD/Nvidia PATA ones built in and it all goes smoothly, just watch out for the device name change when you first boot one of these kernels.  I would suggest turning off the quiet option in grub for at least one boot til you pick up the new device names to set everything to, if needs be, otherwise use device labels where possible.

----------

## depontius

I engaged in a little more debuggery last night, with a few observations...

First, the initramfs appears to not get built correctly. On my laptop I'd built the pata drivers as modules, they were loaded automagically, and it just worked. On the nForce2, no partitions are found. I went wandering around the early userland, and found that pata_amd.ko was missing, though there were a bunch of other pata_???.ko modules. On this particular build, I'd built ALL the libata pata and sata modules. At this point, it's obvious that the system wouldn't have been able to boot, since it couldn't find the disk, having no driver. I rebooted 2.6.18, and sat pata_amd.ko in /lib/modules/2.6.19, so it's something in the initramfs build.

Next, I rebuilt the kernel, but built any anticipated libata modules directly into the kernel, not modules. It still doesn't work, but this time dmesg gives me some more interesting information. The drivers are clearly loading, and it's recognizing both my hard drive and cdrom. But I get 2 lines of:

```
ATA: abnormal status 0x7FF on port 0x177
```

in there, prior to the listing of drive information. I have begun searching for this message, and find quite a few hits, but so far it's all heavily mixed in with sata information. At this point 2.6.20 is out. I may either emerge ~x86 vanilla-sources or gentoo-sources, depending on how long it takes me.

I've been having problems with my dvd writer (Pioneer) and thought I saw a hint somewhere that libata might handle it better.

[edit]

I need to mention 2 other things...

On the last try, with the libata/pata drivers built into the kernel, I do get /dev/sr0 for the cdrom. I just don't get /dev/sda for the hard drive.

The dvd writer is not on the nForce2 system, it's on the nForce4 system. I just decided to try 2.6.19/libat/pata second on the nForce2, since it hasn't gone stable yet on amd64. I'm presuming that the ide support is pretty similar between the 2 chipsets.

----------

## omega5

don't worry about hunting for the dma option if you're using libata as it seems to be built in and enabled by default at least going by the dmesg output i get on 2.6.19-beyond3 which i'm currently running

----------

## quadbox

Has anyone else noticed excitingly random problems with ATAPI devices using libata pata?  

Everything apart from that seems to work nicely with the new pata drivers, for me (amd 762 pata controller, promise tx4 sata controller)

----------

## depontius

I've successfully moved 2 computers to libata/pata, and so far failed to move 1.

Both of the successful moves were on PIIX machines, though 1 uses SCSI hard drives, so all I've really moved over is the cdrom, and gotten rid of the IDE code. The other machine has been perfectly happy running libata/pata on PIIX. I'd have to double-check, but it seems to me that smartctl doesn't return as much information under libata/pata as it does under IDE.

I have still not been successful at moving my nForce2 machine - it appears that the controller and drives are detected, but no partitions created. I see a fair amount of basic libata/pata work still being done, so I plan to try kernels newer than 2.6.19 as I get time.

----------

