This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5728: Linux/AM5728 How to convert the virtual address of DRM memory to the physical address

Part Number: AM5728

I‘m using PSDK Linux v6.00.00.07 on AM5728-EVM.

 

I'm trying to implement DMA transfer from CMEM memory to DRM memory by using kernel DMA engine on Linux.

But I cannot figure out how to convert virtual address of the DRM memory to the physical address, and cannot do DMA transfer.

 

DMA transfer from CMEM memory to CMEM memory has been already achieved by acquiring the physical address by using the CMEM memory acquisition API (CMEM_getPhys).

 

But problem is, when I tried same method for DRM memory converting virtual address to physical address, it fails and cannot convert it to physical address.

 

Please advise how to convert the virtual address of DRM memory to the physical address.

  • Hello,

    Please note that DRM/GEM was written to handle non-contiguous memory as well. It is generally a good idea to use the standard framework (drm/cma/dmabuf) functions to handle the mapping as they can handle the underlying scatter gather table (sg_table) and map accordingly. There are some helper functions like drm_prime_sg_to_page_addr_arrays that can convert sg_table to array of pages but we do not use these. We recommend that you look at drivers/gpu/drm in the kernel. You can start with drm_gem_cma_helper.c.

    The general way of sharing buffers between allocators and consumers is using dma_buf. Dma_buf mapping APIs can take care of required mapping for DMA. Please take a look at this:

    https://01.org/linuxgraphics/gfx-docs/drm/driver-api/dma-buf.html

    Regards

    Hemant