kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Driver to allow DMA from user space
@ 2016-12-19 16:08 Ran Shalit
  2016-12-20  9:38 ` Greg KH
  0 siblings, 1 reply; 8+ messages in thread
From: Ran Shalit @ 2016-12-19 16:08 UTC (permalink / raw)
  To: kernelnewbies

Hello,

I want to use DMA from userspace.

I already use dma in kernel, and now I want can create a character
device which will be responsible for this.

The only problem is that I want to use the same memory which was
allocated in kernel with dma_alloc_coherent.

Is it correct to use mmap in order to use the phsyical memory which
was allocated with dma_alloc_coherent ?

If it's that simple it can be surely helpful, and the simple driver
which wraps dma_alloc_coherent can do the job for dmaing from
userspace.

In kernel:

dma_buffer_info->buf_info[i].virtAddr = (uint8_t *)dma_alloc_coherent(

                &ti667x_pci_dev[dev_id]->dev,

                dma_buffer_info->buffer_size,

                (dma_addr_t *)&dma_buffer_info->buf_info[i].pcieAddr,

                GFP_KERNEL);

In userspace:

buf_desc[i].virtAddr = mmap(0,

            size_of_buffer,

            PROT_READ | PROT_WRITE,

            MAP_SHARED,

            pcie_drv_inst[dsp_id].dev_desc,

            buf_desc[i].pcieAddr);

Thanks,
Ran

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-12-31 10:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-19 16:08 Driver to allow DMA from user space Ran Shalit
2016-12-20  9:38 ` Greg KH
2016-12-20 10:15   ` Ran Shalit
2016-12-20 10:26     ` Greg KH
2016-12-24 15:47       ` Ran Shalit
2016-12-25 12:37         ` Greg KH
2016-12-30 18:11           ` Ran Shalit
2016-12-31 10:55             ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).