Is there any way to allocate exact physical memory address with caching in ubuntu?

343 views Asked by At

I want to allocate a fixed sized buffer in a physical memory location that would be exactly same across different runs.

void * getBuffer(size_t len, uintptr_t paddr);

So this function getBuffer(len,paddr) should allocate a buffer of len at the exact physical address paddr

So far I have seen the usage of "/dev/mem" based memory allocation that uses DMA, but this does not follow the cache access pattern according to this, this and others. (Please correct me here if I am wrong.)

But I want make sure that the memory access from the getBuffer() follows regular CPU cache patterns. i.e, the access is goes through L1, L2 and L3 cache and finally write/reads the memory.

Please let me know if this is possible. If not, is there any other way of accessing a fixed physical address? Feel free to share!

0

There are 0 answers