Basic question about PCI device drivers

Basic question about PCI device drivers

Post by Slawek Grajewsk » Tue, 17 Apr 2001 04:19:43



Hello,

I'm looking at various network card drivers and have the following question.
I know that after the PCI card completes the frame reception via DMA, it
signals that condition with an interrupt. The interrupt service routine,
notices that and pushes the frame into the upper layers by calling
netif_rx() function.
My question is: what happens that after DMA operation to given physical
page, performed by a network card, CPU does not have to invalidate its cache
for this particular page, and (as I se in various device drivers) sees the
right data (data actually written by network card). Since DMA is performed
by a different processor (card adapter), there must be some way of
invalidating (synchronizing) the cache for that page in the main CPU.
Otherwise, the main CPU could possibly use the stale contents of its cache
for that page, not affected by the DMA transfer.
I see three possibilities, but I don't know which is true:
a. network buffers (alloc_skb()) are in non-cached memory,
b. CPU invalidates the cache before accessing the frame,
c. CPU cache is automatically updated by hardware (so that its view is
always coherent).
Can someone explain it to me?

TIA,
Slawek

 
 
 

Basic question about PCI device drivers

Post by p.. » Tue, 17 Apr 2001 18:22:17


[snip]

Quote:> Since DMA is performed
> by a different processor (card adapter), there must be some way of
> invalidating (synchronizing) the cache for that page in the main CPU.
> Otherwise, the main CPU could possibly use the stale contents of its cache
> for that page, not affected by the DMA transfer.
> I see three possibilities, but I don't know which is true:
> a. network buffers (alloc_skb()) are in non-cached memory,
> b. CPU invalidates the cache before accessing the frame,
> c. CPU cache is automatically updated by hardware (so that its view is
> always coherent).
> Can someone explain it to me?

Disclaimer: all AFAIK!
On the i386 processors the hardware solves the problem. I think it does
something called "bus snooping" and invalidates (not: updates) the
affected cache lines. So you don't have to care about that.

Something I'm not really sure about is the other way: If you fill some
memory buffer from the CPU and then tell a PCI card (by writing to some
I/O-mapped or memory mapped register) to get the buffer, is it sure that
the PCI card sees the updated memory content?

Followups: removed c.o.l.d.a.

Peter

 
 
 

1. Device driver question (generic device driver)

Hi, I post this for a colleague, who is unable to post here, so please

Herbert
Now his questions:

Hello,
I'm currently involved in writing a generic device driver, that
implements some common functions for other real drivers. My problem is:
How can I make sure that the generic driver is loaded first (before the
real driver modules)? Is there any order besides the order in the
/etc/system-file?
How does the OS loads it's own generic driver-modules?
Is it on demand ?
If yes, how is the "demanding" encoded, and where (Is there a defaults
file for this ? Is it hardcoded or can it be configured?) ?

Any help appreciated!
Thanks in advance for your replies!

Yours,

Christian

_______________________________________________________________________

"Now's the time to impress not suppress your intellect, hold a gun to
 your head, if your mind's dead, blow away the cobweb" TEST DEPT; "bang
 on it" (Metal Edit) CD LEGACY (1990-1993), freud cd 047, efa 75230-2

2. help... Red Hat 5.0 install

3. PCI device vs SCSI device driver

4. /etc/passwd & /etc/security/passwd

5. Device driver devices.pci.scsi missing

6. Linux ODBC Client to Windows Database Server Solutions

7. PCI device driver question

8. GNU backup tool

9. GXT120P device driver (devices.pci.2b101a05) urgently needed

10. HELP needed: Solaris PCI device driver, device not auto detected.

11. Question concerning PCI device driver

12. Solaris8 x86 PCI Driver with multiple PCI devices

13. Question: PCI Bios messages (Unknown PCI device, IRQ probe failed)