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 hw/ppc/Kconfig: Add dependency PEGASOS2 -> ATI_VGA 2021-07-20 20:10:20 +02:00
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 hw/ppc/mac.h: Remove MAX_CPUS macro 2021-12-17 17:57:12 +01:00
meson.build
mpc8544_guts.c ppc/ppc4xx: Convert printfs() 2022-01-04 07:55:34 +01:00
mpc8544ds.c
pef.c
pegasos2.c target/ppc: Remove msr_pr macro 2022-05-05 15:36:17 -03:00
pnv_bmc.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
pnv_core.c ppc/pnv: Rename "id" to "quad-id" in PnvQuad 2021-09-29 19:37:38 +10:00
pnv_homer.c ppc/pnv: Add a HOMER model to POWER10 2022-03-02 06:51:39 +01:00
pnv_lpc.c ppc/pnv: Remove PnvLpcController::psi link 2022-04-20 18:00:30 -03:00
pnv_occ.c ppc/pnv: Remove PnvOCC::psi link 2022-04-20 18:00:30 -03:00
pnv_pnor.c ppc/pnv: Fix check on block device before updating drive contents 2021-11-09 10:32:52 +11:00
pnv_psi.c ppc/pnv: Remove useless checks in set_irq handlers 2022-04-20 18:00:30 -03:00
pnv_xscom.c ppc/pnv: Add a comment on the "primary-topology-index" property 2021-09-29 19:37:38 +10:00
pnv.c ppc/pnv: Remove PnvOCC::psi link 2022-04-20 18:00:30 -03:00
ppc4xx_devs.c Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
ppc4xx_pci.c ppc/ppc4xx: Convert printfs() 2022-01-04 07:55:34 +01:00
ppc405_boards.c hw/ppc/ppc405_boards: Initialize g_autofree pointer 2022-04-20 18:00:30 -03:00
ppc405_uc.c Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
ppc405.h ppc/ppc405: Fix bi_pci_enetaddr2 field in U-Boot board information 2021-12-17 17:57:17 +01:00
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 Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
ppc.c hw/ppc: free env->tb_env in spapr_unrealize_vcpu() 2022-04-04 08:49:06 +02:00
ppce500_spin.c
prep_systemio.c Mark remaining global TypeInfo instances as const 2022-02-21 13:30:20 +00:00
prep.c machine: use QAPI struct for boot configuration 2022-05-12 12:29:43 +02:00
rs6000_mc.c
sam460ex.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
spapr_caps.c hw/ppc/spapr_caps.c: use g_autofree in spapr_caps_add_properties() 2022-03-02 06:51:39 +01:00
spapr_cpu_core.c hw/ppc: free env->tb_env in spapr_unrealize_vcpu() 2022-04-04 08:49:06 +02:00
spapr_drc.c hw/ppc/spapr_drc.c: use g_autofree in spapr_drc_by_index() 2022-03-02 06:51:40 +01:00
spapr_events.c Use g_new() & friends where that makes obvious sense 2022-03-21 15:44:44 +01:00
spapr_hcall.c spapr: Move nested KVM hypercalls under a TCG only config. 2022-04-20 18:00:30 -03:00
spapr_iommu.c Mark remaining global TypeInfo instances as const 2022-02-21 13:30:20 +00:00
spapr_irq.c
spapr_numa.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
spapr_nvdimm.c spapr: nvdimm: Introduce spapr-nvdimm device 2022-02-18 08:34:14 +01:00
spapr_ovec.c
spapr_pci_nvlink2.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
spapr_pci_vfio.c pci: Export pci_for_each_device_under_bus*() 2021-11-01 19:36:11 -04:00
spapr_pci.c Replace qemu_real_host_page variables with inlined functions 2022-04-06 10:50:38 +02:00
spapr_rng.c
spapr_rtas_ddw.c ppc/spapr/ddw: Add 2M pagesize 2022-04-20 18:00:30 -03:00
spapr_rtas.c hw/ppc: change indentation to spaces from TABs 2022-04-20 18:00:30 -03:00
spapr_rtc.c rtc: Have event RTC_CHANGE identify the RTC by QOM path 2022-02-28 11:39:35 +01:00
spapr_softmmu.c osdep: Move memalign-related functions to their own header 2022-03-07 13:16:49 +00:00
spapr_tpm_proxy.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
spapr_vio.c hw/ppc/spapr_vio.c: use g_autofree in spapr_dt_vdevice() 2022-03-02 06:51:40 +01:00
spapr_vof.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
spapr.c spapr: Use address from elf parser for kernel address 2022-05-26 17:11:32 -03:00
trace-events ppc/ppc405: Restore TCR and STR write handlers 2022-01-04 07:55:34 +01:00
trace.h
virtex_ml507.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
vof.c ppc/vof: Fix uninitialized string tracing 2022-04-20 18:00:30 -03:00