From patchwork Mon Jun 4 18:09:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 925187 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="P++gNFRq"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 4102z61KS4z9ryk for ; Tue, 5 Jun 2018 04:10:10 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id E0796C21EA2; Mon, 4 Jun 2018 18:10:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 0DC30C21DFA; Mon, 4 Jun 2018 18:10:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6A7D2C21DFA; Mon, 4 Jun 2018 18:10:00 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by lists.denx.de (Postfix) with ESMTPS id 033B4C21C8B for ; Mon, 4 Jun 2018 18:10:00 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id l1-v6so81520wmb.2 for ; Mon, 04 Jun 2018 11:10:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=F2fvXX90L85UJYMb3ZJsgXOeyW8CeKjhA5/cXj83PL8=; b=P++gNFRq81/eHuO9UtLDiY2sZ1BNJ+bK4wh981yMMhRXq/10A/16zhScjnAzhfyOGO IuNIcVoefmkCYWZO7tT/SqUXUD6YBU34DyrINDgYaffyxtngvjfcC2bMXkXLNgwaJxJS dWocBc9h27ymg5ga8Z3Hfk1T4jxA5MeLS8bZaVzI078YISg3oFR1HuCPpbATke/Us4Fw VNl7VbWDjCP4XavTs2duQRancIj0sC7us8yxBFeH0g1HquV4dMyeHnivwqkKK7TagKzy OR8u/hmbLjq7inlWVTcC2C7FsvWs0v1UBsDnb9aY7uuZ5s5HoEgJd+I9WEJz9WJhuqDF FBJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=F2fvXX90L85UJYMb3ZJsgXOeyW8CeKjhA5/cXj83PL8=; b=IMIBLRlauHz59BbVoXyOigU+/HJ/i1724qGV4SU/CrzG0xo/lFiVzkCIc1k/7U/fG/ Yn8AJ/WPBt0tVjScoB9m7487cuT2K+1pfXhmTBSDN2luXKNTZuJMAt5SFIErWfPae4xv TTSYR11Z8kGGesOB4DJkTG/n2gkwdVm5LQkxHCJg2pd4RT+j0vKYqjpSFmH7lh0ZRt9o VBFnSa9SjEXhBsl/DChkdBG32kQMySLgpSPyAUo0F7E4NnJ742xCrFx9pY0jT4sEen2N Jo9LX5bVu1JwdWYMjwjNR9p1WSM4bLC3ImPAOSOYtNR/8ACK8XmnUEKKWmkROAbY0EJ3 v7Gw== X-Gm-Message-State: APt69E3EicNm0Gv35SECe+2Ttg7QYNEecBK2pCFh7Wg0jcKPXxYUqVhH /fG+65tMKKvaAuEyl12r0vW2zQsp X-Google-Smtp-Source: ADUXVKKifN75T85ev//N1/WnT/HLjlyq85vrDCv4zX8eb/T7HPqA3msgbXQ7dKix5+cvi2x/EJI1kA== X-Received: by 2002:a1c:43c5:: with SMTP id q188-v6mr10420637wma.69.1528135799397; Mon, 04 Jun 2018 11:09:59 -0700 (PDT) Received: from kurokawa.lan (ip-86-49-107-50.net.upcbroadband.cz. [86.49.107.50]) by smtp.gmail.com with ESMTPSA id w15-v6sm15564341wro.52.2018.06.04.11.09.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 11:09:58 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Date: Mon, 4 Jun 2018 20:09:54 +0200 Message-Id: <20180604180955.30850-1-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.16.2 Cc: Tom Rini , Marek Vasut Subject: [U-Boot] [PATCH V3 1/2] ARM: image: Add option for ignoring ep bit 3 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" Add option to the booti_setup() which indicates to it that the caller requires the image to be relocated to the beginning of the RAM and that the information whether the image can be located anywhere in RAM at 2 MiB aligned boundary or not is to be ignored. This is useful ie. in case the Image is wrapped in another envelope, ie. fitImage and not relocating it but moving it would corrupt the envelope. Signed-off-by: Marek Vasut Cc: Bin Chen Cc: Masahiro Yamada Cc: Tom Rini --- V2: Rename ignore_ep to force_reloc V3: No change --- arch/arm/lib/image.c | 5 +++-- cmd/booti.c | 2 +- include/image.h | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/arm/lib/image.c b/arch/arm/lib/image.c index 1a04e2b875..22c705a881 100644 --- a/arch/arm/lib/image.c +++ b/arch/arm/lib/image.c @@ -26,7 +26,8 @@ struct Image_header { uint32_t res5; }; -int booti_setup(ulong image, ulong *relocated_addr, ulong *size) +int booti_setup(ulong image, ulong *relocated_addr, ulong *size, + int force_reloc) { struct Image_header *ih; uint64_t dst; @@ -63,7 +64,7 @@ int booti_setup(ulong image, ulong *relocated_addr, ulong *size) * images->ep. Otherwise, relocate the image to the base of RAM * since memory below it is not accessible via the linear mapping. */ - if (le64_to_cpu(ih->flags) & BIT(3)) + if (!force_reloc && (le64_to_cpu(ih->flags) & BIT(3))) dst = image - text_offset; else dst = gd->bd->bi_dram[0].start; diff --git a/cmd/booti.c b/cmd/booti.c index 45fbb99b68..6d449b1995 100644 --- a/cmd/booti.c +++ b/cmd/booti.c @@ -37,7 +37,7 @@ static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc, debug("* kernel: cmdline image address = 0x%08lx\n", ld); } - ret = booti_setup(ld, &relocated_addr, &image_size); + ret = booti_setup(ld, &relocated_addr, &image_size, 0); if (ret != 0) return 1; diff --git a/include/image.h b/include/image.h index 95d5934344..1ef6518308 100644 --- a/include/image.h +++ b/include/image.h @@ -881,9 +881,11 @@ int bootz_setup(ulong image, ulong *start, ulong *end); * @image: Address of image * @start: Returns start address of image * @size : Returns size image + * @force_reloc: Ignore image->ep field, always place image to RAM start * @return 0 if OK, 1 if the image was not recognised */ -int booti_setup(ulong image, ulong *relocated_addr, ulong *size); +int booti_setup(ulong image, ulong *relocated_addr, ulong *size, + int force_reloc); /*******************************************************************/ /* New uImage format specific code (prefixed with fit_) */ From patchwork Mon Jun 4 18:09:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 925188 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mQ9J/SIA"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 4102zz6Kx0z9ry1 for ; Tue, 5 Jun 2018 04:10:55 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 8F19DC21EA2; Mon, 4 Jun 2018 18:10:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id ECD31C21E85; Mon, 4 Jun 2018 18:10:14 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 12137C21F03; Mon, 4 Jun 2018 18:10:06 +0000 (UTC) Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by lists.denx.de (Postfix) with ESMTPS id BBF3FC21E88 for ; Mon, 4 Jun 2018 18:10:02 +0000 (UTC) Received: by mail-wr0-f196.google.com with SMTP id 94-v6so45105132wrf.5 for ; Mon, 04 Jun 2018 11:10:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=hG8KY0xCi5+FZyQoqbl7WbaCf3u0TyO+MB07lAeS+kY=; b=mQ9J/SIAueclaBvBH1bcfkDTtEnqV1wALiczGU4jFzE3S212042cFYPFYjZTxUhfxB aGB/GItuvJivpzmUkNQQn4KOVi6UpdBuWbwbuLF9vFtEJTHs6MIO810BuvkDkE5Ij7Ca puf4LSGwx3TswEU101eNY38Bc5JSfcPu3mT1xxqgGgGgMCc0ZNWnlJt0XY5bmLtJDxG5 9xVD57oBOOGwGr6zCopdBcTS8Gp7blQ0d/FZLGeNShABDguo9tLxym+NGvO/rDt3CqqC en+PgcDNZYZo75Jq5qVXulGnqiyePKetTQU4GdbRAejrqqB0flMNZKzlgFwPBWLaVLwk hgfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=hG8KY0xCi5+FZyQoqbl7WbaCf3u0TyO+MB07lAeS+kY=; b=h026v9sjFca2wQynp4IKzJJ6iUIwSTmaKIOlW+aRxc/oJ3YV4WfZ8Ls8fbt9kWd0x1 9aXmnaLGD927jYFOGjil8GIlYA0Av3hQQLBgrC+rSTxtIAD8OsRZfGbjNuj8zHXc81ZJ +EJkRh5ZAYB06wxT2pC6Sc6yhnCJPJjVFUjPJroIRfbHdtSJfqw3PgO6DI3B83IuaD+2 fPwm1jwr8iD3/BLRttPW5V3Pdusc6lS2ZMtfbs3zsTjAwrhi+RMl11Vz3S1pO+YWllNy AdjYM8rDxJQ2Fx6WuGktpJeiRE7CEtC9su2evx7VMtnNCq3AT/HMu6b4PnidEhuEEaSC j/2A== X-Gm-Message-State: ALKqPwejfPnkR6/SNScIFH3guB8eQKUk+RfVHOwfiygjHUm1Fg7ZGRE0 oNTsk82n2wPOLH20urGbkQIeWXVg X-Google-Smtp-Source: ADUXVKLAOBiNEjN/O3878kr74lovcxHyV/yWMmnuGRiuCY9MobvdX0lQiu57LB8on90H/pICXMnGMg== X-Received: by 2002:adf:e881:: with SMTP id d1-v6mr14933538wrm.43.1528135802115; Mon, 04 Jun 2018 11:10:02 -0700 (PDT) Received: from kurokawa.lan (ip-86-49-107-50.net.upcbroadband.cz. [86.49.107.50]) by smtp.gmail.com with ESMTPSA id w15-v6sm15564341wro.52.2018.06.04.11.10.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 11:10:01 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Date: Mon, 4 Jun 2018 20:09:55 +0200 Message-Id: <20180604180955.30850-2-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180604180955.30850-1-marek.vasut+renesas@gmail.com> References: <20180604180955.30850-1-marek.vasut+renesas@gmail.com> Cc: Tom Rini , Marek Vasut Subject: [U-Boot] [PATCH V3 2/2] bootm: Handle kernel_noload on arm64 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" The ARM64 has 2 MiB alignment requirement for the kernel. When using fitImage, this requirement may by violated, the kernel will thus be executed from unaligned address and fail to boot. Do what booti does and run booti_setup() for kernel_noload images on arm64 to obtain a suitable aligned address to which the image shall be relocated. Signed-off-by: Marek Vasut Cc: Bin Chen Cc: Masahiro Yamada Cc: Tom Rini --- V2: Protect the ARM64 booti bit with if IS_ENABLED(CMD_BOOTI) V3: Use if() instead of #ifdef --- common/bootm.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/common/bootm.c b/common/bootm.c index e789f6818a..fad8480a7a 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -202,8 +202,23 @@ static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc, } if (images.os.type == IH_TYPE_KERNEL_NOLOAD) { - images.os.load = images.os.image_start; - images.ep += images.os.load; + if (CONFIG_IS_ENABLED(CMD_BOOTI) && + images.os.arch == IH_ARCH_ARM64) { + ulong image_addr; + ulong image_size; + + ret = booti_setup(images.os.image_start, &image_addr, + &image_size, 1); + if (ret != 0) + return 1; + + images.os.type = IH_TYPE_KERNEL; + images.os.load = image_addr; + images.ep = image_addr; + } else { + images.os.load = images.os.image_start; + images.ep += images.os.image_start; + } } images.os.start = map_to_sysmem(os_hdr);