Skip to contentSkip to conversation

generic device DMA implementation

RFC Adam J. Richter 4 participants 6 messages Dec 6, 2002

lore
Share & tools
lore
#0 lore raw
Quoted 4 lines · Matthew Wilcox

Leaving aside the T-class, machines that don't support io consistent memory generally have:

(drivers that need io consistent memory):

[...]

Quoted 1 line

- zero to four EISA slots

So it sounds like any EISA or ISA card could be plugged into
these machines.

This makes me lean infinitesmally more toward a parameter
to dma_alloc rather than a separate dma_alloc_not_necessarily_consistent function, because if there ever are other dma_alloc variations that we want to support, it is more likely that there may be overlap between the users of those features and then the number of different function calls would have to grow exponentially (or we might then talk about changing the API again, which is not the end of the world, but is certainly more difficult than not having to do so).

Adam J. Richter     __     ______________   575 Oroville Road
[email protected]     \ /                  Milpitas, California 95035
+1 408 309-6081         | g g d r a s i l   United States of America

"Free Software For The Rest Of Us."

#1 lore raw
Quoted 8 lines · [email protected] said:

This makes me lean infinitesmally more toward a parameter to
dma_alloc rather than a separate dma_alloc_not_necessarily_consistent function, because if there ever are other dma_alloc variations that we want to support, it is more likely that there may be overlap between the users of those features and then the number of different function calls would have to grow exponentially (or we might then talk about changing the API again, which is not the end of the world, but is certainly more difficult than not having to do so).

I think I like this.

how about dma_alloc to take two flags

DRIVER_SUPPORTS_CONSISTENT_ONLY

and

DRIVER_SUPPORTS_NON_CONSISTENT

The meaning of which are hopefully obvious this time

and dma_alloc_consistent to be equivalent to dma_alloc with DRIVER_SUPPORTS_CONSISTENT_ONLY (and hence equivalent to pci_alloc_consistent)

James

#2 lore raw

From: James Bottomley <[email protected]>
Date: Fri, 06 Dec 2002 16:26:54 -0600

Quoted 8 lines · [email protected] said:

This makes me lean infinitesmally more toward a parameter to
dma_alloc rather than a separate dma_alloc_not_necessarily_consistent function, because if there ever are other dma_alloc variations that we want to support, it is more likely that there may be overlap between the users of those features and then the number of different function calls would have to grow exponentially (or we might then talk about changing the API again, which is not the end of the world, but is certainly more difficult than not having to do so).

I think I like this.

I don't.

If the concept isn't all that important, why bother?

See, if you have to allocate a whole new routine, you'll think about whether it makes sense or not.

It's like adding a new system call, and the same arguments apply.

I don't want a 'flags' thing, because that tends to be the action which opens the flood gates for putting random feature-of-the-day new bits.

If you have to actually get a real API change made, it will get review and won't "sneak on in". I also don't want architectures adding arch specific flag bits that some drivers end up using, for example. The suggested scheme allows that, and I can guarentee you that people will do things like that.

You must take the time to get the semantics right and make sure they really do handle the cases that are problematic. Random flag bits passed to a "do everything" dma_alloc function don't encourage that at all.

#3 lore raw
Quoted 5 lines · [email protected] said:

It's like adding a new system call, and the same arguments apply.

I don't want a 'flags' thing, because that tends to be the action which opens the flood gates for putting random feature-of-the-day new bits.

I did think of this. The flags are enums in include/linux/dma-mapping.h In theory they can't be hijacked by an architecture without either changing this global header or exciting compiler warnings.

However, I can only see their being two types of drivers: those which do all the sync points and those which don't do any, so I can't see any reason for there to be any more than two such flags.

I also want an active discouragement from using the may return inconsistent API, and I think, given the general programmer predisposition not to want to type, that a long flag name (or a long routine name) does this.

I just don't like API names that look like

dma_alloc_may_be_inconsistent()

but if that's what it takes, I'll do it

James

#4 lore raw

From: James Bottomley <[email protected]>
Date: Fri, 06 Dec 2002 16:48:57 -0600

I just don't like API names that look like

dma_alloc_may_be_inconsistent()

but if that's what it takes, I'll do it

Just use dma_alloc_noncoherent() and we can grep for that.

#5 lore raw
In reply to James Bottomley
Quoted 12 lines · James Bottomley
Quoted 8 lines · [email protected] said:

This makes me lean infinitesmally more toward a parameter to
dma_alloc rather than a separate dma_alloc_not_necessarily_consistent function, because if there ever are other dma_alloc variations that we want to support, it is more likely that there may be overlap between the users of those features and then the number of different function calls would have to grow exponentially (or we might then talk about changing the API again, which is not the end of the world, but is certainly more difficult than not having to do so).

I think I like this.

Quoted 8 lines

how about dma_alloc to take two flags

DRIVER_SUPPORTS_CONSISTENT_ONLY

and
DRIVER_SUPPORTS_CONSISTENT_ONLY
DRIVER_SUPPORTS_NON_CONSISTENT

I rather like Dave's suggestion. I wouldn't want to type DRIVER_SUPPORTS_CONSISTENT_ONLY a few dozen times for example... sure you can do that internally but exposing it to drivers... why ?