Re: can device drivers return non-ram via vm_ops->nopage?
From: Jeff Garzik
Date: Sun Mar 21 2004 - 19:32:11 EST
William Lee Irwin III wrote:
int dma_mmap_coherent_sg(struct dma_scatterlist *sglist,
int nr_sglist_elements, /* length of sglist */
struct vm_area_struct *vma, /* for address space */
unsigned long address, /* user virtual address */
unsigned long offset, /* offset (in pages) */
unsigned long nr_pages); /* length (in pages) */
int dma_munmap_coherent_sg(struct dma_scatterlist *sglist,
int nr_sglist_elements, /* length of sglist */
struct vm_area_struct *vma, /* for address space */
unsigned long address, /* user virtual address */
unsigned long offset, /* offset (in pages) */
unsigned long nr_pages); /* length (in pages) */
int dma_alloc_coherent_sg(struct dma_scatterlist **sglist,
unsigned long length); /* length in pages */
int dma_free_coherent_sg(struct dma_scatterlist **sglist,
unsigned long length); /* length in pages */
No comment on struct dma_scatterlist, but the above is the most natural
API for audio drivers at least.
Audio drivers allocate buffers at ->probe() or open(2), and the only
entity that actually cares about the contents of the buffers are (a) the
hardware and (b) userland. via82cxxx_audio only uses
pci_alloc_consistent because there's not a more appropriate DMA
allocator for the use to which that memory is put.
Audio drivers only need to read/write the buffers inside the kernel when
implementing read(2) and write(2) via copy_{to,from}_user().
Jeff
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/