OSDN Git Service

riscv/kexec: load initrd high in available memory
authorTorsten Duwe <duwe@suse.de>
Wed, 26 Jul 2023 09:54:01 +0000 (11:54 +0200)
committerPalmer Dabbelt <palmer@rivosinc.com>
Fri, 4 Aug 2023 17:27:44 +0000 (10:27 -0700)
commit49af7a2cd5f678217b8b4f86a29411aebebf3e78
tree9dd94c49f6e06b492abda257f1a702646caff329
parentd0b4f95a51038becce4bdab4789aa7ce59d4ea6e
riscv/kexec: load initrd high in available memory

When initrd is loaded low, the secondary kernel fails like this:

 INITRD: 0xdc581000+0x00eef000 overlaps in-use memory region

This initrd load address corresponds to the _end symbol, but the
reservation is aligned on PMD_SIZE, as explained by a comment in
setup_bootmem().

It is technically possible to align the initrd load address accordingly,
leaving a hole between the end of kernel and the initrd, but it is much
simpler to allocate the initrd top-down.

Fixes: 838b3e28488f ("RISC-V: Load purgatory in kexec_file")
Signed-off-by: Torsten Duwe <duwe@suse.de>
Signed-off-by: Petr Tesarik <petr.tesarik.ext@huawei.com>
Cc: stable@vger.kernel.org
Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://lore.kernel.org/all/67c8eb9eea25717c2c8208d9bfbfaa39e6e2a1c6.1690365011.git.petr.tesarik.ext@huawei.com/
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
arch/riscv/kernel/elf_kexec.c