Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1321117yba; Tue, 2 Apr 2019 06:50:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqzii+LsLUDeQa9qh4bZN7Q/KRhyt4+nZXUQRnF8wR+GAaOXDZBlOy+kf/j7ryNhhXwEIixI X-Received: by 2002:a62:ee0a:: with SMTP id e10mr50249928pfi.6.1554213017350; Tue, 02 Apr 2019 06:50:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554213017; cv=none; d=google.com; s=arc-20160816; b=bxhRj1C0VZ+9vS1lLGy12F9V9w74Wh1s/fTdl4QMDaM8eWzc9ajXgn0hSFHSyXLQOm E2dD2fg4pS+xcvVcOLV3dFPvRtsHhMPaC29omBKGvoG0nzWmsi+EtvJj+0pB2hC4wBy8 cY+6bPEHiscL3y8va0ivtbyIfBYMiUkQihGGn0eV1r2qw+NM7G+m+op4XEYFm+DacOGG iHoBdfQV8J0lHW2BFyk0Y75WCjXjV7wb28uxMlNh3XPYDy2eOpd6Uegzu8vN9PgvseVx DxcCNQWF4qVjMXvvL/F5udJg7D5bngm1BAFsjFuoCl7Sqcmjfae8vNSv/Q/fp2+07QPM 86rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=UJahoL0sCXNDLR4aTYLsK7c3YPeZT12IYr74QVgxIOw=; b=dIK2l3DPB/wE6rmvXt6UGxrvbwCyVRnLq1RjxaghcWQfVuhhNNRXiAI1rdL7yfBzJ/ 6hcvQHvAciUmmOkPSFhw3C14r3fVJTWq2mOVX/qe6AdBpUGiObBrL0Ob9dLXUZkbyq1T ghLajp0GZDt8tsg8IX63NJM1N5qM/Dft6y1xVkxEnF9ohrldAuBtOVSbG+qTGCoLhQNN +ENdYGqmgFb9VJbcX/hcQkHXy8uRcNn7DrR1GGPiZW4ZAJs4jvLCGcg5UbOZ8Ac1LlvT 3QZjL0PmdkM4PZYgIHO0n9Dn0TDbu7ncok9sB4oVRTYw+K6p5/6BtyvQNbUzc1FfqOix PTNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j7si1869179plk.221.2019.04.02.06.50.01; Tue, 02 Apr 2019 06:50:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732286AbfDBNsa (ORCPT + 99 others); Tue, 2 Apr 2019 09:48:30 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:42924 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731207AbfDBNkC (ORCPT ); Tue, 2 Apr 2019 09:40:02 -0400 Received: from [167.98.27.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hBJdu-0002me-QG; Tue, 02 Apr 2019 14:39:59 +0100 Received: from ben by deadeye with local (Exim 4.92) (envelope-from ) id 1hBJdt-0004rO-VP; Tue, 02 Apr 2019 14:39:57 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "Huacai Chen" , linux-mips@linux-mips.org, "Ralf Baechle" , "Steven J . Hill" , "Fuxin Zhang" , "Paul Burton" , "Zhangjin Wu" , "James Hogan" Date: Tue, 02 Apr 2019 14:38:27 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 12/99] MIPS: Align kernel load address to 64KB In-Reply-To: X-SA-Exim-Connect-IP: 167.98.27.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.65-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Huacai Chen 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 Signed-off-by: Paul Burton Patchwork: https://patchwork.linux-mips.org/patch/21131/ Cc: Ralf Baechle Cc: James Hogan Cc: Steven J . Hill Cc: linux-mips@linux-mips.org Cc: Fuxin Zhang Cc: Zhangjin Wu Signed-off-by: Ben Hutchings --- 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 #include #include +#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);