Subject: Re: USB stack needs early review (Re: Someone should fix our USB stack...)
To: Jason Thorpe <thorpej@shagadelic.org>
From: Jachym Holecek <freza@dspfpga.com>
List: tech-kern
Date: 03/22/2007 18:58:37
# Jason Thorpe 2007-03-22:
> [... bus_dmamap_sync() vs. 'volatile' on wire data structures ...]
> 
> Well, if bus_dmamap_sync() were actually a function call on all  
> platforms (on some, it is a noop macro), then there would be an  
> implied memory clobber, and the compiler would know to refetch from  
> the memory location after the call.

Good point, I missed that.

> But, until such time as the bus_dma interface is cleaned up in this  
> regard, volatile is probably necessary.

For the record those arches seem to be:

  arm/include/bus.h       macro, indirect call or nop 
  sparc/include/bus.h     -- '' -- 
  sparc64/include/bus.h   -- '' --
  sun68k/include/bus.h    -- '' --
  x86/include/bus.h       static inline, possibly nop

Others implement bus_dmamap_sync() as unconditional indirect call. I'm not
sure whether 'static inline' is safe or not.

	-- Jachym