AnsweredAssumed Answered

DMA usage at linux kernel - B4860 (fsl BSP)

Question asked by Itzik Chaimov on Jul 14, 2019
Latest reply on Jul 20, 2019 by Yiping Wang


I am trying to write a kernel driver which copies a large buffer (say 25KB in length) from user space into kernel space with a final destination to the PCIe EP (endpoint) device which is an FPGA device having a memory FIFO to be written into.

I am using an old kernel linux: 3.8.13 

The DMA allocation should be consistent/coherent DMA mapping.

Already written in driver:

//check if core device has properly DMA access:

if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)))

{ ... }

else if (!pci_set_dma_mask(pdev, DMA_BIT_MASK(32)))

{ ... }


{  ... //no suitable DMA avilable... }


dma_buffer = pci_alloc_consistent(pdevice, BUFFER_SIZE, &dma_bus);


// at the ioctl function:


memcpy(dma_buffer, &WriteBuffer.Buffer[0], BUFFER_SIZE);




Please your advice - why the memcpy() function does not copy the content of the buffer into the DMA allocated buffer?