From: Deepak Saxena <dsaxena@mvista.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: "Dmitry A. Fedorov" <D.A.Fedorov@inp.nsk.su>,
linux-kernel@vger.kernel.org
Subject: Re: Proposal: Eliminate GFP_DMA
Date: Fri, 28 Feb 2003 11:17:29 -0700 [thread overview]
Message-ID: <20030228181729.GA8366@xanadu.az.mvista.com> (raw)
In-Reply-To: <20030228155841.GA4678@gtf.org>
On Feb 28 2003, at 10:58, Jeff Garzik was caught saying:
> On Fri, Feb 28, 2003 at 09:44:14PM +0600, Dmitry A. Fedorov wrote:
> >
> > But why drivers of ISA bus devices with DMA should use pci_* functions?
> >
> > I'm personally wouldn't have too much pain with GFP_DMA because I have
> > compatibility headers and proposed change for them is tiny.
>
> Do not let the name "pci_" distract, it works for ISA too :)
>
> We can #define pci_xxx isa_xxx if you like :)
>
> Jeff
This discussion raises an issue that I've been meaning to bring up for a bit.
Currently, the DMA-API is defined as returning a cpu physical address [1],
but should the API be redefined as returning an address which is valid on
the bus which the device sits on? For example, on most xscale systems I
deal with, there's not a 1:1 mapping from physical to PCI memory space,
so the address which is valid on the bus is not a valid CPU physical
address. Imagine an SOC system with on-chip Ethernets and such that
that have direct access to the physical bus, plus non-1:1 PCI translation.
In such a case, I would need a physical address for the on-chip devices and
a PCI bus address for the PCI devices. We can extend this case to a SOC
which has on-chip peripherals on some custom FooBus with non-1:1 translation
into physical memory. Now, depending on whether my device is on
the PCI bus or on said FooBus, my dma_addr needs to have a different
meaning.
One easy answer is to provide bus-specific bus_map/unmap/etc functions
such as is done with PCI, but this seems rather ugly to me as now every
custom bus needs a new set of functions which IMNHO defeats the purpose
of a Generic DMA API. I think it would be a much cleaner solution to
define the DMA API itself to return an address that is valid on the
the bus pointed to by dev->bus. I don't think this would require any
implementation changes at the moment, but it would be a more flexible
definition of the API allowing for easy addition of new bus types with DMA
capabilities. All the bus-specific magic would be hidden in the
architecture-specific implementations on platforms that require different
mappings for different buses, making the life of driver writers much
simpler. On systems in which everything is 1:1 mapped between physical,
PCI, and FooBuses, no changes would be required.
~Deepak
[1] From Documentation/DMA-API.txt in the 2.5 BK tree:
dma_addr_t
dma_map_single(struct device *dev, void *cpu_addr, size_t size,
enum dma_data_direction direction)
dma_addr_t
pci_map_single(struct device *dev, void *cpu_addr, size_t size,
int direction)
Maps a piece of processor virtual memory so it can be accessed by the
device and returns the _physical_ handle of the memory.
--
Deepak Saxena, Code Monkey - Ph:480.517.0372 Fax:480.517.0262
MontaVista Software - Powering the Embedded Revolution - www.mvista.com
next prev parent reply other threads:[~2003-02-28 18:07 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20030228064631.G23865@parcelfarce.linux.theplanet.co.uk.suse.lists.linux.kernel>
2003-02-28 8:56 ` Andi Kleen
2003-02-28 14:12 ` Matthew Wilcox
2003-02-28 15:24 ` Alan Cox
2003-02-28 14:34 ` Matthew Wilcox
2003-02-28 15:55 ` Alan Cox
2003-02-28 14:56 ` Andi Kleen
2003-02-28 15:25 ` Jeff Garzik
2003-02-28 15:30 ` Andi Kleen
2003-02-28 15:34 ` Martin J. Bligh
2003-02-28 15:49 ` Eli Carter
2003-02-28 16:03 ` Russell King
2003-02-28 16:45 ` Alan Cox
2003-02-28 15:31 ` Arjan van de Ven
2003-03-04 17:56 ` Rogier Wolff
2003-03-04 23:09 ` Alan Cox
2003-03-05 7:43 ` Rogier Wolff
2003-03-05 13:53 ` Alan Cox
2003-02-28 15:44 ` Dmitry A. Fedorov
2003-02-28 15:58 ` Jeff Garzik
2003-02-28 18:17 ` Deepak Saxena [this message]
2003-02-28 18:27 ` Deepak Saxena
2003-02-28 19:52 ` Russell King
[not found] ` <mailman.1046456425.7772.linux-kernel2news@redhat.com>
2003-02-28 20:51 ` Pete Zaitcev
2003-02-28 22:11 ` Russell King
2003-02-28 16:05 ` Russell King
2003-02-28 17:27 ` Ivan Kokshaysky
2003-02-28 17:45 ` Alan Cox
2003-02-28 6:46 Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030228181729.GA8366@xanadu.az.mvista.com \
--to=dsaxena@mvista.com \
--cc=D.A.Fedorov@inp.nsk.su \
--cc=jgarzik@pobox.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®