]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.4.170/mips-align-kernel-load-address-to-64kb.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.4.170 / mips-align-kernel-load-address-to-64kb.patch
CommitLineData
53deff6d
GKH
1From bec0de4cfad21bd284dbddee016ed1767a5d2823 Mon Sep 17 00:00:00 2001
2From: Huacai Chen <chenhc@lemote.com>
3Date: Thu, 15 Nov 2018 15:53:56 +0800
4Subject: MIPS: Align kernel load address to 64KB
5
6From: Huacai Chen <chenhc@lemote.com>
7
8commit bec0de4cfad21bd284dbddee016ed1767a5d2823 upstream.
9
10KEXEC needs the new kernel's load address to be aligned on a page
11boundary (see sanity_check_segment_list()), but on MIPS the default
12vmlinuz load address is only explicitly aligned to 16 bytes.
13
14Since the largest PAGE_SIZE supported by MIPS kernels is 64KB, increase
15the alignment calculated by calc_vmlinuz_load_addr to 64KB.
16
17Signed-off-by: Huacai Chen <chenhc@lemote.com>
18Signed-off-by: Paul Burton <paul.burton@mips.com>
19Patchwork: https://patchwork.linux-mips.org/patch/21131/
20Cc: Ralf Baechle <ralf@linux-mips.org>
21Cc: James Hogan <james.hogan@mips.com>
22Cc: Steven J . Hill <Steven.Hill@cavium.com>
23Cc: linux-mips@linux-mips.org
24Cc: Fuxin Zhang <zhangfx@lemote.com>
25Cc: Zhangjin Wu <wuzhangjin@gmail.com>
26Cc: <stable@vger.kernel.org> # 2.6.36+
27Signed-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