]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc: Fix early setup to make early_ioremap() work
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Thu, 20 May 2021 03:29:19 +0000 (13:29 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 20 May 2021 06:43:26 +0000 (16:43 +1000)
commite12bc76c40704e6924c4d2554cf72f617c2a10ec
treee76abd9031895dad3b1b086390570f12fdad4c8b
parent87d9f8b77b5545016adf3cfc494e6ea6899acca7
powerpc: Fix early setup to make early_ioremap() work

The immediate problem is that after commit
77b3cdef21f6 ("powerpc/legacy_serial: Use early_ioremap()") the kernel
silently reboots on some systems.

The reason is that early_ioremap() returns broken addresses as it uses
slot_virt[] array which initialized with offsets from FIXADDR_TOP ==
IOREMAP_END+FIXADDR_SIZE == KERN_IO_END - FIXADDR_SIZ + FIXADDR_SIZE ==
__kernel_io_end which is 0 when early_ioremap_setup() is called.
__kernel_io_end is initialized little bit later in early_init_mmu().

This fixes the initialization by swapping early_ioremap_setup() and
early_init_mmu().

Fixes: 28f8361db4c5 ("powerpc: Add support for GENERIC_EARLY_IOREMAP")
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
[mpe: Drop unrelated cleanup & cleanup change log]
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210520032919.358935-1-aik@ozlabs.ru
arch/powerpc/kernel/setup_64.c