User: Password:
|
|
Subscribe / Log in / New account

Re: DMA API issues

From:  Russell King <rmk+lkml-AT-arm.linux.org.uk>
To:  Takashi Iwai <tiwai-AT-suse.de>
Subject:  Re: DMA API issues
Date:  Wed, 23 Jun 2004 13:34:23 +0100
Cc:  Linus Torvalds <torvalds-AT-osdl.org>, Jeff Garzik <jgarzik-AT-pobox.com>, Matt Porter <mporter-AT-kernel.crashing.org>, Jamey Hicks <jamey.hicks-AT-hp.com>, Ian Molton <spyro-AT-f2s.com>, linux-kernel-AT-vger.kernel.org, greg-AT-kroah.com, tony-AT-atomide.com, david-b-AT-pacbell.net, joshua-AT-joshuawise.com

On Tue, Jun 22, 2004 at 12:40:45PM +0200, Takashi Iwai wrote:
> At Mon, 21 Jun 2004 20:26:39 -0700 (PDT),
> Linus Torvalds wrote:
> > 
> > On Mon, 21 Jun 2004, Linus Torvalds wrote:
> > > 
> > > The argument at some point was that some architectures may not even _have_
> > > a "struct page" for DMA memory, since it's not "normal" memory (ie "slow
> > > memory" on m68k). However, I thought we all agreed that such a "struct
> > > page" could be furnished if that architecture wants so support mmap'ing.
> > 
> > .. which is not to say that we shouldn't have a "pci_mmap_pages()" thing
> > _too_. Pretty clearly the easiest interface often is to just map the pages
> > at mmap() time, and then we should just have a helper function to do that. 
> > 
> > I thought we did one already, but hey, maybe not.
> 
> I don't think we have such.
> 
> Russell has once proposed a similar one (but not pci-specific), and I
> believe it makes sense for many drivers.  We can hide the
> architecture-specific cache handling inside the helper function, too.

Ok.  So does anyone have any objections if I push the ARM DMA mmap
interface upstream, which consists of:

/**
 * dma_mmap_coherent - map a coherent DMA allocation into user space
 * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices
 * @vma: vm_area_struct describing requested user mapping
 * @cpu_addr: kernel CPU-view address returned from dma_alloc_coherent
 * @handle: device-view address returned from dma_alloc_coherent
 * @size: size of memory originally requested in dma_alloc_coherent
 *
 * Map a coherent DMA buffer previously allocated by dma_alloc_coherent
 * into user space.  The coherent DMA buffer must not be freed by the
 * driver until the user space mapping has been released.
 */
int dma_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
                      void *cpu_addr, dma_addr_t handle, size_t size);

and a similar one for the ARM-specific "write combining" case (for
framebuffers utilising the DMA API)?

This was discussed on linux-arch, and the discussion died while trying
to settle on a suitable interface through apparant lack of interest.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


(Log in to post comments)


Copyright © 2004, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds