Hi All,

 

I am trying to allocate coherent memory for 33 MB in kerenl driver. and for that i have reserved CMA of 1024 MB, but from dmesg, i can see that address reserved for cma is different and what i get with dma_alloc_coherent is different. My pc is intel x86 machine and tried in different motherboard, but this issue is occuring in some specific PCs. please help me in debugging the actual issue, below are kernel bootup logs


[ 0.014362] No NUMA configuration found
[ 0.014363] Faking a node at [mem 0x0000000000000000-0x000000021edfffff]
[ 0.014374] NODE_DATA(0) allocated [mem 0x21edd5000-0x21edfffff]
[ 0.014538] cma: Reserved 400 MiB at 0x0000000205c00000
[ 0.014541] Reserving 640MB of memory at 2512MB for crashkernel (System RAM: 8046MB)
[ 0.014553] Zone ranges:
[ 0.014554] DMA [mem 0x0000000000001000-0x0000000000ffffff]
[ 0.014554] DMA32 [mem 0x0000000001000000-0x00000000ffffffff]
[ 0.014555] Normal [mem 0x0000000100000000-0x000000021edfffff]


at dma_alloc_coherent call
[ 27.816062] dev->dma_33M_addr is f8000000

---------------------------------------------------------------------------------------------------------------
and below are the logs in working case, at driver dma_alloc_coherent api call we have address which is in range of what reserved for cma.
at boot i get..
Faking a node at [mem 0x0000000000000000-0x000000019fdfffff]
NODE_DATA(0) allocated [mem 0x19fdd3000-0x19fdfdfff]
cma: Reserved 800 MiB at 0x000000016dc00000
Reserving 640MB of memory at 1792MB for crashkernel (System RAM: 6016MB)
Zone ranges:
DMA [mem 0x0000000000001000-0x0000000000ffffff]
DMA32 [mem 0x0000000001000000-0x00000000ffffffff]
Normal [mem 0x0000000100000000-0x000000019fdfffff]

at dma_alloc_coherent call
dev->dma_33M_addr is 16e200000

 

Please help me in solving this iissue, or can suggest any alternative way to allocate big coherent memory.

 

 

Regards,

Sathya