linux-mips
[Top] [All Lists]

[PATCH 4.4 52/88] MIPS: Align kernel load address to 64KB

To: linux-kernel@vger.kernel.org
Subject: [PATCH 4.4 52/88] MIPS: Align kernel load address to 64KB
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: Fri, 11 Jan 2019 15:08:21 +0100
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, stable@vger.kernel.org, Huacai Chen <chenhc@lemote.com>, Paul Burton <paul.burton@mips.com>, Ralf Baechle <ralf@linux-mips.org>, James Hogan <james.hogan@mips.com>, "Steven J . Hill" <Steven.Hill@cavium.com>, linux-mips@linux-mips.org, Fuxin Zhang <zhangfx@lemote.com>, Zhangjin Wu <wuzhangjin@gmail.com>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1547216409; bh=kkdj8d8yBG8D3tBb1OT1vQuyebtJOUHCG62epiYF2xs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PE8v9uH0j7RGAKby+NnQ5DAw8NifYuL7iEExw6j/fPMLZdJjH55/HiAaHnvEz8hdj hbyrNs1xhvrJ+2Vfsq12y+L/xh93GinVimzZPF+ya9y46ZKiviIXiuschIFRABKJZG lLcGW4yMZP/KwhIWifqY6UkpeIUOO//tzrRIP9+U=
In-reply-to: <20190111131045.137499039@linuxfoundation.org>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20190111131045.137499039@linuxfoundation.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: quilt/0.65
4.4-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Huacai Chen <chenhc@lemote.com>

commit bec0de4cfad21bd284dbddee016ed1767a5d2823 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: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Paul 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/mips/boot/compressed/calc_vmlinuz_load_addr.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c
+++ b/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c
@@ -13,6 +13,7 @@
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include "../../../../include/linux/sizes.h"
 
 int main(int argc, char *argv[])
 {
@@ -45,11 +46,11 @@ int main(int argc, char *argv[])
        vmlinuz_load_addr = vmlinux_load_addr + vmlinux_size;
 
        /*
-        * Align with 16 bytes: "greater than that used for any standard data
-        * types by a MIPS compiler." -- See MIPS Run Linux (Second Edition).
+        * Align with 64KB: KEXEC needs load sections to be aligned to 
PAGE_SIZE,
+        * 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);
 



<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH 4.4 52/88] MIPS: Align kernel load address to 64KB, Greg Kroah-Hartman <=