Linux DMA for Dell Inspiron 5000
Disclaimer: Performing the procedure outlined on this page is at your own
risk.
The author provides no guarantees, warranties or any liability with respect
to any damages
or loss of data or any other harm resulting from performing
any of the procedures outlined on this webpage.
RedHat 6.2 and the current kernel 2.2.16-3
seem to offer only limited support for
the Intel PIIX4 IDE chipset of the Dell Inspiron 5000.
With the standard configuration, my machine was not using DMA for /dev/hda at all.
This resulted in slow HD data
transfer rates (hdparm -t /dev/hda output was around 3.5 MB/sec).
You can check your DMA setting by executing
/sbin/hdparm -v /dev/hda
as root. My output used to be
/dev/hda:
multcount = 0 (off)
I/O support = 0 (default 16-bit)
unmaskirq = 0 (off)
using_dma = 1 (on)
keepsettings = 0 (off)
nowerr = 0 (off)
readonly = 0 (off)
readahead = 8 (on)
geometry = 1559/240/63, sectors = 23579136, start = 0
Also, the boot messages didn't mention DMA when detecting hda:
May 8 03:15:59 srini kernel: hda: IBM-DARA-212000, 11513MB w/418kB Cache, CHS=1559/240/63
Not using DMA meant that the machine slowed down to the point of no use when it started
swapping.
Also, when un-tar'ing files, it was basically impossible to do
anything in parallel.
I'm not sure whether all Inspiron 5000's use the PIIX4 chipset, your /proc/pci
file should contain an entry like
Bus 0, device 7, function 1:
IDE interface: Intel 82371AB PIIX4 IDE (rev 1).
Medium devsel. Fast back-to-back capable. Master Capable. Latency=64.
I/O at 0x1050 [0x1051].
A linux ide kernel driver patch for the PIIX4 chipset is available from
http://www.linux-ide.org,
the current version as of 9/3/2000 is ide.2.2.16.all.20000805.patch.gz
After installing the patch and recompiling the kernel, the DMA
on my machine works great!
Also, multitasking performance
has increased considerably if one process uses a lot of disk access.
Now, the hdparm output after booting is
/dev/hda:
multcount = 0 (off)
I/O support = 0 (default 16-bit)
unmaskirq = 0 (off)
using_dma = 1 (on)
keepsettings = 0 (off)
nowerr = 0 (off)
readonly = 0 (off)
readahead = 8 (on)
geometry = 1559/240/63, sectors = 23579136, start = 0
and the boot messages are
Sep 4 10:51:44 srini kernel: ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
Sep 4 10:51:44 srini kernel: PIIX4: IDE controller on PCI bus 00 dev 39
Sep 4 10:51:44 srini kernel: PIIX4: chipset revision 1
Sep 4 10:51:44 srini kernel: PIIX4: not 100% native mode: will probe irqs later
Sep 4 10:51:44 srini kernel: ide0: BM-DMA at 0x1050-0x1057, BIOS settings: hda:DMA, hdb:pio
Sep 4 10:51:44 srini kernel: ide1: BM-DMA at 0x1058-0x105f, BIOS settings: hdc:DMA, hdd:pio
Sep 4 10:51:44 srini kernel: hda: IBM-DARA-212000, ATA DISK drive
Sep 4 10:51:44 srini kernel: hdc: TOSHIBA CD-ROM XM-7002B, ATAPI CDROM drive
Sep 4 10:51:44 srini kernel: ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
Sep 4 10:51:44 srini kernel: ide1 at 0x170-0x177,0x376 on irq 15
Sep 4 10:51:44 srini kernel: hda: IBM-DARA-212000, 11513MB w/418kB Cache, CHS=1559/240/63, UDMA(33)
Sep 4 10:51:44 srini kernel: hdc: ATAPI 24X CD-ROM drive, 128kB Cache, UDMA(33)
so linux is now using the PIIX4 driver and seems to detect the udma(33) mode/capabilities.
Also, running '/sbin/hdparm -t /dev/hda' now reports transfer rates between 8-12 MB/sec.
Below is a summary of how to perform the procedure of applying the patch,
compiling the kernel and most importantly, how to get pcmcia working again
after compiling the new kernel.
I assume that you know how to
configure and compile a standard linux kernel
(instructions for building a kernel used to be in the RedHat installation guide),
but I don't assume any knowledge about the pcmcia part of building a new kernel (this
turned out to be the hard part for me).
The way I got things to work is somewhat clumsy, so please send any suggestions
to frese01@hotmail.com.
Disclaimer: Performing the procedure outlined on this page is at your own
risk.
The author provides no guarantees, warranties or any liability with respect
to any damages
or loss of data or any other harm resulting from performing
any of the procedures outlined on this webpage.
0. WARNING: Messing with kernel and HD drivers is risky
- Only go ahead if you have read all the steps below and you feel comfortable performing these steps.
- Messing with the kernel and the HD's drivers is risky - if something goes wrong or
the drivers described here are not applicable to your hardware,
your computer might not run anymore or you might get data corruption on your hard disk.
- You should have a boot disk and functioning rescue system and be familiar
with it's use in case you can't boot your new kernel after the compile etc.
1. Get the files
- Make sure you have the standard RedHat kernel-source and kernel-headers packages installed.
(kernel-source-2.2.16-3.i386.rpm, kernel-headers-2.2.16-3.i386.rpm )
- Get the current IDE patch from http://www.linux-ide.org,
e.g. ide.2.2.16.all.20000805.patch.gz
- Get the current version of the pcmcia package from http://pcmcia-cs.sourceforge.net/.
As of 9/3/00, the file to get is pcmcia-cs-3.1.20.tar.gz.
Make SURE you get the tar.gz source code of this package, NOT the RedHat RPM!!!
- In case something goes wrong, it is good to download a copy
of RedHat's kernel-pcmcia package for re-install
(kernel-pcmcia-cs-2.2.16-3.i386.rpm)
2. Apply the patch
- I assume kernel-headers and kernel-source are installed.
- Put the patch ide.2.2.16.all.20000825.patch.gz in /usr/src and uncompress:
gunzip patch ide.2.2.16.all.20000825.patch.gz
(Actually, when I downloaded the .gz-file, it was already uncompressed despite the gz suffix.
If gunzip fails, see if the file is a text file, in that case no need to uncompress...).
- Look at the first line of the patch file, it looks like
diff -urN linux-2.2.16-pristine/CREDITS linux-2.2.16.d/CREDITS
You need to put in a symbolic link by executing
ln -s /usr/src/linux /usr/src/linux-2.2.16.d
- Apply the patch: patch -p0 < ide.2.2.16.all.20000825.patch.gz
There will be messages about missing files for different architectures such as
power pc etc. Just hit return twice to skip these files.
3. Configure and compile your kernel
- When you configure the kernel, e.g. with make xconfig, enable the two options
for the PIIX driver under block devices,
CONFIG_BLK_DEV_PIIX and CONFIG_PIIX_TUNING.
As an example, here is my kernel configuration kernel_config.
- make xconfig doesn't seem to offer an option to select PCMCIA config. I've compiled the kernel without the pcmcia stuff and compiled the pcmcia package separately as described below.
The advantage of doing it this way is that you can get the newest version of the pcmcia package.
The downside is that the install of the new pcmcia package overwrites some of RedHat's startup
scripts which needs to be reversed manually as described below.
4. Backup your old pcmcia configuration
- The install of the pcmcia package in step 5 will overwrite some of the RedHat startup
scripts.
This results in the problem that eth0 won't come up automatically after boot.
To fix this, you must backup the RedHat scripts BEFORE you install the new pcmcia
package:
cp -rp /etc/pcmcia /etc/pcmcia_rh
cp -p /etc/sysconfig/pcmcia /etc/sysconfig/pcmcia_rh
cp -p /etc/rc.d/init.d/pcmcia /etc/rc.d/init.d/pcmcia_rh
- If you accidentally overwrite the RH scripts, you can reinstall the kernel-pcmcia-cs rpm,
then back-up the scripts and re-install the new pcmcia (step 5 below).
5. Install the new pcmcia package
- The modules directory of your new kernel build
(e.g. /lib/modules/2.2.16-3) does not contain a pcmcia subdirectory.
You CANNOT just copy the
pcmcia subdirectory from the old kernel modules into the new module directory.
Instead, you need to re-compile the pcmcia package while running your new kernel.
- Make sure you are running the kernel you just compiled
- Uncompress the pcmcia package in /usr/src:
cd /usr/src
tar xvfz pcmcia-cs-3.1.20.tar.gz
- Configure the pcmcia package:
cd /usr/src/pcmcia-cs-3.1.20
make config
The default options should be good. I've used 'trusting' and said yes to PnP.
- Compile and install the package:
make all
make install
When running make install, I got a depmod error about parport_cs.o. This might have to
do with the fact that I built the parport support into the kernel instead
of building a module.
I just deleted the parport_cs.o file from the /lib/modules/2.2.16-3/pcmcia directory since I don't need it anyway.
6. Revert to RedHat's pcmcia startup configuration
- By now, everything should be working, however, if you have an ethernet pcmcia
card, eth0 won't come up automatically after a reboot.
It should come up if you type /sbin/ifup eth0 .
- To fix this, revert to the RedHat's configuration (this is also described in the PCMCIA-HOWTO)
mv /etc/pcmcia/network /etc/pcmcia/network_new
cp -p /etc/pcmcia_rh/network /etc/pcmcia/network
mv /etc/pcmcia/network.opts /etc/pcmcia/network.opts_new
cp -p /etc/pcmcia_rh/network.opts /etc/pcmcia/network.opts
- Your /etc/pcmcia_rh/network.opts should look like (from PCMCIA-HOWTO):
if [ -f /etc/sysconfig/network-scripts/ifcfg-$1 ] ; then
start_fn () {
if [ "$ONBOOT" = "yes" ] ; then /sbin/ifup $1 ; fi
}
stop_fn () {
/sbin/ifdown $1
}
fi
- I also reverted to the old /etc/sysconfig, however, I'm not sure whether it's necessary.
That's it. Hopefully, everything is working fine.
Please send comments to
frese01@hotmail.com .
Notes
- In the boot messages you probably see something like
Sep 4 10:51:44 srini kernel: ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
From what I understand, one should probably NOT set this to a higher frequency.
The Intel documentation of the 82371AB PIIX4 IDE interface says that the chipset supports 30 and 33MHz bus frequency and UDMA/33.
Thus, while the HD supports 66MB/sec transfer rate, the highest the controller seems to be capable of is 33MB/sec.
Thomas Frese
Last modified: Sun Sep 4 12:10:36 EST 2000