PCI ordering [was Re: Universal Driver Interface spec available]

Peter Desnoyers (pjd@fred001.dynip.com)
Thu, 2 Sep 1999 22:30:19 -0400 (EDT)


Alan Cox wrote:
>
> The only horrible case to watch is terminating a live DMA. PCI does write
> posting so doing
>
>
> writel(STOP_DMA, card->control);
> kfree(buf);
>
> is fatal every so often, as the write will be posted, the buffer freed,
> reallocated and trashed before the DMA is posted. Instead use
>
> writel(STOP_DMA, card->control);
> readl(card->anythingboring);
> kfree(buf);

In theory even this isn't safe, since the read return is allowed to pass
inbound DMAs according to the PCI spec. In practice I doubt any non-
buggy hardware would actually do this to you. (I've got some hardware
that does, and I certainly consider it to be buggy...)

-- 
............................................................................
 Peter Desnoyers 
 162 Pleasant St.         (617) 661-1979          pjd@fred.cambridge.ma.us
 Cambridge, Mass. 02139   (978) 461-0402 (work)   pjd@giga-net.com 

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