Experimenting the vm-tz example on the Freescale i.mx6 SDB

Mahdi Aichouch foxmehdi at gmail.com
Wed Apr 8 14:13:47 CEST 2015


Hello Adam,

Thank you very much for your answer and explanation.

The call to "l4sigma0_map_iomem(sigma0_cap.cap(), Ram_base, Ram_base,
ram_size, 1)"
failed at the first page that it tries to map.

I activated the debug flags in pkg/sigma0/server/src/globals.h.

And I get the debug messages include in the attached file. But based on the
debug messages
it is difficult to interpret what might be wrong.
Could you please take a look at the logs in the attached file and tell me
what do you think.

Thank you again for your help.

Best Regards,

Mahdi
















On Wed, Apr 1, 2015 at 11:36 AM, Mahdi Aichouch <foxmehdi at gmail.com> wrote:

> Hello Adam,
>
> I tried to do as you suggested, and I added a loop in order to map a small
> chunk of memory at time.
>
> When I tried to map 1 KB at a time and 2 KB at a time, I received this
> error from the first call to
>  l4sigma0_map_iomem ( ) function:
>
> ...
> Vmm started
> j = 0 addr = 0x0
> Cannot map nonsecure memory Phys, virt or size not aligned
> ...
>
> Then, I tried to add 4KB at a time, and I received the same error as
> before at the first call to
> the l4sigma0_map_iomem ( ) function, that is:
>
> ...
> Vmm started
> j = 0 addr = 0x0
> Cannot map nonsecure memory No fpage received
> ...
>
>
> I also tried with 4 KB, 8 KB, 16 KB, 32 KB,...
> I get the same error: "No fpage received"
>
>
> This is the code of the loop that I added:
>
>   int ram_size = 0x1000; //4 KB
>
>
>   int address  = 0x0;
>   int j;
>   for(j = 0; j < 256; j++) {
>     fault = l4sigma0_map_iomem(sigma0_cap.cap(), Ram_base, Ram_base,
> ram_size, 1);
>     printf("j = %d addr = 0x%x\n", j, address);
>     address += ram_size;
>     if (fault) {
>       printf("Cannot map nonsecure memory %s\n",
> l4sigma0_map_errstr(fault));
>       exit(1);
>     }
>   }
>
>
> Could you please tell me what else should I check to track down the source
> of the error.
> Thank you very much in advance.
>
> Kindest regards,
>
> Mahdi
>
> PS: I attached the main.cc file of my vm-tz example.
>
>
>
>
>
>
>
>
> On Wed, Mar 25, 2015 at 10:19 AM, Mahdi Aichouch <foxmehdi at gmail.com>
> wrote:
>
>> Hello Adam,
>>
>> Thank you again for your answer.
>>
>> Please find below the execution's log from the start of L4 kernel until
>> the stop of the vm-tz test:
>>
>> L4 Bootstrapper
>>   Build: #21 Tue Mar 17 15:28:32 CET 2015, 4.8.3 20140320 (prerelease)
>>   Scanning up to 1024 MB RAM, starting at offset 32MB
>>   Memory size is 1024MB (10000000 - 4fffffff)
>>   RAM: 0000000010000000 - 000000004fffffff: 1048576kB
>>   Total RAM: 1024MB
>>   Scanning fiasco
>>   Scanning sigma0
>>   Scanning moe
>>   Moving up to 5 modules behind 11100000
>>   moving module 02 { 110a6000-110df63f } -> { 11196000-111cf63f } [235072]
>>   moving module 01 { 1109c000-110a538b } -> { 1118c000-1119538b } [37772]
>>   moving module 00 { 11044000-1109bb17 } -> { 11134000-1118bb17 } [359192]
>>   moving module 04 { 1102a000-1104365b } -> { 1111a000-1113365b } [104028]
>>   moving module 03 { 11010000-11029473 } -> { 11100000-11119473 } [103540]
>>   Loading fiasco
>>   Loading sigma0
>>   Loading moe
>>   find kernel info page...
>>   found kernel info page at 0x10002000
>> Regions of list 'regions'
>>     [ 10000000,  100000e3] {       e4} Root   mbi_rt
>>     [ 10001000,  10001aff] {      b00} Kern   fiasco
>>     [ 10002000,  10066fff] {    65000} Kern   fiasco
>>     [ 10090000,  10096edf] {     6ee0} Sigma0 sigma0
>>     [ 10098000,  1009e177] {     6178} Sigma0 sigma0
>>     [ 10140000,  10171d77] {    31d78} Root   moe
>>     [ 10178000,  101934ab] {    1b4ac} Root   moe
>>     [ 11000000,  1100f4ff] {     f500} Boot   bootstrap
>>     [ 11100000,  11133fff] {    34000} Root   Module
>>   API Version: (87) experimental
>>   Sigma0 config    ip:10090100 sp:00000000
>>   Roottask config  ip:10140260 sp:00000000
>>   Starting kernel fiasco at 100012c8
>> Number of IRQs available at this GIC: 160
>> FPU0: Arch: VFPv3(3), Part: VFPv3(30), r: 4, v: 9, i: 41, t: hard, p:
>> dbl/sngl
>> L2: ID=410000c7 Type=9e340340 Aux=02070000 WMask=ffff S=0
>> L2: Type L2C-310 Size = 1024kB  Ways=16 Waysize=64
>> GIC: Switching IRQ 58 to secure
>> SERIAL ESC: allocated IRQ 58 for serial uart
>> Not using serial hack in slow timer handler.
>> Welcome to Fiasco.OC (arm)!
>> L4/Fiasco.OC arm microkernel (C) 1998-2013 TU Dresden
>> Rev: rexported compiled with gcc 4.8.3 for i.MX6    []
>> Build: #4 Tue Mar 17 14:55:01 CET 2015
>>
>> GIC: Switching IRQ 29 to secure
>> Calibrating timer loop... done.
>> MDB: use page size: 20
>> MDB: use page size: 12
>> SIGMA0: Hello!
>>   KIP @ 10002000
>>   allocated 4KB for maintenance structures
>> SIGMA0: Dump of all resource maps
>> RAM:------------------------
>> [4:10000000;10000fff]
>> [0:10067000;1008ffff]
>> [0:10097000;10097fff]
>> [0:1009f000;1013ffff]
>> [4:10140000;10171fff]
>> [0:10172000;10177fff]
>> [4:10178000;10193fff]
>> [0:10194000;110fffff]
>> [4:11100000;11133fff]
>> [0:11134000;4effffff]
>> IOMEM:----------------------
>> [0:0;fffffff]
>> [0:50000000;ffffffff]
>> MOE: Hello world
>> MOE: found 1031204 KByte free memory
>> MOE: found RAM from 10000000 to 4f000000
>> MOE: allocated 1008 KByte for the page array @0x10194000
>> MOE: virtual user address space [0-bfffffff]
>> MOE: rom name space cap -> [C:501000]
>>   BOOTFS: [11100000-11119474] [C:503000] l4re
>>   BOOTFS: [1111a000-1113365c] [C:504000] vm-tz
>> MOE: cmdline: moe --init=rom/vm-tz
>> MOE: Starting: rom/vm-tz
>> MOE: loading 'rom/vm-tz'
>> Vmm started
>> Cannot map nonsecure memory No fpage received
>> MOE: task 270000679 exited with 1
>>
>>
>>
>> Kindest regards,
>>
>> Mahdi
>>
>>
>> On Mon, Mar 23, 2015 at 11:33 AM, Mahdi Aichouch <foxmehdi at gmail.com>
>> wrote:
>>
>>> Hello Adam,
>>>
>>> Thank you very much for your answer!
>>>
>>> I configured the Ram_base to 0x20000000 for the normal-world OS and the
>>> Ram_size to
>>> 0x10000000 (256 MB).
>>>
>>> The secure world OS is loaded at 0x10000000 according to the link
>>> address of fiasco
>>> kernel on the i.mx6, and has 256 MB of Ram.
>>>
>>> When I start the vm-tz example, the reserve_area( ) method is executed
>>> successfully,
>>>
>>> ...
>>>
>>> l4_addr_t v = Ram_base;
>>> L4Re::chksys(env->rm()->reserve_area(&v, Ram_size, L4Re::Rm::Reserved));
>>>
>>> fault = l4sigma0_map_iomem(sigma0_cap.cap(), Ram_base, Ram_base,
>>> Ram_size, 1);
>>> if (fault) {
>>>    printf("Cannot map nonsecure memory: %s\n",
>>> l4sigma0_map_errstr(fault));
>>>    exit(1);
>>> }
>>>
>>> ...
>>>
>>> but the l4sigma0_map_iomem( ) returns an error:
>>>
>>> ...
>>> Vmm started
>>> Cannot map nonsecure memory No fpage received
>>> MOE: task 270000679 exited with 1
>>>
>>> Then the programs stops executing, the setup_linux(vmstate) function is
>>> not
>>> executed, and the ATAG data structure is not copied.
>>>
>>> Do you have an idea of what might cause this fault.
>>>
>>> Thank you very much in advance.
>>>
>>> Best regars,
>>> Mahdi
>>>
>>>
>>>
>>> On Fri, Mar 20, 2015 at 9:48 AM, Mahdi Aichouch <foxmehdi at gmail.com>
>>> wrote:
>>>
>>>> Hello,
>>>>
>>>> I am trying to test the "vm-tz", and I created a new entry in the
>>>> "/src/l4/conf/modules.list".
>>>>
>>>> entry tz_vm
>>>> roottask moe --init=rom/vm-tz
>>>> module l4re
>>>> module vm-tz
>>>>
>>>> Is my entry correct? Or there is some missing modules?
>>>> How to know what modules should be included?
>>>>
>>>> Does someone has a successful running configuration.
>>>> Is it possible to share with us a working configuration.
>>>>
>>>> Thank you very much in advance.
>>>>
>>>> Best regards,
>>>>
>>>> Mahdi
>>>>
>>>>
>>>>
>>>>
>>>> On Tue, Mar 17, 2015 at 4:39 PM, Mahdi Aichouch <foxmehdi at gmail.com>
>>>> wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> I was able to correct the error related to the creation of the VM, by
>>>>> recompiling the fiasco kernel using
>>>>> the "trustzone secure side" as an Execution Model option instead of
>>>>> the "Standard Mode".
>>>>>
>>>>> Now the code goes further and it stops at
>>>>>
>>>>> l4sigma0_map_iomem(sigma0_cap.cap(), Ram_base, Ram_base, Ram_size, 1);
>>>>>
>>>>> which return the following error:
>>>>>
>>>>> MOE: Hello world
>>>>> MOE: found 1031204 KByte free memory
>>>>> MOE: found RAM from 10000000 to 4f000000
>>>>> MOE: allocated 1008 KByte for the page array @0x10194000
>>>>> MOE: virtual user address space [0-bfffffff]
>>>>> MOE: rom name space cap -> [C:501000]
>>>>>   BOOTFS: [11100000-11119474] [C:503000] l4re
>>>>>   BOOTFS: [1111a000-1113365c] [C:504000] vm-tz
>>>>> MOE: cmdline: moe --init=rom/vm-tz
>>>>> MOE: Starting: rom/vm-tz
>>>>> MOE: loading 'rom/vm-tz'
>>>>> Vmm started
>>>>> Cannot map nonsecure memory No fpage received
>>>>>
>>>>> I used the same memory parameters of the example, that is,
>>>>> the RAM base of the non secure world is 0x20000000, and
>>>>> the RAM size is 0x00100000.
>>>>>
>>>>> Could someone help me to correct this.
>>>>>
>>>>> Thank you very much in advance.
>>>>>
>>>>> Best regards,
>>>>> Mahdi
>>>>>
>>>>>
>>>>> On Tue, Mar 17, 2015 at 2:46 PM, Mahdi Aichouch <foxmehdi at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>> I am trying to experiment the "vm-tz" example on the Freescale i.mx6
>>>>>> SDB board.
>>>>>>
>>>>>> At first, my goal is to understand the example, thus I am interested
>>>>>> in running
>>>>>> a simple test kernel instead of a full linux kernel.
>>>>>>
>>>>>> Specifically, I am trying to reproduce the experimentation of the
>>>>>> article related to the trustzone
>>>>>> implementation on Fiasco.OC L4re, "ARM Trustzone as a Virtualization
>>>>>> Technique in Embedded Systems".
>>>>>> In particular, it is mentioned in the article at the "Implementation"
>>>>>> paragraph that "Multiplexing two or more OS is supported by our design."
>>>>>> I would like to investigate this point.
>>>>>>
>>>>>> I created a new entry to generate the vm-tz binary.
>>>>>> I added the following entry to the "src/l4/conf/modules.list" file :
>>>>>>
>>>>>> entry tz_vm
>>>>>> roottask moe --init=rom/vm-tz
>>>>>> module l4re
>>>>>> module vm-tz
>>>>>>
>>>>>> Is my configuration entry correct, is there any missing modules that
>>>>>> are required by the example?
>>>>>>
>>>>>> I tested the binary on the board using tftp, and I obtained the
>>>>>> following results:
>>>>>>
>>>>>> L4 Bootstrapper
>>>>>>   Build: #12 Tue Mar 17 12:10:02 CET 2015, 4.8.3 20140320 (prerelease)
>>>>>>   Scanning up to 1024 MB RAM, starting at offset 32MB
>>>>>>   Memory size is 1024MB (10000000 - 4fffffff)
>>>>>>   RAM: 0000000010000000 - 000000004fffffff: 1048576kB
>>>>>>   Total RAM: 1024MB
>>>>>>   Scanning fiasco
>>>>>>   Scanning sigma0
>>>>>>   Scanning moe
>>>>>>   Moving up to 5 modules behind 11100000
>>>>>>   moving module 02 { 110a5000-110de63f } -> { 11195000-111ce63f }
>>>>>> [235072]
>>>>>>   moving module 01 { 1109b000-110a438b } -> { 1118b000-1119438b }
>>>>>> [37772]
>>>>>>   moving module 00 { 11044000-1109a0c7 } -> { 11134000-1118a0c7 }
>>>>>> [352456]
>>>>>>   moving module 04 { 1102a000-11043597 } -> { 1111a000-11133597 }
>>>>>> [103832]
>>>>>>   moving module 03 { 11010000-11029473 } -> { 11100000-11119473 }
>>>>>> [103540]
>>>>>>   Loading fiasco
>>>>>>   Loading sigma0
>>>>>>   Loading moe
>>>>>>   find kernel info page...
>>>>>>   found kernel info page at 0x10002000
>>>>>> Regions of list 'regions'
>>>>>>     [ 10000000,  100000e3] {       e4} Root   mbi_rt
>>>>>>     [ 10001000,  10001aff] {      b00} Kern   fiasco
>>>>>>     [ 10002000,  10062fff] {    61000} Kern   fiasco
>>>>>>     [ 10090000,  10096edf] {     6ee0} Sigma0 sigma0
>>>>>>     [ 10098000,  1009e177] {     6178} Sigma0 sigma0
>>>>>>     [ 10140000,  10171d77] {    31d78} Root   moe
>>>>>>     [ 10178000,  101934ab] {    1b4ac} Root   moe
>>>>>>     [ 11000000,  1100f4ff] {     f500} Boot   bootstrap
>>>>>>     [ 11100000,  11133fff] {    34000} Root   Module
>>>>>>   API Version: (87) experimental
>>>>>>   Sigma0 config    ip:10090100 sp:00000000
>>>>>>   Roottask config  ip:10140260 sp:00000000
>>>>>>   Starting kernel fiasco at 100012c8
>>>>>> Number of IRQs available at this GIC: 160
>>>>>> FPU0: Arch: VFPv3(3), Part: VFPv3(30), r: 4, v: 9, i: 41, t: hard, p:
>>>>>> dbl/sngl
>>>>>> L2: ID=410000c7 Type=9e340340 Aux=02070000 WMask=ffff S=0
>>>>>> L2: Type L2C-310 Size = 1024kB  Ways=16 Waysize=64
>>>>>> SERIAL ESC: allocated IRQ 58 for serial uart
>>>>>> Not using serial hack in slow timer handler.
>>>>>> Welcome to Fiasco.OC (arm)!
>>>>>> L4/Fiasco.OC arm microkernel (C) 1998-2013 TU Dresden
>>>>>> Rev: rexported compiled with gcc 4.8.3 for i.MX6    []
>>>>>> Build: #3 Wed Mar 11 16:43:41 CET 2015
>>>>>>
>>>>>> Calibrating timer loop... done.
>>>>>> MDB: use page size: 20
>>>>>> MDB: use page size: 12
>>>>>> SIGMA0: Hello!
>>>>>>   KIP @ 10002000
>>>>>>   allocated 4KB for maintenance structures
>>>>>> SIGMA0: Dump of all resource maps
>>>>>> RAM:------------------------
>>>>>> [4:10000000;10000fff]
>>>>>> [0:10063000;1008ffff]
>>>>>> [0:10097000;10097fff]
>>>>>> [0:1009f000;1013ffff]
>>>>>> [4:10140000;10171fff]
>>>>>> [0:10172000;10177fff]
>>>>>> [4:10178000;10193fff]
>>>>>> [0:10194000;110fffff]
>>>>>> [4:11100000;11133fff]
>>>>>> [0:11134000;4effffff]
>>>>>> IOMEM:----------------------
>>>>>> [0:0;fffffff]
>>>>>> [0:50000000;ffffffff]
>>>>>> MOE: Hello world
>>>>>> MOE: found 1031220 KByte free memory
>>>>>> MOE: found RAM from 10000000 to 4f000000
>>>>>> MOE: allocated 1008 KByte for the page array @0x10194000
>>>>>> MOE: virtual user address space [0-bfffffff]
>>>>>> MOE: rom name space cap -> [C:501000]
>>>>>>   BOOTFS: [11100000-11119474] [C:503000] l4re
>>>>>>   BOOTFS: [1111a000-11133598] [C:504000] vm-tz
>>>>>> MOE: cmdline: moe --init=rom/vm-tz
>>>>>> MOE: Starting: rom/vm-tz
>>>>>> MOE: loading 'rom/vm-tz'
>>>>>> Vmm started
>>>>>> terminate called after throwing an instance of 'N2L413Runtime_errorE'
>>>>>> MOE: task 270000679 exited with 127
>>>>>>
>>>>>> The code stops at the beginning when it tries to create a VM :
>>>>>>
>>>>>> L4Re::chksys(env->factory()->create_vm(vm));
>>>>>>
>>>>>> After reading through the code, I saw that the code example is
>>>>>> expecting a linux-image and an initrd to be provided. Is it possible to
>>>>>> tell me where these should be added in the build directory? In my test
>>>>>> case, the linux-image will be replaced by a simple kernel image.
>>>>>>
>>>>>> Could someone help me to correct my test case.
>>>>>>
>>>>>> Many thanks in advance.
>>>>>>
>>>>>> Best regards,
>>>>>> Mahdi
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://os.inf.tu-dresden.de/pipermail/l4-hackers/attachments/20150408/3f56b8b1/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: l4_tz_vmm_debug.log
Type: text/x-log
Size: 25521 bytes
Desc: not available
URL: <http://os.inf.tu-dresden.de/pipermail/l4-hackers/attachments/20150408/3f56b8b1/attachment-0001.bin>


More information about the l4-hackers mailing list