Re: Generic PCI IDE bus-mastering DMA support

Zlatko Calusic (Zlatko.Calusic@CARNet.hr)
18 Sep 1997 18:01:12 +0200


"Christian Brunner" <chb@muc.de> writes:

> You might give the attached patch a try, but I won't promise anything.
> This is a completly untested quick hack. (And don't blame me for any
> unpredictable result... ).
>
> Baba, Christian
>
>
> --- linux/drivers/block/triton.c.bmdma Wed Sep 10 21:45:10 1997
> +++ linux/drivers/block/triton.c Thu Sep 18 11:18:21 1997
> @@ -459,7 +459,16 @@
> */
> if ((pcicmd & 4) == 0) {
> printk("%s: bus-master DMA feature is not enabled (BIOS)\n", chipset);
> - } else {
> + if ((rc = pcibios_write_config_word(bus, fn, 0x04, (pcicmd | 4))))
> + goto quit;
> + if ((rc = pcibios_read_config_word(bus, fn, 0x04, &pcicmd)))
> + goto quit;
> + if ((pcicmd & 4) != 0)
> + printk("%s: bus-master DMA turned on (overiding BIOS)\n", chipset);
> + else
> + printk("%s: overiding BIOS doesn't work\n", chipset);
> + }
> + if ((pcicmd & 4) != 0) {
> /*
> * Get the bmiba base address
> */
>
>
>

Success at last. You made my day!

After applying your patch and doing one small change in source by my
own:

--- linux/drivers/block/ide.c.orig Thu Sep 18 16:41:21 1997
+++ linux/drivers/block/ide.c Thu Sep 18 16:41:52 1997
@@ -2599,7 +2599,7 @@
pcibios_read_config_word (bus, fn, PCI_COMMAND, &command);
pcibios_read_config_byte (bus, fn, PCI_LATENCY_TIMER, &lat);

- if (lat && (command & PCI_COMMAND_MASTER))
+/* if (lat && (command & PCI_COMMAND_MASTER)) */
ide_init_triton (bus, fn + func_adj);
}
#endif /* CONFIG_BLK_DEV_TRITON */

I eventually managed to get bloody thing working. :)

Kernel log:

SIS: bus-master IDE device on PCI bus 0 function 9
SIS: bus-master DMA feature is not enabled (BIOS)
SIS: bus-master DMA turned on (overiding BIOS)
ide0: BM-DMA at 0xec70-0xec77
ide1: BM-DMA at 0xec78-0xec7f
...
hda: IBM-DAQA-33240, 3098MB w/96kB Cache, LBA, CHS=787/128/63, DMA
^^^
And this is from /proc/pci (for others to compare):

Bus 0, device 1, function 1:
IDE interface: Silicon Integrated Systems 85C5513 (rev 8).
Fast devsel. Master Capable. Latency=64.
I/O at 0x0 [0x1].
I/O at 0x0 [0x1].
I/O at 0x0 [0x1].
I/O at 0x0 [0x1].
I/O at 0xec70 [0xec71].

After running some benchmarks I noticed that performance is slighly
better when reading from disk, but worse when writing to disk (??).
Benchmark results are available on request (I will make some more,
just to be sure).

I have been warned that DMA is not the magic solution (SCSI *is* :) ),
but friend of mine has opinion that it should cut CPU usage to half!?!

Excerpt from the "hdparm" utility man page:

"Using DMA does not necessarily provide any improvement in throughput
or system performance, but many folks swear by it. Your mileage may
vary.".

Comments on this subject are welcome (email ok).

Thanks, Christian, for your time. I will run your patches for some
time, and if I encounter any problems, you will know about them,
too. Right now, thing seems very stable and is practicaly ready to go
into the mainstream kernel, IMHO. I will gladly test any future patch
you may come up with.

Regards,

-- 
Posted by Zlatko Calusic           E-mail: <Zlatko.Calusic@CARNet.hr>
---------------------------------------------------------------------
	 Suicide is the most sincere form of self criticism.