Subject: Re: BUS_DMA_CONTROLDATA flag for bus_dma(9)
To: None <tech-kern@NetBSD.org>
From: Allen Briggs <briggs@wasabisystems.com>
List: tech-kern
Date: 08/14/2003 15:01:26
On Thu, Aug 14, 2003 at 02:37:11PM -0400, Nathan J. Williams wrote:
> Jason Thorpe <thorpej@wasabisystems.com> writes:
> > Currently, bus_dma(9) has no real special support for "control data",
> > i.e. buffer descriptors used for network interfaces, s/g lists for
> > disk controllers, etc.  However, because of the nature of control
> > data, it sometimes requires special handling.
> Could you elaborate a bit on the "nature of control data" and "special
> handling", because I don't quite see what the problem is.

Jason described a bit of this in his message, I thought.  In a sense,
it's a particular type of CPU/device shared memory segment.  With an
ethernet device, for example, it's common to have shared memory for
descriptors and shared memory for data.  The data areas we certainly
want to be cachable.

The descriptors we may want something between cachable and non-cachable
(BUS_DMA_COHERENT).  Why something in between?  In the XScale case, the
part has a fairly small cache that we want to use efficiently.  We can
configure a page in memory to use a write buffer to combine writes into
memory rows without allocating a cacheline for it.  This is similar to
a cache, though, in that the write buffer has to be explicitly drained
to ensure synchronization at specific times.

We'd like to be able to use this write combining for device descriptors
so we can bypass the cache and still get decent write performance.
Overall, the idea is that it would be used for write-mostly shared
memory, I suppose.

Does that help?

> prefer, in particular, that the name of this feature in the bus_dma(9)
> interface reflect what it does, rather than what it is intended to be
> used for.

Suggestions?  The actual meaning, I think, is architecture-specific.
On the XScale, it would be implemented as above.  On PowerPC, it would
probably just be uncached (or maybe map with a different combination of
WIMG--my memory is such that I'd have to review the manuals).  On MIPS,
it might mean something else.

It seems to me that the intended usage is probably the clearest way to
succinctly reflect what it does.

-allen

-- 
 Allen Briggs                     briggs@wasabisystems.com
 Wasabi Systems, Inc.             http://www.wasabisystems.com/