From patchwork Wed Jun 13 04:13:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 928644 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="ru6MKktu"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 415D0q4HzGz9s2g for ; Wed, 13 Jun 2018 14:14:35 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 4CA31C21D65; Wed, 13 Jun 2018 04:14:11 +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_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 C74D1C21DFB; Wed, 13 Jun 2018 04:13:50 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id F06FEC21C93; Wed, 13 Jun 2018 04:13:47 +0000 (UTC) Received: from mail-pg0-f66.google.com (mail-pg0-f66.google.com [74.125.83.66]) by lists.denx.de (Postfix) with ESMTPS id 58169C21BE5 for ; Wed, 13 Jun 2018 04:13:47 +0000 (UTC) Received: by mail-pg0-f66.google.com with SMTP id l65-v6so603372pgl.8 for ; Tue, 12 Jun 2018 21:13:47 -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=G0ga+F6Jhvy+WVyE6GR4vj6fMJW8o6FWkmstqmObls4=; b=ru6MKktuuLdANL7ojVZeRJvTgROncnIjWqGGHetAdOxXVyafI+rClj7pA6VhGcPCAw Ydc5z7S3gvm+/KvE67h7JJ26m1TFBN8YNXJOKuX6nJT5tIcDDfot0YAJ7ZSfa+QDXf31 7YP1iuUVhBTtNPlPeHA4d3VUbQhv4Fxq5mrKBzPUzBEqHU4ThFD32G7RAfycpAvGgKCr i2jU36U6UB97qgU+rmcamBK85VYaRMYG4fo/rDjqv0IS11C7VGkJjdSK9vK0g3MIYY6e PXJmERzUlhzXuHFxPg9V5OEEz9+19q6JniM6yuBf9wM3/2H1cfZyMu1X5xZ/Knwn37gV XPGw== 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=G0ga+F6Jhvy+WVyE6GR4vj6fMJW8o6FWkmstqmObls4=; b=SsxHieE5gVkXrCai9/ZPFBdhFI8uW0J4XIhCCfQ1qXJMCBfP4U6zBQszhtKjF6Q6tk 4lSefVkTG+BByJaESEiAUq+qWWiqU5tbo6YzbrmMa9NHmBkJcyZQtIV9IZC0CAMXT4UU nKUvKJyZjdecW/3V72mk074XDtmI7ah7C5xJI/Q/j51NwNIoSTk+KgeBmX9suvmy4snM q2o6tXzvCYOB5TVfBkuwtYABbD4wvazNlCidvvHVS9ytp8/6D8jcMbhnbkqnorDHM2ai XhPllMYlbevx7PBAh1HF76T/RHxcpJEXMl6pzBc6YyHoVtNUZg1Sw6vdmT2avjXJc9M6 EVeA== X-Gm-Message-State: APt69E2GFKR0NLgI+Xj+J9vThFGIVke/O+6IUHqRa4LVtWOVAo7bQAcp uWw9ZPmbgDQns5F1pd6Xsx1J+nOP X-Google-Smtp-Source: ADUXVKLsY5p/4qzSEAG8KWvt9HWZOHaW1jJCmqLz/zy69aSLdW2SPF1WbVs3wSyd0cc9A8dGoP8o/A== X-Received: by 2002:a65:46cb:: with SMTP id n11-v6mr2603330pgr.193.1528863225764; Tue, 12 Jun 2018 21:13:45 -0700 (PDT) Received: from localhost.localdomain ([1.1.125.124]) by smtp.gmail.com with ESMTPSA id v5-v6sm2727444pfd.1.2018.06.12.21.13.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Jun 2018 21:13:45 -0700 (PDT) From: Marek Vasut X-Google-Original-From: Marek Vasut To: u-boot@lists.denx.de Date: Wed, 13 Jun 2018 06:13:33 +0200 Message-Id: <20180613041333.17943-2-marek.vasut+renesas@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180613041333.17943-1-marek.vasut+renesas@gmail.com> References: <20180613041333.17943-1-marek.vasut+renesas@gmail.com> Cc: Tom Rini , Marek Vasut Subject: [U-Boot] [PATCH V4 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 V4: Switch force_reloc to bool --- common/bootm.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/common/bootm.c b/common/bootm.c index e789f6818a..e517d9f118 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, true); + 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);