02-11-2021, 09:30 PM
The CMA is for drivers that want to allocate large chunks of contiguous memory. Usually this is because the driver needs to DMA a lot of data and doesn't support scatter-gather. You can see how much CMA is free by looking at CmaFree in /proc/meminfo.
coherent_pool just sets the initial size of the coherent DMA pools. They will expand if needed if the kernel is new enough to have that feature, which I think is less than a year old. But this happens in the background, so there is some early value needed before the kernel is running processes to do the expanding, which is what this controls. So as long as the device drivers needed for booting have enough it shouldn't need to be increased.
The current size of the coherent pools can been seen in /sys/kernel/debug/dma_pools/pool_size_*. Mine PBP has them only at 512kB, which was the initial value.
The coherent pools are allocated from the CMA area, so if there is no CMA, then they can't be allocated.
It seems a bit surprising that setting both CMA and coherent to zero works. I'd guess that many something ignores the value of zero and treats that as a request to allocate the default. Or that nothing needs coherent on boot and it can be expanded if/when necessary, so there are no errors. Traditionally, ARM systems did not have coherent DMA prior to ARMv8, so there are probably not a lot of users in the code that runs on a PBP.
coherent_pool just sets the initial size of the coherent DMA pools. They will expand if needed if the kernel is new enough to have that feature, which I think is less than a year old. But this happens in the background, so there is some early value needed before the kernel is running processes to do the expanding, which is what this controls. So as long as the device drivers needed for booting have enough it shouldn't need to be increased.
The current size of the coherent pools can been seen in /sys/kernel/debug/dma_pools/pool_size_*. Mine PBP has them only at 512kB, which was the initial value.
The coherent pools are allocated from the CMA area, so if there is no CMA, then they can't be allocated.
It seems a bit surprising that setting both CMA and coherent to zero works. I'd guess that many something ignores the value of zero and treats that as a request to allocate the default. Or that nothing needs coherent on boot and it can be expanded if/when necessary, so there are no errors. Traditionally, ARM systems did not have coherent DMA prior to ARMv8, so there are probably not a lot of users in the code that runs on a PBP.