I have a SoC-FPGA(DE0-nano-soc) which contains an ARM-Cortex-A9 cpu with a Cyclone V FPGA on a single chip. the CPU has access to 1gb of DDR3 memory but the FPGA can also access this memory so they can share data.

Now I have configured linux to only see 900M of the total RAM using the boot parameter mem=900M. This way I have some RAM left linux doesn't touch that I can use to communicate with the FPGA. I want to write to that part of the RAM using /dev/mem. I get a permission denied error when I memory map the appropriate address, I am guessing this is because my kernel has CONFIG_STRICT_DEVMEM set.

Now I don't really want to unset this since I really only need to write to adresses which linux doesn't use. Is there a way to tell the linux kernel that it is fine to write to that specific part but the normal memory is still of limits?

1 Answer 1


I found this: https://docs.pmem.io/getting-started-guide/creating-development-environments/linux-environments/linux-memmap

Assuming you have a new enough kernel, adding memmap=124!900 should make the desired memory accessible as /dev/pmem0 .

It advises to also add nokaslr, otherwise you may get random system errors. KASLR is a security feature which makes it harder to exploit the kernel.

Although this has been used for fascinating hacks, I am not able to recommend it for your case. I do not know how to manage the CPU caches v.s. updates from the FPGA (aka DMA). And our advice on other questions is not to do this :-).

There's also another option, though it doesn't answer the question as written. I think you can boot with iomem=relaxed, if you wanted to temporarily disable STRICT_DEVMEM without compiling a whole new kernel.

  • 2
    In the end I will write a device driver to handle the access part. Reads/writes from FPGA to the RAM are non coherent so using the /dev/mem interface would have introduced issues anyway. But for now I just want to test the interface from both linux and from the FPGA so I know this is all wired up correctly. Then I will make a nice device driver :). Thank you for answering my question and pointing to relevant materials!
    – John Smith
    Apr 30, 2019 at 18:33
  • 1
    Just as a quick comment memmap=900!124 would reserve 900 at offset 124. I want to reserve 124 at offset 900 so the correct option would be memmap=124!900.
    – John Smith
    May 1, 2019 at 9:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .