UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Participant rankeney
Participant
3,481 Views
Registered: ‎11-26-2014

Accessing bare-metal memory from Linux

I have an AMP system based on XAPP1078 with Linux in the first 768M and the bare-metal application running in the remaining 256M. I want the Linux application to access some of the memory in the bare-metal application range, but am having problems. For example, I can create a variable in bare metal and print it's address and fill it with some value. When I try to peek that address (300198A8), I see 0. I even wrote a program to scan all 1G of memory for the pattern written by the bare-metal application but cannot find it. Linux clearly sees some memory at 0x30000000-0x3fffffff, but it isn't what the bare-metal application sees. Any idea what's going on?

 

FWIW, I'm using Petalinux 2014.4.

 

Kernel command line: console=ttyPS1,115200 earlyprintk maxcpus=1 mem=768M

 

In my system-conf.dtsi I have:

        memory {

               device_type = "memory";

               reg = <0x0 0x30000000>;

        };

 

With reg = <0x0 0x40000000>; I saw the same result.

Do I need some additional device tree addition?

Or some call to Xil_SetTlbAttributes() in the bare-metal application to make the memory sharable?

 

Thanks!

0 Kudos
4 Replies
Highlighted
Xilinx Employee
Xilinx Employee
3,020 Views
Registered: ‎09-10-2008

Re: Accessing bare-metal memory from Linux

This a good application for a UIO driver in Linux and there's plenty of information on how to do that. The Linux application has to map the memory into it's address space thru some kind of driver. UIO will treat the memory as I/O uncached memory so it won't be high performance.

Thanks
John
0 Kudos
Adventurer
Adventurer
1,900 Views
Registered: ‎11-05-2014

Re: Accessing bare-metal memory from Linux

@linnj Do you know what would be the alternative(s) for higher performance than UIO?

0 Kudos
Participant jsara
Participant
1,655 Views
Registered: ‎08-14-2015

Re: Accessing bare-metal memory from Linux

You can just use mmap() in linux and map the memory.  It is uncached so very low performance, BUT it is possible to use NEON instructions to block copy the uncached to a cached area and then access the copy (or vice versa).

0 Kudos
Participant jsara
Participant
1,654 Views
Registered: ‎08-14-2015

Re: Accessing bare-metal memory from Linux

Also note that according to UG1079, when you define USE_AMP it messes up the virtual to physical mapping for core 1 so the logical address may not match the physical address.

0 Kudos