Problems with dma_alloc_coherent()

Eugene Surovegin ebs at ebshome.net
Fri Apr 2 04:33:30 EST 2004


On Thu, Apr 01, 2004 at 10:19:26AM -0800, Eugene Surovegin wrote:
> On Thu, Apr 01, 2004 at 12:51:54PM -0500, John Whitney wrote:
> > I noticed that all the PCI and DMA coherency routines seem to assume
> > that DMA will occur between memory and a bus device (all physical
> > addresses returned are converted to a bus address).  Is this really the
> > desired action?  I would have prefered to have the PCI routines return
> > bus-correct physical addresses, and the DMA routines return processor
> > physical addresses (so they can be used for non-bus-related DMA, to a
> > direct memory-mapped encryption chip, for example).  Is this the
> > eventual implementation of those functions, or are all DMA transactions
> > expected to be to or from a PCI-based device?
>
> Hmm, I don't understand this, bus != PCI bus. All devices sit on some kind of
> bus, even your encryption chip.
>
> As far as I understand, DMA API was added exactly because we may have different
> (from PCI) buses.
>
> Current implementation just relies on the fact that PCI devices view system
> memory the same way as other-bus devices (e.g. OCP devices which sit on OPB).
>
> In more general case, yes, "views" can be different for each bus type or even
> for each bus...

Let me clarify my point.

You are right that returning PCI-bus address _may_ not be very good. I think
it's OK for now, because it should work for the reason I pointed earlier.

In future, implementation may change...

What you are proposing isn't better than the current PCI-bus addresses. Phys
address is just an address on processor local bus, so changing PCI-bus as a
default to PLB as a default doesn't seem wise.

Correct implementation should devise DMA-addresses (and actual bus) from the
_device_ passed to DMA API function...

Eugene.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-dev mailing list