From patchwork Wed Feb 22 02:34:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 94290 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp721851qgi; Tue, 21 Feb 2017 18:35:47 -0800 (PST) X-Received: by 10.223.172.115 with SMTP id v106mr15654622wrc.49.1487730947332; Tue, 21 Feb 2017 18:35:47 -0800 (PST) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id 35si12995387wre.175.2017.02.21.18.35.47; Tue, 21 Feb 2017 18:35:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C41744B5BF; Wed, 22 Feb 2017 03:35:43 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bAGou8Bz0TvV; Wed, 22 Feb 2017 03:35:43 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 00DBE4B5D0; Wed, 22 Feb 2017 03:35:39 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BA7B54B309 for ; Wed, 22 Feb 2017 03:35:32 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6CxcT81iAmcZ for ; Wed, 22 Feb 2017 03:35:32 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by theia.denx.de (Postfix) with ESMTPS id 137884B372 for ; Wed, 22 Feb 2017 03:35:30 +0100 (CET) Received: from localhost.localdomain (softbank219027228038.bbtec.net [219.27.228.38]) (authenticated) by conuserg-08.nifty.com with ESMTP id v1M2YSPl013956; Wed, 22 Feb 2017 11:34:33 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com v1M2YSPl013956 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1487730873; bh=3Aw3hNOPMdsnjHBkBpEbEC7xkthWR/QVqAQcWbZKIYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WTB5eH19Gk8hZs9URxVjqifZ9sWaw/FEhwSVCt9ZA2wCXOD6TURONyIXwQAIUa/xl bwUsbG0uYrTlcC0FUxooCQfYK/M7Vit02ylt0za/G2EjRcHMlg9gV5L/EEJ+0yu0Lh A2SUn/BM8PmRP7banjSGt+s1BfZY7wl2EGYMQv3gOCa3UZz0JH+27mIqRR46GCGkuR K/8XoiWGZoqSYInAEozzBzRQpjdffkpN4NJKf1jTGr2SXoaTSqTtbl74R0kNbBAnnU aKBjVn8mwrEtvmKxiWdnHs+sfRTVvKUR8iPyF30Vium5CWg0rYikXg6a5NTqYS3HSv KNprE/5FsrJVQ== X-Nifty-SrcIP: [219.27.228.38] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Wed, 22 Feb 2017 11:34:26 +0900 Message-Id: <1487730866-19447-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1487730866-19447-1-git-send-email-yamada.masahiro@socionext.com> References: <1487730866-19447-1-git-send-email-yamada.masahiro@socionext.com> Cc: Scott Wood , Tom Rini Subject: [U-Boot] [PATCH 2/2] arm64: booti: allow to place kernel image anywhere in physical memory X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" At first, the ARM64 Linux booting requirement recommended that the kernel image be placed text_offset bytes from 2MB aligned base near the start of usable system RAM because memory below that base address was unusable at that time. This requirement was relaxed by Linux commit a7f8de168ace ("arm64: allow kernel Image to be loaded anywhere in physical memory"). Since then, the bit 3 of the flags field indicates the tolerance of the kernel physical placement. If this bit is set, the 2MB aligned base may be anywhere in physical memory. For details, see Documentation/arm64/booting.txt of Linux. The booti command should be also relaxed to not expect the kernel image at the start of the system RAM. Even when booting older kernel versions, it still makes sense to have some space below the kernel. For example, some firmware may sit at the start of the system RAM. After all, the most flexible way for booting the kernel is to respect the original images->ep instead of gd->bd->bi_dram[0].start. If image->ep (which is the address given to the booti command) already meets the address requirement, just use it. If not, relocate the kernel to the next 2MB aligned address. Signed-off-by: Masahiro Yamada --- cmd/booti.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 1.9.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/cmd/booti.c b/cmd/booti.c index f65f0e7..9408c34 100644 --- a/cmd/booti.c +++ b/cmd/booti.c @@ -11,6 +11,8 @@ #include #include #include +#include +#include DECLARE_GLOBAL_DATA_PTR; @@ -54,7 +56,9 @@ static int booti_setup(bootm_headers_t *images) * If we are not at the correct run-time location, set the new * correct location and then move the image there. */ - dst = gd->bd->bi_dram[0].start + le64_to_cpu(ih->text_offset); + dst = images->ep - ih->text_offset; + dst = ALIGN(dst, SZ_2M); + dst += ih->text_offset; unmap_sysmem(ih);