diff options
author | Alexey Kardashevskiy <aik@ozlabs.ru> | 2022-05-04 16:55:36 +1000 |
---|---|---|
committer | Daniel Henrique Barboza <danielhb413@gmail.com> | 2022-05-26 17:11:32 -0300 |
commit | 5bb55f3e3b00679519a83ffe688eae0e68e305a7 (patch) | |
tree | 563713725915885b62c31b9d9aa383beaa3867d1 /hw/ppc/trace.h | |
parent | 1e665723e92cd3dae4d8943bf7bd1799a3b4a82a (diff) | |
download | qemu-5bb55f3e3b00679519a83ffe688eae0e68e305a7.zip qemu-5bb55f3e3b00679519a83ffe688eae0e68e305a7.tar.gz qemu-5bb55f3e3b00679519a83ffe688eae0e68e305a7.tar.bz2 |
spapr: Use address from elf parser for kernel address
tl;dr: This allows Big Endian zImage booting via -kernel + x-vof=on.
QEMU loads the kernel at 0x400000 by default which works most of
the time as Linux kernels are relocatable, 64bit and compiled with "-pie"
(position independent code). This works for a little endian zImage too.
However a big endian zImage is compiled without -pie, is 32bit, linked to
0x4000000 so current QEMU ends up loading it at
0x4400000 but keeps spapr->kernel_addr unchanged so booting fails.
This uses the kernel address returned from load_elf().
If the default kernel_addr is used, there is no change in behavior (as
translate_kernel_address() takes care of this), which is:
LE/BE vmlinux and LE zImage boot, BE zImage does not.
If the VM created with "-machine kernel-addr=0,x-vof=on", then QEMU
prints a warning and BE zImage boots.
Note #1: SLOF (x-vof=off) still cannot boot a big endian zImage as
SLOF enables MSR_SF for everything loaded by QEMU and this leads to early
crash of 32bit zImage.
Note #2: BE/LE vmlinux images set MSR_SF in early boot so these just work;
a LE zImage restores MSR_SF after every CI call and we are lucky enough
not to crash before the first CI call.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Tested-by: Joel Stanley <joel@jms.id.au>
Reviewed-by: Fabiano Rosas <farosas@linux.ibm.com>
Message-Id: <20220504065536.3534488-1-aik@ozlabs.ru>
[danielhb: use PRIx64 instead of lx in warn_report]
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Diffstat (limited to 'hw/ppc/trace.h')
0 files changed, 0 insertions, 0 deletions