From patchwork Thu Aug 8 15:16:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 2841297 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 70F5CBF546 for ; Thu, 8 Aug 2013 15:30:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1950C20509 for ; Thu, 8 Aug 2013 15:30:14 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 72BB0204D5 for ; Thu, 8 Aug 2013 15:30:12 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V7SAE-0001RV-CX; Thu, 08 Aug 2013 15:30:10 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V7SAB-0000vC-SE; Thu, 08 Aug 2013 15:30:07 +0000 Received: from smtp.citrix.com ([66.165.176.89]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V7SA8-0000tR-Fr for linux-arm-kernel@lists.infradead.org; Thu, 08 Aug 2013 15:30:05 +0000 X-IronPort-AV: E=Sophos;i="4.89,840,1367971200"; d="scan'208";a="42558885" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO01.CITRIX.COM with ESMTP/TLS/AES128-SHA; 08 Aug 2013 15:29:40 +0000 Received: from norwich.cam.xci-test.com (10.80.248.129) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.2.342.4; Thu, 8 Aug 2013 11:29:24 -0400 Received: from cosworth.uk.xensource.com ([10.80.16.52] ident=ianc) by norwich.cam.xci-test.com with esmtp (Exim 4.72) (envelope-from ) id 1V7Rwk-0004yu-U9; Thu, 08 Aug 2013 15:16:14 +0000 From: Ian Campbell To: Subject: [PATCH v2] arm: update advice on kernel, initramfs and FDT load address. Date: Thu, 8 Aug 2013 16:16:14 +0100 Message-ID: <1375974974-31603-1-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.2.5 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130808_113004_703874_9E0FF760 X-CRM114-Status: GOOD ( 15.34 ) X-Spam-Score: -6.9 (------) Cc: Nicolas Pitre , Roy Franz , Dave Martin , Russell King , Ian Campbell , Will Deacon , Grant Likely X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP - Recommend that the kernel be placed under 128MiB, this is required if CONFIG_AUTO_ZRELADDR=y and good (or at least not bad) advice even if CONFIG_AUTO_ZRELADDR=n. - Recommend that a zImage kernel be placed above 32MiB, this avoids the need to relocate prior to decompression, which can speed up boot. - Add basic info on the requirements when loading a raw (non-zImage) kernel which are stricter than the zImage requirements. - Recommend that the DTB be placed after the 128MiB boundary, avoiding any potential conflict with the kernel decompressor, and within the lowmem region. In practice it could follow the kernel loaded after 32MiB, assuming the kernel decompesses to less than 32MiB, but the 128MiB recommendation is simple and unambiguous. - Add similar recommendation regarding initramfs. Signed-off-by: Ian Campbell Cc: Russell King Cc: Nicolas Pitre Cc: Will Deacon Cc: Dave Martin Cc: Grant Likely Cc: Roy Franz Cc: linux-arm-kernel@lists.infradead.org --- v2: Update based upon discussion with Russell, Nico, Will. Unconditionally recommend loading the kernel below 128MiB, but above 32MiB. Recommend loading DTB at 128MiB and initramfs right after. Try to focus on concrete recommendations without getting into to much into the details of why or other alternatives/corner cases. --- Documentation/arm/Booting | 42 ++++++++++++++++++++++++++++++++---------- 1 files changed, 32 insertions(+), 10 deletions(-) diff --git a/Documentation/arm/Booting b/Documentation/arm/Booting index 0c1f475..6fcd45e 100644 --- a/Documentation/arm/Booting +++ b/Documentation/arm/Booting @@ -18,7 +18,8 @@ following: 2. Initialise one serial port. 3. Detect the machine type. 4. Setup the kernel tagged list. -5. Call the kernel image. +5. Load initramfs. +6. Call the kernel image. 1. Setup and initialise RAM @@ -120,12 +121,27 @@ tagged list. The boot loader must pass at a minimum the size and location of the system memory, and the root filesystem location. The dtb must be placed in a region of memory where the kernel decompressor will not -overwrite it. The recommended placement is in the first 16KiB of RAM -with the caveat that it may not be located at physical address 0 since -the kernel interprets a value of 0 in r2 to mean neither a tagged list -nor a dtb were passed. +overwrite it while also with the region which will be covered by the +kernel's low-memory mapping. -5. Calling the kernel image +A safe location is just above the 128MiB boundary from start of RAM. + +5. Load initramfs. +------------------ + +Existing boot loaders: OPTIONAL +New boot loaders: OPTIONAL + +If an initramfs is in use then, as with the dtb, it must be placed in +a region of memory where the kernel decompressor will not overwrite it +while also with the region which will be covered by the kernel's +low-memory mapping. + +A safe location is just above the device tree blob which itself will +be loaded just above the 128MiB boundary from the start of RAM as +recommended above. + +6. Calling the kernel image --------------------------- Existing boot loaders: MANDATORY @@ -136,11 +152,17 @@ is stored in flash, and is linked correctly to be run from flash, then it is legal for the boot loader to call the zImage in flash directly. -The zImage may also be placed in system RAM (at any location) and -called there. Note that the kernel uses 16K of RAM below the image -to store page tables. The recommended placement is 32KiB into RAM. +The zImage may also be placed in system RAM and called there. The +kernel should be placed in the first 128MiB of RAM. It is recommended +that it is loaded above 32MiB in order to avoid the need to relocate +prior to decompression, which will make the boot process slightly +faster. + +When booting a raw (non-zImage) kernel the constraints are tighter. +In this case the kernel must be loaded at an offset into system equal +to TEXT_OFFSET - PAGE_OFFSET. -In either case, the following conditions must be met: +In any case, the following conditions must be met: - Quiesce all DMA capable devices so that memory does not get corrupted by bogus network packets or disk data. This will save