linux/arch/powerpc
Michael Ellerman 24d33ac5b8 powerpc/64s: Make prom_init require RELOCATABLE
When we boot from open firmware (OF) using PPC_OF_BOOT_TRAMPOLINE, aka.
prom_init, we run parts of the kernel at an address other than the link
address. That happens because OF loads the kernel above zero (OF is at
zero) and we run prom_init before copying the kernel down to zero.

Currently that works even for non-relocatable kernels, because we do
various fixups to the prom_init code to make it run where it's loaded.

However those fixups are not sufficient if the kernel becomes large
enough. In that case prom_init()'s final call to __start() can end up
generating a plt branch:

bl      c000000002000018 <00000078.plt_branch.__start>

That results in the kernel jumping to the linked address of __start,
0xc000000000000000, when really it needs to jump to the
0xc000000000000000 + the runtime address because the kernel is still
running at the load address.

We could do further shenanigans to handle that, see Jordan's patch for
example:
  https://lore.kernel.org/linuxppc-dev/20210421021721.1539289-1-jniethe5@gmail.com

However it is much simpler to just require a kernel with prom_init() to
be built relocatable. The result works in all configurations without
further work, and requires less code.

This should have no effect on most people, as our defconfigs and
essentially all distro configs already have RELOCATABLE enabled.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210623130454.2542945-1-mpe@ellerman.id.au
2021-06-25 14:47:19 +10:00
..
boot powerpc/boot: Add a boot wrapper for Microwatt 2021-06-21 21:16:32 +10:00
configs powerpc/configs: Enable STACK_TRACER and FTRACE_SYSCALLS in some of the configs 2021-06-25 14:47:19 +10:00
crypto crypto: powepc/sha1 - remove unneeded semicolon 2021-03-07 15:13:14 +11:00
include powerpc/kprobes: Roll IS_RFI() macro into IS_RFID() 2021-06-25 14:47:18 +10:00
kernel powerpc/64s: Make prom_init require RELOCATABLE 2021-06-25 14:47:19 +10:00
kexec powerpc/kexec_file: Use current CPU info while setting up FDT 2021-05-04 22:26:57 +10:00
kvm powerpc/64s: avoid reloading (H)SRR registers if they are still valid 2021-06-25 00:06:55 +10:00
lib powerpc/64: use interrupt restart table to speed up return from interrupt 2021-06-25 00:06:56 +10:00
math-emu powerpc/64s: avoid reloading (H)SRR registers if they are still valid 2021-06-25 00:06:55 +10:00
mm powerpc/mm: Properly coalesce pages in ptdump 2021-06-25 00:07:10 +10:00
net powerpc/bpf: Use bctrl for making function calls 2021-06-25 14:47:19 +10:00
perf powerpc: make stack walking KASAN-safe 2021-06-17 00:09:11 +10:00
platforms powerpc/64s: Make prom_init require RELOCATABLE 2021-06-25 14:47:19 +10:00
purgatory powerpc/kexec: Don't use .machine ppc64 in trampoline_64.S 2021-04-08 21:17:43 +10:00
sysdev powerpc/64s: avoid reloading (H)SRR registers if they are still valid 2021-06-25 00:06:55 +10:00
tools
xmon powerpc/xmon: Add support for running a command on all cpus in xmon 2021-06-25 14:47:19 +10:00
Kbuild
Kconfig powerpc: Add Microwatt platform 2021-06-21 21:15:26 +10:00
Kconfig.debug powerpc: Make PPC_IRQ_SOFT_MASK_DEBUG depend on PPC64 2021-06-25 00:07:09 +10:00
Makefile powerpc/Makefile: Add ppc32/ppc64_randconfig targets 2021-05-23 20:51:35 +10:00
Makefile.postlink