qemu-e2k/hw/ppc
Alexey Kardashevskiy 5bb55f3e3b 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>
2022-05-26 17:11:32 -03:00
..
e500-ccsr.h
e500.c hw/ppc/e500: Remove unused BINARY_DEVICE_TREE_FILE 2022-05-26 17:11:32 -03:00
e500.h
e500plat.c
fdt.c
fw_cfg.c
Kconfig
mac_newworld.c machine: use QAPI struct for boot configuration 2022-05-12 12:29:43 +02:00
mac_oldworld.c machine: use QAPI struct for boot configuration 2022-05-12 12:29:43 +02:00
mac.h
meson.build
mpc8544_guts.c
mpc8544ds.c
pef.c
pegasos2.c target/ppc: Remove msr_pr macro 2022-05-05 15:36:17 -03:00
pnv_bmc.c
pnv_core.c
pnv_homer.c
pnv_lpc.c
pnv_occ.c
pnv_pnor.c
pnv_psi.c
pnv_xscom.c
pnv.c
ppc4xx_devs.c
ppc4xx_pci.c
ppc405_boards.c
ppc405_uc.c
ppc405.h
ppc440_bamboo.c hw/ppc: change indentation to spaces from TABs 2022-04-20 18:00:30 -03:00
ppc440_pcix.c
ppc440_uc.c
ppc440.h
ppc_booke.c
ppc.c
ppce500_spin.c
prep_systemio.c
prep.c machine: use QAPI struct for boot configuration 2022-05-12 12:29:43 +02:00
rs6000_mc.c
sam460ex.c
spapr_caps.c
spapr_cpu_core.c
spapr_drc.c
spapr_events.c
spapr_hcall.c
spapr_iommu.c
spapr_irq.c
spapr_numa.c
spapr_nvdimm.c
spapr_ovec.c
spapr_pci_nvlink2.c
spapr_pci_vfio.c
spapr_pci.c
spapr_rng.c
spapr_rtas_ddw.c
spapr_rtas.c hw/ppc: change indentation to spaces from TABs 2022-04-20 18:00:30 -03:00
spapr_rtc.c
spapr_softmmu.c
spapr_tpm_proxy.c
spapr_vio.c
spapr_vof.c
spapr.c spapr: Use address from elf parser for kernel address 2022-05-26 17:11:32 -03:00
trace-events
trace.h
virtex_ml507.c
vof.c