Skip to contentSkip to conversation

generic device DMA implementation

RFC Adam J. Richter 6 participants 11 messages Dec 6, 2002 – Dec 7, 2002

lore
Share & tools
lore
#0 lore raw
Quoted 8 lines · David S. Miller
Quoted 3 lines · Adam J. Richter

These change
will eliminate a difficulty in supporting devices on inconsistent-only machines

I think you are solving a non-problem, but if you want me to see your side of the story you need to give me specific examples of where pci_alloc_consistent() is "IMPOSSIBLE".

I am not a parisc developer, but it is apparently the
case for certain parisc machines with "PCXS/T processors" or the "T class" machines, as described by Mathew Wilcox:

http://lists.parisc-linux.org/pipermail/parisc-linux/2002-December/018535.html

They currently need the contortions
that are implemented in linux-2.5.50/drivers/net/lasi_82596.c and partially implemented in drivers/scsi/53c700.c to be implemented in every driver that they want to use (i.e., what these drivers try to do when pci_alloc_consistent fails).

Under the API addition that we've been discussing, the
extra cache flushes and invalidations that these drivers need would become macros that would be expand to nothing on the other architectures, and the drivers would no longer have to have "if (consistent_alloation_failed) ..." branches around them.

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 · Adam J. Richter
Quoted 3 lines · David S. Miller

I think you are solving a non-problem, but if you want me to see your side of the story you need to give me specific examples of where pci_alloc_consistent() is "IMPOSSIBLE".

I am not a parisc developer, but it is apparently the
case for certain parisc machines with "PCXS/T processors" or the "T class" machines, as described by Mathew Wilcox:

Machines built with PCXS and PCXT processors are guaranteed not to have PCI. So this only becomes a problem when supporting non-PCI devices. The devices you mentioned -- 53c700 & 82596 -- are core IO and really do need to be supported. There's also a large userbase for these machines, dropping support for them is not an option.

T class machines don't have PCI slots per se, but they do have GSC slots into which a card can be plugged that contains a Dino GSC to PCI bridge and one or more PCI devices. Examples of cards that are like this include acenic, single and dual tulip.

On the other hand, it's going to take some really motivated person to make T class work. I'm firmly uninterested in it.

Signature · 3 lines
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
#2 lore raw
In reply to Adam J. Richter

From: "Adam J. Richter" <[email protected]>
Date: Fri, 6 Dec 2002 08:19:25 -0800

Under the API addition that we've been discussing, the
extra cache flushes and invalidations that these drivers need would become macros that would be expand to nothing on the other architectures, and the drivers would no longer have to have "if (consistent_alloation_failed) ..." branches around them.

Ok, but here is where my big concerns lie.

Specifically, it took years to get most developers confortable with pci_alloc_consitent() and friends. I totally fear that asking them to now add cache flushing stuff to their drivers takes the complexity way over the edge.

Willy, these PCXS/T processors sound like a newer cpu, do you mean to tell me the caches are totally not coherent with device bus space?

Please elaborate, I want to learn more.

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

Specifically, it took years to get most developers confortable with pci_alloc_consitent() and friends. I totally fear that asking them to now add cache flushing stuff to their drivers takes the complexity way over the edge.

I have no plans ever to do that. It's only a tiny minority of drivers that should ever need to know the awful guts of cache flushing, and such drivers are already implementing the cache flushes now.

How about (as Adam suggested) two dma allocation API's

1) dma_alloc_consistent which behaves identically to pci_alloc_consistent
2) dma_alloc which can take the conformance flag and can be used to tidy up the drivers that need to know about cache flushing.

James

#4 lore raw

From: James Bottomley <[email protected]>
Date: Fri, 06 Dec 2002 12:29:10 -0600

How about (as Adam suggested) two dma allocation API's

1) dma_alloc_consistent which behaves identically to pci_alloc_consistent
2) dma_alloc which can take the conformance flag and can be used to tidy up the drivers that need to know about cache flushing.

Now that the situation is much more clear, I'm feeling a lot better about this.

I have only one request, in terms of naming. What we're really doing is adding a third class of memory, it really isn't consistent and it really isn't streaming. It's inconsistent memory meant to be used for "consistent memory things".

So could someone come up with a clever name for this thing? :-)

#9 lore raw
In reply to David S. Miller
Quoted 9 lines · David S. Miller

Specifically, it took years to get most developers confortable with pci_alloc_consitent() and friends. I totally fear that asking them to now add cache flushing stuff to their drivers takes the complexity way over the edge.

Willy, these PCXS/T processors sound like a newer cpu, do you mean to tell me the caches are totally not coherent with device bus space?

Please elaborate, I want to learn more.

Nono, these are _old_ machines, probably stopped production round about 1995 or so. We mentioned these briefly back in the original days of the pci_alloc_consistent interface discussions. These machines cannot allocate uncached memory, nor can the peripherals snoop the CPU's cache (or vice versa). As I indicated to Adam, there's a fairly limited range of devices available for these systems and there shouldn't be a huge problem converting the few drivers we need to these interfaces.

Signature · 3 lines
"It's not Hollywood.  War is real, war is primarily not about defeat or
victory, it is about death.  I've seen thousands and thousands of dead bodies.
Do you think I want to have an academic debate on this subject?" -- Robert Fisk
#5 lore raw
In reply to David S. Miller
Quoted 4 lines · [email protected] said:

I have only one request, in terms of naming. What we're really doing is adding a third class of memory, it really isn't consistent and it really isn't streaming. It's inconsistent memory meant to be used for "consistent memory things".

Yes, we've discussed that too...but not come to a conclusion. The problem is really that if you call dma_alloc and pass in the DMA_CONFORMANCE_NON_CONSISTEN T flag, what you're saying is "This driver implements all the correct cache flushes and can cope with inconsistent memory. Please give me the type of memory that's most efficient for the platform I'm running on.". The driver isn't asking give me a specific type of memory, it's telling the platform what it's capabilities are.

Any thoughts on naming would be most welcome.

James

#10 lore raw
In reply to Matthew Wilcox

From: Matthew Wilcox <[email protected]>
Date: Fri, 6 Dec 2002 18:36:09 +0000

As I indicated to Adam, there's a fairly limited range of devices available for these systems and there shouldn't be a huge problem converting the few drivers we need to these interfaces.

Ok, so to reiterate my other email, I'm fine with this as long as suitable names are used to describe what is happening in the API and to avoid confusion with existing practice.

#6 lore raw
In reply to James Bottomley

From: James Bottomley <[email protected]>
Date: Fri, 06 Dec 2002 12:40:49 -0600

Yes, we've discussed that too...but not come to a conclusion. The problem is really that if you call dma_alloc and pass in the DMA_CONFORMANCE_NON_CONSISTEN T flag, what you're saying is "This driver implements all the correct cache flushes and can cope with inconsistent memory. Please give me the type of memory that's most efficient for the platform I'm running on.". The driver isn't asking give me a specific type of memory, it's telling the platform what it's capabilities are.

Any thoughts on naming would be most welcome.

How about just making a dma_alloc_$(NEWNAME)(), and consistent ports can just alias that to dma_alloc_consistent()?

The only question is $(NEWNAME). "inconsistent" might be ok, but it's maybe too similar to "consistent" for my taste.

How about dma_alloc_noncoherent(). I like this one, comments?

#7 lore raw
Quoted 11 lines · David S. Miller

From: James Bottomley <[email protected]>
Date: Fri, 06 Dec 2002 12:40:49 -0600

Yes, we've discussed that too...but not come to a conclusion. The problem is really that if you call dma_alloc and pass in the DMA_CONFORMANCE_NON_CONSISTEN T flag, what you're saying is "This driver implements all the correct cache flushes and can cope with inconsistent memory. Please give me the type of memory that's most efficient for the platform I'm running on.". The driver isn't asking give me a specific type of memory, it's telling the platform what it's capabilities are.

Quoted 7 lines

Any thoughts on naming would be most welcome.

How about just making a dma_alloc_$(NEWNAME)(), and consistent ports can just alias that to dma_alloc_consistent()?

The only question is $(NEWNAME). "inconsistent" might be ok, but it's maybe too similar to "consistent" for my taste.

Can we do pci_alloc_consistent -> dma_alloc? Then regardless of what you name the other one, the consistent version will obviously be prefered.

Signature · 1 line
 "Love the dolphins," she advised him. "Write by W.A.S.T.E.." 
#8 lore raw
In reply to David S. Miller
Quoted 9 lines · David Miller

From: James Bottomley <[email protected]>
Date: Fri, 06 Dec 2002 12:29:10 -0600

How about (as Adam suggested) two dma allocation API's

1) dma_alloc_consistent which behaves identically to pci_alloc_consistent
2) dma_alloc which can take the conformance flag and can be used to tidy up the drivers that need to know about cache flushing.

Quoted 7 lines

Now that the situation is much more clear, I'm feeling a lot better about this.

I have only one request, in terms of naming. What we're really doing is adding a third class of memory, it really isn't consistent and it really isn't streaming. It's inconsistent memory meant to be used for "consistent memory things".

Not really... it seems to me its abdicating the choice of consistent versus streaming memory to the platform. Or to look at it another way, the actual guarantees it provides are identical to those of streaming DMA, but this gives the platform an opportunity to optimise by controlling the allocation rather than demanding it deal with memory from any old place as pci_map_* must do.

A driver using this sort of memory should be at least isomorphic to one using streaming memory (maybe identical, depending on exactly which functions are which etc.).

Quoted 1 line

So could someone come up with a clever name for this thing? :-)

Given that, how about "fast-streaming" DMA memory.

Signature · 4 lines
David Gibson			| For every complex problem there is a
[email protected]	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson