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