DRAM carveout

84 views
Skip to first unread message

Rob Barris

unread,
Mar 7, 2018, 11:54:45 AM3/7/18
to snickerdoodle forum
Is it possible to statically carve out some of the DRAM in the system, i.e. set the mem= bootarg such that (say) some N megabytes of physical contiguous DRAM are excluded from Linux's management ?

And if so, can a Linux process still find a way to map that physical memory and access it.. or does the former preclude the latter?


Rob Barris

unread,
Mar 7, 2018, 1:24:32 PM3/7/18
to snickerdoodle forum

Jamil Weatherbee

unread,
Mar 7, 2018, 1:36:15 PM3/7/18
to krtkl-sni...@googlegroups.com, rba...@gmail.com
Hi Rob,

Yes we do this all the time.  I’ve asked Bush to post the device tree instructions for it in the wiki and link back to here.  You can use /dev/mem for basic access from Linux or /dev/uio for access and interrupt service.

One thing to keep in mind is cache coherency.  Probably the most straightforward approach without digging too deep is to use the AXI ACP port for your DDR accesses from PL but this comes with a cost since the cache snoop unit is shared with the CPUs.

Hold tight and we will get the notes posted to the wiki.

-Jamil

Bush

unread,
Mar 8, 2018, 1:46:21 PM3/8/18
to snickerdoodle forum
Unfortunately, there doesn't appear to be a way to specify reserved memory regions using the boot arguments as you described. You can add a reserved memory region in the device tree. I have done this for testing a userspace I/O DMA driver which I have started documenting here. You should see the effect of this by reading the contents of /proc/meminfo

As Jamil noted, you can access the memory in the region you have set aside using /dev/mem or /dev/uio (if you also need interrupt support). Using /dev/mem requires the kernel be configured with CONFIG_STRICT_DEVMEM=n as it is normally dangerous. Using /dev/uio requires other device tree and boot arguments changes documented here

I have used a few different methods for handling memory transfers so let me know if you have any issues getting started or if you need more info.

Rob Barris

unread,
Mar 8, 2018, 6:04:36 PM3/8/18
to snickerdoodle forum
thanks much!  will check this out.

Reply all
Reply to author
Forward
0 new messages