I have a BRAM and DRAM blocks available on the FPGA side of the ZCU102 platform.
I would like to make them accessible for jailhouse cells. For instance, a BRAM block is mapped to the 0xa0000000 address.
To do that, I inserted this address into the root and non-root cell configurations as mem regions:
Non-root:
{
.phys_start = 0x00A0000000,
.virt_start = 0x00A0000000,
.size = 0x200000, //2MB
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE
},
Root:
{
.phys_start = 0x00A0000000,
.virt_start = 0x00A0000000,
.size = 0x200000, //2MB
.flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | JAILHOUSE_MEM_EXECUTE,
},
When I run the non-root cell and try to write into the address:
int *bram_ptr = (int *) 0x00A0000000;
*bram_ptr = 10;
I got an unhandled data write at 0xa0000000. What am I missing here in the configs?
Thanks
Giovani
I checked the array sizes and they are correct. num_memory_regions uses the ARRAY_SIZE macro:
.num_memory_regions = ARRAY_SIZE(config.mem_regions)
In Linux I can mmap and access the mapped region without errors.
Any other thought?
Is this because of this line in the mmu_cell.c?
size = MIN(region_size, NUM_TEMPORARY_PAGES * PAGE_SIZE);
Thus, is the maximum size of any memory region 1MB?
Yes, the fault is reported as well. This address is just another memory. 0xA00.. is the BRAM and 0x500.. is the DRAM. Both have the same faulty behavior when the size is 2MB.
DRAM: works with 1MB, 3MB, and 32MB.
does not work with 2MB.
BRAM (is limited to 2MB): works with 1MB, does not with 2MB.
IVSHMEM: tested with 1 and 2MB and worked in both cases.
Just tested these two attached and got:
Unhandled data write at 0x500000000(4)
FATAL: unhandled trap (exception class 0x24)
Cell state before exception:
pc: 0000000000006944 lr: 0000000000006944 spsr: 60000005 EL1
sp: 0000000000006870 esr: 24 1 1970045
x0: 0000000000000000 x1: 0000000000009670 x2: 0000000000000000
x3: 0000000000000004 x4: 00000000000027b8 x5: 0000000000000000
x6: 0000000000000000 x7: 0000000000000080 x8: 00000000000068b0
x9: 00000000000023e0 x10: 0000000000000000 x11: 0000000000009292
x12: 0000000000000000 x13: 0000000000000000 x14: 0000000000000020
x15: 0000000000000000 x16: 0000000000000000 x17: 0000000000000000
x18: 0000000000000000 x19: 0000000000001118 x20: 00000000000092cf
x21: 0000000800700000 x22: 0000000500000000 x23: 000000000000000a
x24: 0000000000000000 x25: 0000000000000000 x26: 0000000000000000
x27: 0000000000000000 x28: 0000000000000000 x29: 0000000000000000
Parking CPU 1 (Cell: "nfer")
Let me know if you want me to test on the real hardware once you have figure it out.