From: David Brownell <david-b@pacbell.net>
To: James Bottomley <James.Bottomley@steeleye.com>
Cc: Ian Molton <spyro@f2s.com>,
Linux Kernel <linux-kernel@vger.kernel.org>,
tony@atomide.com, jamey.hicks@hp.com, joshua@joshuawise.com,
Russell King <rmk@arm.linux.org.uk>
Subject: Re: [RFC] on-chip coherent memory API for DMA
Date: Thu, 01 Jul 2004 07:12:49 -0700 [thread overview]
Message-ID: <40E41BE1.1010003@pacbell.net> (raw)
In-Reply-To: <1088518868.1862.18.camel@mulgrave>
James Bottomley wrote:
>
> dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
> dma_addr_t device_addr, size_t size, int flags)
>
> ...
>
> The flags is where all the magic is. They can be or'd together and are
>
> DMA_MEMORY_MAP - request that the memory returned from
> dma_alloc_coherent() be directly writeable.
>
> DMA_MEMORY_IO - request that the memory returned from
> dma_alloc_coherent() be addressable using read/write/memcpy_toio etc.
The API looked OK except this part didn't make sense to me, since
as I understand things dma_alloc_coherent() is guaranteed to have
the DMA_MEMORY_MAP semantics at all times ... the CPU virtual address
returned may always be directly written. That's certainly how all
the code I've seen using dma_alloc_coherent() works.
It'd make more sense if the routine were "dma_declare_memory()", and
DMA_MEMORY_MAP meant it was OK to return from dma_alloc_coherent(),
while DMA_MEMORY_IO meant the dma_alloc_coherent() would always fail.
If I understand what you're trying to do, DMA_MEMORY_IO supports a
new kind of DMA memory, and is necessary to work on those IBM boxes
you were talking about ... where dma_alloc_coherent() can't work,
and the "indirectly accessible" memory would need to be allocated
using some new alloc/free API. Or were you maybe trying to get at
that "can be mmapped to userspace" distinction?
Also in terms of implementation, I noticed that if there's a
dev->dma_mem, the GFP_* flags are ignored. For __GFP_NOFAIL
that seems buglike, but not critical. (Just looked at x86.)
Might be worth just passing the flags down so that behavior
can be upgraded later.
- Dave
next prev parent reply other threads:[~2004-07-01 14:16 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-29 14:21 [RFC] on-chip coherent memory API for DMA James Bottomley
2004-07-01 12:43 ` Jamey Hicks
2004-07-01 14:12 ` David Brownell [this message]
2004-07-01 14:26 ` James Bottomley
2004-07-01 14:45 ` David Brownell
2004-07-01 18:04 ` James Bottomley
2004-07-01 20:14 ` David Brownell
2004-07-01 20:48 ` James Bottomley
2004-07-02 3:07 ` David Brownell
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=40E41BE1.1010003@pacbell.net \
--to=david-b@pacbell.net \
--cc=James.Bottomley@steeleye.com \
--cc=jamey.hicks@hp.com \
--cc=joshua@joshuawise.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk@arm.linux.org.uk \
--cc=spyro@f2s.com \
--cc=tony@atomide.com \
/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