Hi,
i'm doing some experiments on Aarch64/Aarch32 using the Foundationv8 simulator.
For starting, i got the linux/bootwrapper/toolchain code from linaro, compiled the software and the linux kernel in 64 bits without any problem.
Then i started modifications to try booting on the same simulator the linux in 32 bits.
- modify the mm/kernel/proc-v7.S to add the Foundation v8 processor id (0x410fd000)
- i compiled the linux in 32 bit using the same config (vexpress_defconfig) enabling LPAE and disabling 'EL2 configuration'
- modify the boot wrapper to jump in Aarch32 mode into kernel (it is working fine)
I start the emulator. It seems i'm jumping in the kernel in Aarch32 system mode (so boot wrapper is OK). But once in the kernel i start getting issues:
- in Aarch32 i 'm not able to obtain the MIDR using the instruction (mrc p15, 0, r9, c0, c0, 0). zero is returned in r9.
- if i force the r9 value with expected one then i can continue execution but still not able to get terminal and even shell.
So my questions are:
- is Foundation v8 able to run a linux in 32 bits (CP15 MIDR register returning bad value is bug or not ) ?
- is the linux supporting execution on Foundation v8 with vexpress_defconfig ?
I'm continuing the investigation but it would be nice for me to know if the task i'm doing is acheivable .
Thanks for you help.
Seb
HI Sebastien
In a similar way I am trying to load a 32-bit kernel on a real board running Cortex A-53.
I have followed the below steps to boot the kernel in EL1 mode from EL2.
mrs x0, sctlr_el2
bic x0, x0, #(1 << 25) // Clear the EE bit for EL2
msr sctlr_el2, x0
mov x0, #(0 << 31) // 32-bit EL1
msr hcr_el2, x0
/* Generic timers. */
mrs x0, cnthctl_el2
orr x0, x0, #3
msr cnthctl_el2, x0
msr cntvoff_el2, xzr
/* Populate ID registers. */
mrs x0, midr_el1
mrs x1, mpidr_el1
msr vpidr_el2, x0
msr vmpidr_el2, x1
/* sctlr_el1 */
mov x0, xzr
orr x0, x0, #(0x1 << 0)
orr x0, x0, #(0x1 << 1)
orr x0, x0, #(0x1 << 5)
orr x0, x0, #(0x1 << 7)
orr x0, x0, #(0x1 << 16)
orr x0, x0, #(0x1 << 18)
orr x0, x0, #(0x1 << 29)
orr x0, x0, #(0x1 << 23)
orr x0, x0, #(0x1 << 22)
orr x0, x0, #(0x1 << 20)
orr x0, x0, #(0x1 << 11)
msr sctlr_el1, x0
/* Coprocessor traps. */
mov x0, #0x33ff
msr cptr_el2, x0
msr hstr_el2, xzr // Disable CP15 traps to EL2
mov x0, #(0x3 << 0 | 0x1 << 4 | 0x1 << 6 | 0x1 << 7)
msr spsr_el2, x0
mov x0 , #0xb000000
msr elr_el2, x0
eret
The kernel is unable to boot. Is there something wrong that I am doing.
Regards.
Suhas P K