Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3772288ybv; Tue, 25 Feb 2020 07:04:36 -0800 (PST) X-Google-Smtp-Source: APXvYqxp4pXzxRh5K2GqDnKmUHJbf0fc54T2qPg+zyEuyVaTx/yKQQ5KC2Vs7wUyl+r77qJ1dhBI X-Received: by 2002:a9d:32f:: with SMTP id 44mr43959678otv.234.1582643076436; Tue, 25 Feb 2020 07:04:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582643076; cv=none; d=google.com; s=arc-20160816; b=JByXNIHLSVgOUmNUKI99GCRrG4Jl0v0T/pUCrFgdqAJOXGO5fFUkxfGO56WtA7Fjxa CXsd/bi9dyIoSjZ1q4N29mqQnZxJJRg6R+Q1YxlgJEUUvMIgKj1aN5q81yoD0uYzB0ds 1/4El2c4p6GiQruTRxlLCp55KRZod+aRrZIH6qEzWW1CFgASGHtRhtw68ai8hucCDx2P G8iT9VE2975wmscuX8i81/tbUKxyJfn/rZj3ivPkwKHUEiv+dj7ok6LGsUjIcru4kwKz wsDDqNatsgagB/0mhYWT/Ve72uqIReSVy7HuRsVAJNBTyCwkS4kt5O8sBIw9vHvCqbpL Z5iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=GbcUrPktDh5EBjlAmmDVjxjrfNt6fdaalrCfwl4IJ9c=; b=N0yo8+hhe49e4w2jCvn78wC+xaN7oOB9FbkNapby+RIc0MItKt4pWy9ZfALFXEfHIi SyPrPy+WT0OeFocCBzHV/uWr65ae/9JBE7KY7gQPxnpxAPtWTL9mDJVSPDFVj3rvkWqe WyJqY8P1louAGZIaRRrInXA69PpmL/1qTpwH49LVBL8rXmxaaUCMtPaemCwZeu/28c9s aWW9mwEzo1zm9dstwXhtuBRnjdsGRw17dU3b3fI6GWtI2honIVxI3AxyY0KHUG1MPGgq HP9v4y6Yy1WbOwUCfr3jg7EZWF/xdJ0U7I7C3ikZ41zVCDIkf7A1Ff+/Qz6amLNmQMgW 92ng== 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 y186si6909703oig.241.2020.02.25.07.04.14; Tue, 25 Feb 2020 07:04:36 -0800 (PST) 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 S1730466AbgBYOsA (ORCPT + 99 others); Tue, 25 Feb 2020 09:48:00 -0500 Received: from michel.telenet-ops.be ([195.130.137.88]:46106 "EHLO michel.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729377AbgBYOsA (ORCPT ); Tue, 25 Feb 2020 09:48:00 -0500 Received: from ramsan ([84.195.182.253]) by michel.telenet-ops.be with bizsmtp id 72nr2200M5USYZQ062nsVf; Tue, 25 Feb 2020 15:47:57 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan with esmtp (Exim 4.90_1) (envelope-from ) id 1j6bV1-0007yI-Rg; Tue, 25 Feb 2020 15:47:51 +0100 Received: from geert by rox.of.borg with local (Exim 4.90_1) (envelope-from ) id 1j6bV1-0005AV-Oq; Tue, 25 Feb 2020 15:47:51 +0100 From: Geert Uytterhoeven To: Marek Szyprowski , Russell King , Nicolas Pitre , Arnd Bergmann , Eric Miao , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Cc: Chris Brandt , Linux ARM , Linux-Renesas , linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] ARM: boot: Fix ATAGs with appended DTB Date: Tue, 25 Feb 2020 15:47:49 +0100 Message-Id: <20200225144749.19815-1-geert+renesas@glider.be> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At early boot, register r8 may contain an ATAGs or DTB pointer. When an appended DTB is found, its address is stored in r8, for extraction of the RAM base address later. However, if r8 contained an ATAGs pointer before, that pointer will be lost, and the provided ATAGs is no longer folded into the provided DTB. Fix this by leaving r8 untouched. Fixes: 137e522593918be2 ("ARM: 8960/1: boot: Obtain start of physical memory from DTB") Reported-by: Marek Szyprowski Signed-off-by: Geert Uytterhoeven --- Not tested with ATAGs, only with [uz]Image + DTB, and zImage with appended DTB. --- arch/arm/boot/compressed/head.S | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S index 339d4b4cfbbeed15..a351ed2bc195ed8d 100644 --- a/arch/arm/boot/compressed/head.S +++ b/arch/arm/boot/compressed/head.S @@ -267,16 +267,18 @@ not_angel: cmp r0, r1 @ do we have a DTB there? bne 1f - mov r8, r6 @ use it if so /* preserve 64-bit alignment */ add r5, r5, #7 bic r5, r5, #7 - add sp, sp, r5 @ and move stack above it + add sp, sp, r5 @ if so, move stack above DTB + mov r0, r6 @ and extract memory start from DTB + b 2f 1: #endif /* CONFIG_ARM_APPENDED_DTB */ mov r0, r8 +2: bl fdt_get_mem_start mov r4, r0 cmp r0, #-1 -- 2.17.1