Re: PCI lib for 2.4 //kwds: pci, dma, mapping memory, kernel vs. user-space.

From: Peter Chubb
Date: Tue Dec 16 2003 - 18:55:13 EST


>>>>> "Damien" == Damien Courouss <Damien> writes:

Damien> Hi Martin, Thanks for your answer.

Damien> I did not yet understand why I find two differents pci.h
Damien> files, and why I cannot use one of them (since my compiler
Damien> can't link with the lib)... Is there a specific way of using
Damien> the second one, which I did not understand?

/usr/include/pci/XXX.h are the header files to use with libpci.a
They are *all* you can use for a user-space driver.

/usr/include/linux and /usr/include/asm are copies from the kernel,
and should not be used directly in user code --- they document
internal kernel interfaces that are not accessible from user space.

You should be able to do high speed data streaming from user space --
we have a user-mode gigabit ethernet driver here that achieves
~700Mb/s for reasonable sized packets --- but latency may be a killer.
I'm measuring 10 microseconds from a PCI board asserting an interrupt
line until a driver can acknowledge it from user space; only a little lower
for a kernel driver. (That seems about the same on P4 at 2.5GHz and
IA64 at 900MHz, BTW, so I suspect there are hardware-imposed delays
--- to acknowledge the interrupt, the driver has to do one inw and one
outw; these are slow).

You will however have to modify the kernel to allow mapping from your
address space into bus space, so that you can set up the devices's DMA
scatterlist; and to allow interrupts to be delivered to user space
(unless you plan to poll). There are preliminary patches to do this at
http://www.gelato.unsw.edu.au/patches/usrdrivers for 2.6.0-testXXX
kernels; the work to support user drivers here is ongoing, and the
interfaces *will* change (currently they're what was easy to implement
fast (i.e., hack up) and do not correspond to production quality code)
We're not interested in 2.4 kernels for this; I'm hoping that when the
interfaces are cleaned up I can push it to 2.7.

--
Dr Peter Chubb http://www.gelato.unsw.edu.au peterc AT gelato.unsw.edu.au
The technical we do immediately, the political takes *forever*

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/