Commit 303ed2fc authored by Huacai Chen's avatar Huacai Chen Committed by Juerg Haefliger

MIPS: Align kernel load address to 64KB

BugLink: https://bugs.launchpad.net/bugs/1811647

commit bec0de4c upstream.

KEXEC needs the new kernel's load address to be aligned on a page
boundary (see sanity_check_segment_list()), but on MIPS the default
vmlinuz load address is only explicitly aligned to 16 bytes.

Since the largest PAGE_SIZE supported by MIPS kernels is 64KB, increase
the alignment calculated by calc_vmlinuz_load_addr to 64KB.
Signed-off-by: default avatarHuacai Chen <chenhc@lemote.com>
Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
Patchwork: https://patchwork.linux-mips.org/patch/21131/
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <james.hogan@mips.com>
Cc: Steven J . Hill <Steven.Hill@cavium.com>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Cc: <stable@vger.kernel.org> # 2.6.36+
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent 92815f69
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "../../../../include/linux/sizes.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
...@@ -45,11 +46,11 @@ int main(int argc, char *argv[]) ...@@ -45,11 +46,11 @@ int main(int argc, char *argv[])
vmlinuz_load_addr = vmlinux_load_addr + vmlinux_size; vmlinuz_load_addr = vmlinux_load_addr + vmlinux_size;
/* /*
* Align with 16 bytes: "greater than that used for any standard data * Align with 64KB: KEXEC needs load sections to be aligned to PAGE_SIZE,
* types by a MIPS compiler." -- See MIPS Run Linux (Second Edition). * which may be as large as 64KB depending on the kernel configuration.
*/ */
vmlinuz_load_addr += (16 - vmlinux_size % 16); vmlinuz_load_addr += (SZ_64K - vmlinux_size % SZ_64K);
printf("0x%llx\n", vmlinuz_load_addr); printf("0x%llx\n", vmlinuz_load_addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment