mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
riscv: kexec: Align the kexeced kernel entry
[ Upstream commit1bfb2b618d] The current riscv boot protocol requires 2MB alignment for RV64 and 4MB alignment for RV32. In KEXEC_FILE path, the elf_find_pbase() function should align the kexeced kernel entry according to the requirement, otherwise the kexeced kernel would silently BUG at the setup_vm(). Fixes:8acea455fa("RISC-V: Support for kexec_file on panic") Signed-off-by: Song Shuai <songshuaishuai@tinylab.org> Link: https://lore.kernel.org/r/20230906095817.364390-1-songshuaishuai@tinylab.org Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e9b8e26610
commit
dd8fce4e2d
@@ -98,7 +98,13 @@ static int elf_find_pbase(struct kimage *image, unsigned long kernel_len,
|
|||||||
kbuf.image = image;
|
kbuf.image = image;
|
||||||
kbuf.buf_min = lowest_paddr;
|
kbuf.buf_min = lowest_paddr;
|
||||||
kbuf.buf_max = ULONG_MAX;
|
kbuf.buf_max = ULONG_MAX;
|
||||||
kbuf.buf_align = PAGE_SIZE;
|
|
||||||
|
/*
|
||||||
|
* Current riscv boot protocol requires 2MB alignment for
|
||||||
|
* RV64 and 4MB alignment for RV32
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
kbuf.buf_align = PMD_SIZE;
|
||||||
kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
|
kbuf.mem = KEXEC_BUF_MEM_UNKNOWN;
|
||||||
kbuf.memsz = ALIGN(kernel_len, PAGE_SIZE);
|
kbuf.memsz = ALIGN(kernel_len, PAGE_SIZE);
|
||||||
kbuf.top_down = false;
|
kbuf.top_down = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user