]>
Commit | Line | Data |
---|---|---|
53deff6d GKH |
1 | From bec0de4cfad21bd284dbddee016ed1767a5d2823 Mon Sep 17 00:00:00 2001 |
2 | From: Huacai Chen <chenhc@lemote.com> | |
3 | Date: Thu, 15 Nov 2018 15:53:56 +0800 | |
4 | Subject: MIPS: Align kernel load address to 64KB | |
5 | ||
6 | From: Huacai Chen <chenhc@lemote.com> | |
7 | ||
8 | commit bec0de4cfad21bd284dbddee016ed1767a5d2823 upstream. | |
9 | ||
10 | KEXEC needs the new kernel's load address to be aligned on a page | |
11 | boundary (see sanity_check_segment_list()), but on MIPS the default | |
12 | vmlinuz load address is only explicitly aligned to 16 bytes. | |
13 | ||
14 | Since the largest PAGE_SIZE supported by MIPS kernels is 64KB, increase | |
15 | the alignment calculated by calc_vmlinuz_load_addr to 64KB. | |
16 | ||
17 | Signed-off-by: Huacai Chen <chenhc@lemote.com> | |
18 | Signed-off-by: Paul Burton <paul.burton@mips.com> | |
19 | Patchwork: https://patchwork.linux-mips.org/patch/21131/ | |
20 | Cc: Ralf Baechle <ralf@linux-mips.org> | |
21 | Cc: James Hogan <james.hogan@mips.com> | |
22 | Cc: Steven J . Hill <Steven.Hill@cavium.com> | |
23 | Cc: linux-mips@linux-mips.org | |
24 | Cc: Fuxin Zhang <zhangfx@lemote.com> | |
25 | Cc: Zhangjin Wu <wuzhangjin@gmail.com> | |
26 | Cc: <stable@vger.kernel.org> # 2.6.36+ | |
27 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
28 | ||
29 | --- | |
30 | arch/mips/boot/compressed/calc_vmlinuz_load_addr.c | 7 ++++--- | |
31 | 1 file changed, 4 insertions(+), 3 deletions(-) | |
32 | ||
33 | --- a/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c | |
34 | +++ b/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c | |
35 | @@ -13,6 +13,7 @@ | |
36 | #include <stdint.h> | |
37 | #include <stdio.h> | |
38 | #include <stdlib.h> | |
39 | +#include "../../../../include/linux/sizes.h" | |
40 | ||
41 | int main(int argc, char *argv[]) | |
42 | { | |
43 | @@ -45,11 +46,11 @@ int main(int argc, char *argv[]) | |
44 | vmlinuz_load_addr = vmlinux_load_addr + vmlinux_size; | |
45 | ||
46 | /* | |
47 | - * Align with 16 bytes: "greater than that used for any standard data | |
48 | - * types by a MIPS compiler." -- See MIPS Run Linux (Second Edition). | |
49 | + * Align with 64KB: KEXEC needs load sections to be aligned to PAGE_SIZE, | |
50 | + * which may be as large as 64KB depending on the kernel configuration. | |
51 | */ | |
52 | ||
53 | - vmlinuz_load_addr += (16 - vmlinux_size % 16); | |
54 | + vmlinuz_load_addr += (SZ_64K - vmlinux_size % SZ_64K); | |
55 | ||
56 | printf("0x%llx\n", vmlinuz_load_addr); | |
57 |