loading a simple hypervisor(just prints Hello World) before the linux kernel
Hi, I'm trying to learn about the Linux kernel and the bare metal world on raspberry pi 4. After writing a simple kernel, which would print Hello World to UART, I tried to write Hello World using two different binaries loaded at two different addresses(and on two different exception levels!(EL2 and EL1). el2-kernel.img - this just prints Hello to UART. el1-kernel.img - this just prints World to UART. I used the following configuration on rpi4, to load both binaries on rpi4. kernel=el2-kernel.img initramfs el1-kernel.img 0x400000 In the el2-kernel.img, I wrote a function which would jump from any exception level to EL1 at 0x400000. I have successfully done so. I can see the Hello World printed to UART by two different binaries. What I cannot do is to jump from a binary(let's call it a simple hypervisor, which prints Hello World) at EL2 to the standard linux kernel at El1. How would I be able to do so? I have tried the same with standard linux kernel and "kept" dtb address in x0, so it can used by the linux kernel. My code for the simple hypervisor: https://github.com/SikkiLadho/Leo
On Wed, 10 Nov 2021 23:38:11 +0500, Mushahid Hussain said:
I have successfully done so. I can see the Hello World printed to UART by two different binaries. What I cannot do is to jump from a binary(let's call it a simple hypervisor, which prints Hello World) at EL2 to the standard linux kernel at El1.
How would I be able to do so? I have tried the same with standard linux kernel and "kept" dtb address in x0, so it can used by the linux kernel.
Hint: Just branching to El1 probably isn't enough. [/usr/src/linux-next] find Documentation -name booting.rst Documentation/arm64/booting.rst Documentation/mips/booting.rst Documentation/arm/booting.rst Documentation/xtensa/booting.rst Documentation/sh/booting.rst Documentation/translations/zh_CN/mips/booting.rst Documentation/powerpc/booting.rst Good luck! :)
Hint: Just branching to El1 probably isn't enough. Documentation/arm64/booting.rst
All these conditions should be set by the bootloader when it loads the hypervisor(which prints Hello World at first). I only have to keep the dtb address in x0 and jump to EL! I have also added the kernel image header <https://www.kernel.org/doc/html/latest/arm64/booting.html#call-the-kernel-im...> to Hypervsisor's boot.S file so that rpi bootloader identifies it as the linux kernel and sets all the conditions defined in Documentation/arm64/booting.rst including loading dtb and storing its address in x0. What am I missing here?
participants (3)
-
Mushahid Hussain -
Valdis Klētnieks -
Wonhyuk Yang