Can Epiphany cores access unmapped memory?

Any technical questions about the Epiphany chip and Parallella HW Platform.

Moderator: aolofsson

Can Epiphany cores access unmapped memory?

Postby alexrp » Mon Oct 07, 2013 8:15 am

So, I'm wondering if Epiphany cores are able to access any memory outside the local memory bank. I'm guessing the answer is "no" for obvious security reasons, but is there some way to expose the rest of the Parallella's system memory to the eMesh so that they aren't limited to 32 kB of memory (even if it means slower memory access)? It doesn't have to be permanent; if a process on the ARM system can do it for the duration of its lifetime, that's fine.
alexrp
 
Posts: 154
Joined: Mon Dec 17, 2012 3:22 am
Location: Thisted, Denmark

Re: Can Epiphany cores access unmapped memory?

Postby ysapir » Mon Oct 07, 2013 9:13 am

The Epiphany memory space is flat and global. On the Parallella, the eMesh shares the same space as the ARM CPU's.
User avatar
ysapir
 
Posts: 393
Joined: Tue Dec 11, 2012 7:05 pm

Re: Can Epiphany cores access unmapped memory?

Postby alexrp » Mon Oct 07, 2013 10:50 am

Me being a software person, I'm not completely clear on what that means. Does it mean that if I wanted to read some arbitrary memory location (not part of the eMesh's local memory space), I could? If yes, at that point I'm dealing in physical addressing, not virtual, correct?
alexrp
 
Posts: 154
Joined: Mon Dec 17, 2012 3:22 am
Location: Thisted, Denmark

Re: Can Epiphany cores access unmapped memory?

Postby ysapir » Mon Oct 07, 2013 11:27 pm

Your understanding is correct. At this time there's no OS available for the Epiphany that uses virtual memory. So, any address whose top 12 bits are != 0 will be routed outside of the core, and possibly outside of the chip. In effect, the ARM and the Epiphany share the same memory space (albeit, on the ARM you'll need to find your way to the physical address mapped to by the virtual address - which is done by the eHal driver).
User avatar
ysapir
 
Posts: 393
Joined: Tue Dec 11, 2012 7:05 pm

Re: Can Epiphany cores access unmapped memory?

Postby notzed » Tue Oct 08, 2013 6:45 am

ysapir wrote:Your understanding is correct. At this time there's no OS available for the Epiphany that uses virtual memory. So, any address whose top 12 bits are != 0 will be routed outside of the core, and possibly outside of the chip. In effect, the ARM and the Epiphany share the same memory space (albeit, on the ARM you'll need to find your way to the physical address mapped to by the virtual address - which is done by the eHal driver).


Currently there's a 32MB physically-contiguous shared space - isn't that defined by the kernel/bootup and/or the fpga registers though?

i.e. It's not like the epiphany can access all xGB of physical memory directly?
notzed
 
Posts: 331
Joined: Mon Dec 17, 2012 12:28 am
Location: Australia

Re: Can Epiphany cores access unmapped memory?

Postby alexrp » Tue Oct 08, 2013 7:22 am

ysapir wrote:Your understanding is correct. At this time there's no OS available for the Epiphany that uses virtual memory. So, any address whose top 12 bits are != 0 will be routed outside of the core, and possibly outside of the chip. In effect, the ARM and the Epiphany share the same memory space (albeit, on the ARM you'll need to find your way to the physical address mapped to by the virtual address - which is done by the eHal driver).

Okay, thanks! Does the eHAL library expose any function(s) I can use to translate a Linux virtual address into a physical address (from the ARM core)?
alexrp
 
Posts: 154
Joined: Mon Dec 17, 2012 3:22 am
Location: Thisted, Denmark

Re: Can Epiphany cores access unmapped memory?

Postby notzed » Wed Oct 09, 2013 1:05 am

alexrp wrote:
ysapir wrote:Your understanding is correct. At this time there's no OS available for the Epiphany that uses virtual memory. So, any address whose top 12 bits are != 0 will be routed outside of the core, and possibly outside of the chip. In effect, the ARM and the Epiphany share the same memory space (albeit, on the ARM you'll need to find your way to the physical address mapped to by the virtual address - which is done by the eHal driver).

Okay, thanks! Does the eHAL library expose any function(s) I can use to translate a Linux virtual address into a physical address (from the ARM core)?


e-hal maps the 32mb shared block (or portions of it) and lets you access it either directly or via the e-hal functions relative to the base address of the mapping.

It is at a fixed global location on the epiphany side (0x8e000000 on the p16 iirc).

e.g. if you "allocate" a block with an offset of 0x1000 and write to that on the arm, it will show up at 0x8e001000 on the epiphany side (on the parallella-16).

It gets a bit complicated with putting code/data into the global dram and with per-core malloc and so on, but it's all just sharing that single resource.

I guess it may be possible at some point in the future to implement a page-table based mmu in the fpga logic but there isn't such a beast there yet.
notzed
 
Posts: 331
Joined: Mon Dec 17, 2012 12:28 am
Location: Australia

Re: Can Epiphany cores access unmapped memory?

Postby alexrp » Wed Oct 09, 2013 8:29 am

notzed wrote:
alexrp wrote:
ysapir wrote:Your understanding is correct. At this time there's no OS available for the Epiphany that uses virtual memory. So, any address whose top 12 bits are != 0 will be routed outside of the core, and possibly outside of the chip. In effect, the ARM and the Epiphany share the same memory space (albeit, on the ARM you'll need to find your way to the physical address mapped to by the virtual address - which is done by the eHal driver).

Okay, thanks! Does the eHAL library expose any function(s) I can use to translate a Linux virtual address into a physical address (from the ARM core)?


e-hal maps the 32mb shared block (or portions of it) and lets you access it either directly or via the e-hal functions relative to the base address of the mapping.

It is at a fixed global location on the epiphany side (0x8e000000 on the p16 iirc).

e.g. if you "allocate" a block with an offset of 0x1000 and write to that on the arm, it will show up at 0x8e001000 on the epiphany side (on the parallella-16).

It gets a bit complicated with putting code/data into the global dram and with per-core malloc and so on, but it's all just sharing that single resource.

I guess it may be possible at some point in the future to implement a page-table based mmu in the fpga logic but there isn't such a beast there yet.

I'm talking about 'regular' memory on the ARM side. E.g. imagine I malloc a block of memory on the ARM side and want to store the pointer to that memory in an Epiphany register. I can't store the virtual address since the Epiphany cores strictly speak physical addresses, so I need a way to map the virtual address to the physical address on the ARM side, so I can store that physical address instead.
alexrp
 
Posts: 154
Joined: Mon Dec 17, 2012 3:22 am
Location: Thisted, Denmark

Re: Can Epiphany cores access unmapped memory?

Postby timpart » Wed Oct 09, 2013 11:35 am

alexrp wrote:I'm talking about 'regular' memory on the ARM side. E.g. imagine I malloc a block of memory on the ARM side and want to store the pointer to that memory in an Epiphany register. I can't store the virtual address since the Epiphany cores strictly speak physical addresses, so I need a way to map the virtual address to the physical address on the ARM side, so I can store that physical address instead.


I'm not sure how that would be possible. The ARM is running a multitasking operating system with virtual memory. If you obtain the physical address and give it to the Epiphany by the time it is used another task may have been swapped into that physical memory.

The area of shared DRAM is mapped to fixed addresses in the ARM memory map so it is stable. If you want heap style allocation I think there are currently no malloc look-alikes provided. There are malloc routines which run on the Epiphany and each core has its own area reserved in the shared (external) DRAM You wouldn't want to share that with the ARMs though as there is no mutex locking to guard against clashes.

Tim
timpart
 
Posts: 302
Joined: Mon Dec 17, 2012 3:25 am
Location: UK

Re: Can Epiphany cores access unmapped memory?

Postby ysapir » Wed Oct 09, 2013 12:08 pm

A few comments:

1. The "fixed" region is semi-fixed, as it is defined in the HDF file, which you process at the e_init() call. It can really be anywhere in the system, but on the Parallella we defined it to be excluded from the Linux' space, to serve as Epiphany's private DRAM.

2. There are two address ranges involved:

- 0x3e000000 - 0x3fffffff This space is the true, physical portion of the DRAM we assigned as EXT. MEM. This is the range you'd refer to from the ARM side

- 0x8e000000 - 0x8fffffff This is the same region, remapped to a different address range ("virtual", if you will) that you refer to from the Epiphany side.

The two regions are the same. You could actually used the "ARM" region from Epiphany and it will work, to some extent. Moreover, you could refer to any address in the physical space, even the Linux' memory, and it will work.

The reason for the distinction is that the current Epiphany chip on the Parallella has some limitation preventing it from accessing certain address ranges, some of which fall in the board's physical memory range. So, we implemented the remapping, to allow for a contiguous 32MB of addressable RAM. In future generations we anticipate this problem to be resolved, so 1:1 mapping would work just fine.

Accessing Linux' virtual space from the Epiphany is not possible directly (duh!), but you could possibly work around this by finding the physical address of the pointer allocated by malloc(). If you mmap() the Linux' memory, for example, you may have the base physical address for the virtual space, and from there the offset is easy to compute. You could then access this region from Epiphany, provided that it does not fall on one of those inaccessible "windows", and provided it was not relocated by the OS, like Tim mentions.
User avatar
ysapir
 
Posts: 393
Joined: Tue Dec 11, 2012 7:05 pm

Next

Return to Epiphany and Parallella Q & A

Who is online

Users browsing this forum: Google [Bot] and 6 guests

cron