On Monday, April 9, 2018 at 2:19:13 PM UTC+8, J. Kiszka wrote:
> On 2018-04-09 02:42, Qiu Shui wrote:
> > On Sunday, April 8, 2018 at 2:18:28 PM UTC+8, Qiu Shui wrote:
> >> On Sunday, April 8, 2018 at 11:29:01 AM UTC+8, Qiu Shui wrote:
> >>> On Monday, April 2, 2018 at 4:33:40 PM UTC+8, Qiu Shui wrote:
> >>>> On Monday, April 2, 2018 at 3:05:08 PM UTC+8, Nikhil Devshatwar wrote:
> >>>>> On Monday 02 April 2018 11:16 AM, Qiu Shui wrote:
> >>>>>> On Monday, April 2, 2018 at 11:12:12 AM UTC+8, Qiu Shui wrote:
> >>>>>>> On Thursday, March 29, 2018 at 1:09:46 PM UTC+8, Jan Kiszka wrote:
> >>>>>>>> On 2018-03-29 06:36, Qiu Shui wrote:
> >>>>>>>>> I build the armbian with these two patches to the kernel:
> >>>>>>>>> [1]
> >>>>>>>>> http://git.kiszka.org/?p=linux.git;a=commit;h=f057e9bb4ba2fca0b435d36893eb41ddd57b4208
> >>>>>>>>> [2]
> >>>>>>>>> http://git.kiszka.org/?p=linux.git;a=commit;h=1c926e27072d4cca76a756058554485067ce472b
> >>>>>>>>>
> >>>>>>>>> But when I build jailhouse with the armbian kernel source 
> >>>>>>>>> files(version: Linux orangepizero 4.16.0-rc6-sunxi #2 SMP Wed Mar 
> >>>>>>>>> 28 15:33:44 CST 2018 armv7l GNU/Linux), I got these warnings:
> >>>>>>>>> WARNING: "__stack_chk_fail" 
> >>>>>>>>> [/home/liu/project/kiszka/jailhouse-0.8/driver/jailhouse.ko] 
> >>>>>>>>> undefined!
> >>>>>>>>> WARNING: "__hyp_stub_vectors" 
> >>>>>>>>> [/home/liu/project/kiszka/jailhouse-0.8/driver/jailhouse.ko] 
> >>>>>>>>> undefined!
> >>>>>>>>> WARNING: "__stack_chk_guard" 
> >>>>>>>>> [/home/liu/project/kiszka/jailhouse-0.8/driver/jailhouse.ko] 
> >>>>>>>>> undefined!
> >>>>>>>>>
> >>>>>>>>> I have tried some google solutions but still not solved.
> >>>>>>>>>
> >>>>>>>>> Are there any suggestions?
> >>>>>>>>
> >>>>>>>> Regarding __hyp_stub_vectors: you also need
> >>>>>>>> http://git.kiszka.org/?p=linux.git;a=commitdiff;h=2a681cb2213e3ea0f142fae7345fb80208a88a53
> >>>>>>>>
> >>>>>>>> The other two issue seem to be related to some build inconsistency: 
> >>>>>>>> Your
> >>>>>>>> kernel was built without CONFIG_CC_STACKPROTECTOR, but when you build
> >>>>>>>> the Jailhouse module, this feature is considered to be enabled.
> >>>>>>>>
> >>>>>>>> Jan
> >>>>>>>
> >>>>>>> Thank you very much!
> >>>>>>> After two days trying, I've finally built the kernel and jailhouse 
> >>>>>>> module successfully.
> >>>>>>> (I am using armbian building scripts and modified the 
> >>>>>>> linux-sunxi-dev.config with "# CONFIG_THUMB2_KERNEL is not set")
> >>>>>>>
> >>>>>>> Now I can enable jailhouse and create cell:
> >>>>>>> # jailhouse enable configs/orangepi0.cell
> >>>>>>> # jailhouse cell create configs/orangepi0-gic-demo.cell
> >>>>>>> # jailhouse cell list
> >>>>>>> ID      Name                    State           Assigned CPUs         
> >>>>>>>   Failed CPUs
> >>>>>>> 0       Orange-Pi0              running         0,2-3
> >>>>>>> 1       orangepi0-gic-demo      shut down       1
> >>>>>>>
> >>>>>>> But when I load the gic-demo.bin, it failed:
> >>>>>>> # jailhouse cell load orangepi0-gic-demo 
> >>>>>>> inmates/demos/arm/gic-demo.bin
> >>>>>>> Unhandled data read at 0x1f00000(4)
> >>>>>>> FATAL: unhandled trap (exception class 0x24)
> >>>>>>> pc=0xc08cc6c0 cpsr=0x20000013 hsr=0x93830007
> >>>>>>> r0=0x00000190 r1=0x00020000 r2=0x0000a035 r3=0xcf807000
> >>>>>>> r4=0xcda54e10 r5=0xc1103d00 r6=0x00300402 r7=0xcd8d7480
> >>>>>>> r8=0x0002300c r9=0x00000285 r10=0x00000000 r11=0xcda47df4
> >>>>>>> r12=0x00300000 r13=0xcda47dd0 r14=0xc08c9ab8
> >>>>>>> Parking CPU 3 (Cell: "Orange-Pi0")
> >>>>>>> Cell "orangepi0-gic-demo" can be loaded
> >>>>>>>
> >>>>>>> Any suggestions would be greatly appreciated :)
> >>>>>>>
> >>>>>>> Is there any demo can be used to make sure my jailhouse environments 
> >>>>>>> are ready?
> >>>>>>>
> >>>>>>> Thanks!
> >>>>>>
> >>>>>> I solved this problem by trying some different memory configurations.
> >>>>>> The following does work:
> >>>>>> mem=448M vmalloc=256M
> >>>>>> /* Orangepi0.c */
> >>>>>>                .hypervisor_memory = {
> >>>>>>                        .phys_start = 0x5f800000,
> >>>>>>                        .size = 0x800000,
> >>>>>>                },
> >>>>>> ...
> >>>>>>                /* RAM */ {
> >>>>>>                        .phys_start = 0x40000000,
> >>>>>>                        .virt_start = 0x40000000,
> >>>>>>                        .size =        0x1f700000,
> >>>>>>                        .flags = JAILHOUSE_MEM_READ | 
> >>>>>> JAILHOUSE_MEM_WRITE |
> >>>>>>                                JAILHOUSE_MEM_EXECUTE,
> >>>>>>                },
> >>>>>>                /* IVSHMEM shared memory region */ {
> >>>>>>                        .phys_start = 0x5f700000,
> >>>>>>                        .virt_start = 0x5f700000,
> >>>>>>                        .size =         0x100000,
> >>>>>>                        .flags = JAILHOUSE_MEM_READ | 
> >>>>>> JAILHOUSE_MEM_WRITE,
> >>>>>>                },
> >>>>>> --------
> >>>>>>
> >>>>>> But if I use the following configuration. When I enable jailhouse, it 
> >>>>>> says "JAILHOUSE_ENABLE: Invalid argument".
> >>>>>> /* orangepi0.c */
> >>>>>>                .hypervisor_memory = {
> >>>>>>                        .phys_start = 0x5c000000,
> >>>>>>                        .size = 0x4000000,
> >>>>>>                },
> >>>>>> ......
> >>>>>>                /* RAM */ {
> >>>>>>                        .phys_start = 0x40000000,
> >>>>>>                        .virt_start = 0x40000000,
> >>>>>>                        .size =        0x1bf00000,
> >>>>>>                        .flags = JAILHOUSE_MEM_READ | 
> >>>>>> JAILHOUSE_MEM_WRITE |
> >>>>>>                                JAILHOUSE_MEM_EXECUTE,
> >>>>>>                },
> >>>>>>                /* IVSHMEM shared memory region */ {
> >>>>>>                        .phys_start = 0x5bf00000,
> >>>>>>                        .virt_start = 0x5bf00000,
> >>>>>>                        .size =         0x100000,
> >>>>>>                        .flags = JAILHOUSE_MEM_READ | 
> >>>>>> JAILHOUSE_MEM_WRITE,
> >>>>>>                },
> >>>>>> --------
> >>>>>> cat /proc/iomem
> >>>>>> 01c02000-01c02fff : dma-controller@1c02000
> >>>>>> 01c0f000-01c0ffff : mmc@1c0f000
> >>>>>> 01c10000-01c10fff : mmc@1c10000
> >>>>>> 01c19000-01c193ff : usb@1c19000
> >>>>>>    01c19000-01c193ff : usb@1c19000
> >>>>>> 01c19400-01c1942b : phy_ctrl
> >>>>>> 01c1a000-01c1a0ff : usb@1c1a000
> >>>>>> 01c1a400-01c1a4ff : usb@1c1a400
> >>>>>> 01c1a800-01c1a803 : pmu0
> >>>>>> 01c1b000-01c1b0ff : usb@1c1b000
> >>>>>> 01c1b400-01c1b4ff : usb@1c1b400
> >>>>>> 01c1b800-01c1b803 : pmu1
> >>>>>> 01c1c000-01c1c0ff : usb@1c1c000
> >>>>>> 01c1c400-01c1c4ff : usb@1c1c400
> >>>>>> 01c1c800-01c1c803 : pmu2
> >>>>>> 01c1d000-01c1d0ff : usb@1c1d000
> >>>>>> 01c1d400-01c1d4ff : usb@1c1d400
> >>>>>> 01c1d800-01c1d803 : pmu3
> >>>>>> 01c20000-01c203ff : clock@1c20000
> >>>>>> 01c20800-01c20bff : pinctrl@1c20800
> >>>>>> 01c20ca0-01c20cbf : watchdog@1c20ca0
> >>>>>> 01c28000-01c2801f : serial
> >>>>>> 01c30000-01c3ffff : ethernet@1c30000
> >>>>>> 01f00000-01f00053 : rtc@1f00000
> >>>>>> 01f01400-01f014ff : clock@1f01400
> >>>>>> 01f015c0-01f015c3 : codec-analog@1f015c0
> >>>>>> 01f02c00-01f02fff : pinctrl@1f02c00
> >>>>>> 40000000-5bffffff : System RAM
> >>>>>>    40008000-40ffffff : Kernel code
> >>>>>>    41100000-412296cb : Kernel data
> >>>>>> ---------
> >>>>>> I don't know what's wrong with the second cell configuration
> >>>>>
> >>>>> Make sure that the region described by .hypervisor_memory in the config 
> >>>>> matches with the
> >>>>> reserved_memory node in the root cell device tree.
> >>>>> EINVAL is possibly due to the mismatch in root cell DT and root cell 
> >>>>> config.
> >>>>>
> >>>>> Nikhil D
> >>>>>
> >>>>>>
> >>>>>> Thanks!
> >>>>>>
> >>>>
> >>>> After trying different parameters combination, I found that:
> >>>>          .hypervisor_memory = {
> >>>>                  .phys_start = 0x5f000000,
> >>>>                  .size = 0x1000000,
> >>>> where the "size" can not exceed "0x1000000".
> >>>
> >>> I want to use FreeRTOS on my second core. So I tried 
> >>> "https://github.com/siemens/freertos-cell.git"; project.
> >>> After some modifications, I finally reached these errors:
> >>> arm-linux-gnueabihf-ld -T lscript.lds -o freertos-demo.elf main.o 
> >>> boot_stub.o libfreertos.a
> >>> libfreertos.a(serial.o): In function `serial_irq_getchar':
> >>> serial.c:(.text+0xaa): undefined reference to `__printf_chk'
> >>> serial.c:(.text+0xbe): undefined reference to `__printf_chk'
> >>> serial.c:(.text+0xd4): undefined reference to `__printf_chk'
> >>> libfreertos.a(gic-v2.o): In function `gic_v2_init':
> >>> gic-v2.c:(.text+0x2c): undefined reference to `__printf_chk'
> >>> libfreertos.a(gic-v2.o): In function `gic_v2_irq_set_prio':
> >>> gic-v2.c:(.text+0xc4): undefined reference to `__printf_chk'
> >>> libfreertos.a(gic-v2.o):gic-v2.c:(.text+0xdc): more undefined references 
> >>> to `__printf_chk' follow
> >>> Makefile:49: recipe for target 'freertos-demo.elf' failed
> >>> make: *** [freertos-demo.elf] Error 1
> >>>
> >>> I have tried to include libc.a or libc.so by adding "-l" options to 
> >>> compiler but still failed.
> >>>
> >>> Are there any suggestions? 
> >>>
> >>> Thanks a lot!
> >>
> >> I changed the cross compiler from version "arm-linux-gnueabihf-gcc 
> >> (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609" to 
> >> "arm-linux-gnueabihf-gcc (Linaro GCC 7.2-2017.11) 7.2.1 20171011".
> >>
> >> The problem solved but I don't know why!
> > 
> > I can build and create cell for FreeRTOS. But when I load the 
> > "freertos-demo.bin",it said "JAILHOUSE_CELL_LOAD: Invalid argument". My 
> > cell config file attached. Are there any other parameters need to modify? 
> > Thanks a lot!
> 
> Your guest RAM region is ID-mapped, i.e. it starts at the same virtual
> address like its physical one. However, the reset address of the VCPU is
> 0, and that is also where jailhouse cell load puts artifacts by default.
> You need at least the startup stub of your cell at address 0, thus you
> need memory there.
> 
> ID-mapping for RAM may still make sense if you do DMA: the Orange PI
> lack a SMMU (IOMMU) to translate virtual to physical DMA addresses. If
> you don't do DMA, you are free with your guest virtual memory layout.
> 
> Jan
> 
> -- 
> Siemens AG, Corporate Technology, CT RDA IOT SES-DE
> Corporate Competence Center Embedded Linux

Thanks for your help! My OrangePi Zero does work.

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jailhouse-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to