Boot Hyp mode in elfloader
I am trying to boot CAmkES-ARM-VM and got problem in elfloader. I tested Jetson-TK1 and TK1-SOM. The results are same. I've set bootm_boot_mode=nonsec in u-boot and tracked registers in function switch_to_hyp_mode(). 1) Enter switch_to_hyp_mode(), after asm volatile ("mrc p15, 0, %0, c1, c1, 0":"=r"(scr)); ==> scr == 0x100, in which NS==0, HCE==1, SCD==0, SIF==0 2) Then switch_to_hyp_mode() changes NS to 1, so scr==0x101 asm volatile ("mcr p15, 0, %0, c1, c1, 0"::"r"(scr)); 3) switch_to_hyp_mode() changes cpsr to Hyp mode asm volatile ("cps %0\n\t" "isb\n" ::"I"(HYPERVISOR_MODE)); 4) The final step, switch_to_hyp_mode() reads cpsr, asm volatile ("mrs %0, cpsr":"=r"(scr)); ==> scr == 0x6000001da, in which cpsr.M==0x1a, cpsr.I==1, cpsr.F==1, cpsr.A==1 Finally, the process died here. My questions are, 1) Are NS==0 and HCE==1 correct when entering switch_to_hyp_mode() ? 2) Is the final status (cpsr.F==cpsr.I==cpsr.A==1) expected? 3) Any other mistake I might make? Yao
Hi Yao, Can you confirm in the build configuration that 'seL4 mode' is set to 'Load the seL4 kernel in hypervisor mode (NS))' and 'Install hooks in monitor mode' in set? These should be set by the provided defconfigs. Also you can elaborate on what 'died here' means? Is there anything else output over the serial console? If its faulting or losing control of its execution what is the last instruction you know it has executed? Adrian On Mon 27-Feb-2017 12:54 PM, SHI, Yao wrote: I am trying to boot CAmkES-ARM-VM and got problem in elfloader. I tested Jetson-TK1 and TK1-SOM. The results are same. I've set bootm_boot_mode=nonsec in u-boot and tracked registers in function switch_to_hyp_mode(). 1) Enter switch_to_hyp_mode(), after asm volatile ("mrc p15, 0, %0, c1, c1, 0":"=r"(scr)); ==> scr == 0x100, in which NS==0, HCE==1, SCD==0, SIF==0 2) Then switch_to_hyp_mode() changes NS to 1, so scr==0x101 asm volatile ("mcr p15, 0, %0, c1, c1, 0"::"r"(scr)); 3) switch_to_hyp_mode() changes cpsr to Hyp mode asm volatile ("cps %0\n\t" "isb\n" ::"I"(HYPERVISOR_MODE)); 4) The final step, switch_to_hyp_mode() reads cpsr, asm volatile ("mrs %0, cpsr":"=r"(scr)); ==> scr == 0x6000001da, in which cpsr.M==0x1a, cpsr.I==1, cpsr.F==1, cpsr.A==1 Finally, the process died here. My questions are, 1) Are NS==0 and HCE==1 correct when entering switch_to_hyp_mode() ? 2) Is the final status (cpsr.F==cpsr.I==cpsr.A==1) expected? 3) Any other mistake I might make? Yao _______________________________________________ Devel mailing list Devel@sel4.systemsmailto:Devel@sel4.systems https://sel4.systems/lists/listinfo/devel
Hi Adrian,
I confirmed that seL4 mode is 'Load the seL4 kernel in hypervisor mode
(NS))' and 'Install hooks in monitor mode' is set.
The call stack was main()->platform_init()->switch_to_hyp_mode(). The
process terminated right after that last statement 'printf("Load seL4 in
nonsecure HYP mode %x", scr);' in switch_to_hyp_mode().
It didn't get back to platform_init() (I inserted printf right after the
callsite of switch_to_hyp_mode() in platform_init()). The last output was:
Load seL4 in nonsecure HYP mode 600001da
Yao
On Sun, Feb 26, 2017 at 6:36 PM,
Hi Yao,
Can you confirm in the build configuration that 'seL4 mode' is set to 'Load the seL4 kernel in hypervisor mode (NS))' and 'Install hooks in monitor mode' in set? These should be set by the provided defconfigs. Also you can elaborate on what 'died here' means? Is there anything else output over the serial console? If its faulting or losing control of its execution what is the last instruction you know it has executed?
Adrian
On Mon 27-Feb-2017 12:54 PM, SHI, Yao wrote:
I am trying to boot CAmkES-ARM-VM and got problem in elfloader. I tested Jetson-TK1 and TK1-SOM. The results are same. I've set bootm_boot_mode=nonsec in u-boot and tracked registers in function switch_to_hyp_mode().
1) Enter switch_to_hyp_mode(), after asm volatile ("mrc p15, 0, %0, c1, c1, 0":"=r"(scr)); ==> scr == 0x100, in which NS==0, HCE==1, SCD==0, SIF==0
2) Then switch_to_hyp_mode() changes NS to 1, so scr==0x101 asm volatile ("mcr p15, 0, %0, c1, c1, 0"::"r"(scr));
3) switch_to_hyp_mode() changes cpsr to Hyp mode
asm volatile ("cps %0\n\t" "isb\n" ::"I"(HYPERVISOR_MODE));
4) The final step, switch_to_hyp_mode() reads cpsr, asm volatile ("mrs %0, cpsr":"=r"(scr)); ==> scr == 0x6000001da, in which cpsr.M==0x1a, cpsr.I==1, cpsr.F==1, cpsr.A==1
Finally, the process died here.
My questions are, 1) Are NS==0 and HCE==1 correct when entering switch_to_hyp_mode() ? 2) Is the final status (cpsr.F==cpsr.I==cpsr.A==1) expected? 3) Any other mistake I might make?
Yao
_______________________________________________ Devel mailing listDevel@sel4.systemshttps://sel4.systems/lists/listinfo/devel
I was using u-boot 2017-03-rc1. After flashing back to 2015-10-rc5,
camkes-arm-vm works. So the problem is the new u-boot...though I don't know
the real problem.
On Sun, Feb 26, 2017 at 7:12 PM, SHI, Yao
Hi Adrian,
I confirmed that seL4 mode is 'Load the seL4 kernel in hypervisor mode (NS))' and 'Install hooks in monitor mode' is set.
The call stack was main()->platform_init()->switch_to_hyp_mode(). The process terminated right after that last statement 'printf("Load seL4 in nonsecure HYP mode %x", scr);' in switch_to_hyp_mode(). It didn't get back to platform_init() (I inserted printf right after the callsite of switch_to_hyp_mode() in platform_init()). The last output was:
Load seL4 in nonsecure HYP mode 600001da
Yao
On Sun, Feb 26, 2017 at 6:36 PM,
wrote: Hi Yao,
Can you confirm in the build configuration that 'seL4 mode' is set to 'Load the seL4 kernel in hypervisor mode (NS))' and 'Install hooks in monitor mode' in set? These should be set by the provided defconfigs. Also you can elaborate on what 'died here' means? Is there anything else output over the serial console? If its faulting or losing control of its execution what is the last instruction you know it has executed?
Adrian
On Mon 27-Feb-2017 12:54 PM, SHI, Yao wrote:
I am trying to boot CAmkES-ARM-VM and got problem in elfloader. I tested Jetson-TK1 and TK1-SOM. The results are same. I've set bootm_boot_mode=nonsec in u-boot and tracked registers in function switch_to_hyp_mode().
1) Enter switch_to_hyp_mode(), after asm volatile ("mrc p15, 0, %0, c1, c1, 0":"=r"(scr)); ==> scr == 0x100, in which NS==0, HCE==1, SCD==0, SIF==0
2) Then switch_to_hyp_mode() changes NS to 1, so scr==0x101 asm volatile ("mcr p15, 0, %0, c1, c1, 0"::"r"(scr));
3) switch_to_hyp_mode() changes cpsr to Hyp mode
asm volatile ("cps %0\n\t" "isb\n" ::"I"(HYPERVISOR_MODE));
4) The final step, switch_to_hyp_mode() reads cpsr, asm volatile ("mrs %0, cpsr":"=r"(scr)); ==> scr == 0x6000001da, in which cpsr.M==0x1a, cpsr.I==1, cpsr.F==1, cpsr.A==1
Finally, the process died here.
My questions are, 1) Are NS==0 and HCE==1 correct when entering switch_to_hyp_mode() ? 2) Is the final status (cpsr.F==cpsr.I==cpsr.A==1) expected? 3) Any other mistake I might make?
Yao
_______________________________________________ Devel mailing listDevel@sel4.systemshttps://sel4.systems/lists/listinfo/devel
Hi Yao,
Glad you got it working and thanks for discovering that. We will look into what is going on.
Adrian
On Mon 27-Feb-2017 3:27 PM, SHI, Yao wrote:
I was using u-boot 2017-03-rc1. After flashing back to 2015-10-rc5, camkes-arm-vm works. So the problem is the new u-boot...though I don't know the real problem.
On Sun, Feb 26, 2017 at 7:12 PM, SHI, Yao
participants (2)
-
Adrian.Danis@data61.csiro.au
-
SHI, Yao