[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] undefined instruction error during HYP mode switch for arndale-octa board
Hello Julien,
At first, I want to know who is the maintainer for this U-Boot or Hypervisor mode support section.
From previous email, I found that U-boot is running already in non-secure mode.
From the comment of the erroneous code in arch/arm/cpu/armv7/nonsec_vert.S, it is guessed that it tries to switch non-secure mode assuming the CPU is in secure mode.
======================================== /*
Â* Switch a core to non-secure state. Â*
Â* Â1. initialize the GIC per-core interface Â* Â2. allow coprocessor access in non-secure modes
Â* Â3. switch the cpu mode (by calling "smc #0") Â*
Â* Called from smp_pen by secondary cores and directly by the BSP. Â* Do not assume that the stack is available and only use registers
Â* r0-r3 and r12. Â*
Â* PERIPHBASE is used to get the GIC address. This could be 40 bits long, Â* though, but we check this in C before calling this function.
Â*/ ENTRY(_nonsec_init)
=========================================
But I have known CPU is already in non-secure mode, so, we commented out the calling _nonsec_init() and
just call hypervisor mode switch function only as below: =========================================
static void do_nonsec_virt_switch(void) {
#if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_ARMV7_VIRT) // Â Â Âif (armv7_switch_nonsec() == 0)
#ifdef CONFIG_ARMV7_VIRT Â Â Â Â Â Â Â Â if (armv7_switch_hyp() == 0)
            debug("entered HYP mode\n"); #else
        debug("entered non-secure state\n"); #endif
#endif }
=========================================
The code of function armv7_switch_hyp() is simple: =========================================
ENTRY(_switch_to_hyp)     mov   r0, lr
    mov   r1, sp             Â@ save SVC copy of LR and SP     isb
    hvc #0          @ for older asm: .byte 0x70, 0x00, 0x40, 0xe1     mov   sp, r1     mov   lr, r0             Â@ restore SVC copy of LR and SP     bx   Âlr ENDPROC(_switch_to_hyp) ===========================================
But it hangs while booting in "hvc #0" instruction. ----------------------------------------------------------------------
## Booting kernel from Legacy Image at 20007000 ... Â ÂImage Name: ÂÂ
 ÂImage Type:  ARM Linux Kernel Image (uncompressed)  ÂData Size:  Â656144 Bytes = 640.8 KiB
 ÂLoad Address: 20008000  ÂEntry Point: Â20008000  ÂVerifying Checksum ... OK
## Flattened Device Tree blob at 21f00000 Â ÂBooting using the fdt blob at 0x21f00000
 ÂLoading Kernel Image ... OK OK
 Âreserving fdt memory region: addr=21f00000 size=8000  ÂUsing Device Tree in place at 21f00000, end 21f0afff
 switch_hyp: CPU supports virt ext ---------------------------------------------------------------------- From the original sequence of function calls, nonsec_init() is for turning to non-secure mode, then it calls switch_to_hyp () in non-secure mode.
Is there any preparation for executing "hvc" instruction or any privilege to be executed?
Best, Hyonyoung 2014-04-21 8:39 GMT-04:00 Julien Grall <julien.grall@xxxxxxxxxx>: Hello HyonYoung, _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |