Page 1 of 1

shared memory between Linux root cell and erika cell on jetson tx2

Posted: Mon Jun 01, 2020 10:44 am
by Matt07
Hello,

I try to set up a shared memory between a Linux root cell and an erika cell on the jetson tx2,

I used this code for the erika cell : https://github.com/evidence/linux-jailh ... mem-demo.c

And on Linux I used this driver : https://github.com/henning-schild-work/ ... _ivshmem.c

and this user space application : https://github.com/henning-schild-work/ ... uio_send.c

On Erika side it's ok I am able to find pci devices and the connection seems established :

Code: Select all


Initializing unit: irqchip
Initializing unit: PCI
Adding virtual PCI device 00:00.0 to cell "Jetson-TX2"
Adding virtual PCI device 00:0f.0 to cell "Jetson-TX2"
Page pool usage after late setup: mem 101/16355, remap 101/131072
Activating hypervisor
Adding virtual PCI device 00:00.0 to cell "jetson-tx2-can"
Shared memory connection established: "jetson-tx2-can" <--> "Jetson-TX2"
Created cell "jetson-tx2-can"
Page pool usage after cell creation: mem 119/16355, remap 101/131072
Cell "jetson-tx2-can" can be loaded
Started cell "jetson-tx2-can"
IVSHMEM: Found 1af4:1110 at 00:00.0
IVSHMEM: shmem is at 0x0000000275000000
IVSHMEM: bar0 is at 0x0000000275001000
IVSHMEM: mapped shmem and bars, got position 0x0000000000000001
IVSHMEM: Hello from bare-metal ivshmem-demo inmate!!!
IVSHMEM: Enabled IRQ:0x14c
IVSHMEM: Enabling IVSHMEM_IRQs
IVSHMEM: Done setting up...
IVSHMEM: waiting for interrupt.

On Linux side I could insert the uio driver and I am able to see the files /dev/uio*, however the memory map fails in the user space program :

mmap failed (0x0xffffffffffffffff)

I found this jailhouse topic which talk about the same issue : https://groups.google.com/forum/#!topic ... O8v1z_-qWI

I changed the bar_mask as recommended in this post :

Memory mappings have to be page-aligned, /wrt the size and start
address. In order to make Linux reserve a full page for an MMIO resource
of some device (so that it can be handed out to userspace separately),
tune the bar_mask for the respective region. 0xfffff000, 0xffffffff, ...
should do the trick here.
but the memory map still fails.

Do you know how I could fix this issue ?

Thank you,

Best regards