From patchwork Tue Dec 21 14:49:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guilherme G. Piccoli" X-Patchwork-Id: 12696985 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D3603C433EF for ; Tue, 21 Dec 2021 14:52:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=KTWs/0U3nJkTGgHXjBnh7MKcF+0F5MwJYZrhpsfl+fU=; b=G5OlaAk6owpFJR Vre5S3Pow67BPUM29HudUpAHqQghs5b1hFmXWHurVBNdcDZNt6I+SxMWuzWYvYOy3GTkYKybzmX1b U++9CQvcR5vAKojHx1fMFX/IoeNLV5b90tfJzT+xDWalEOsZj4dzi482wN7v8JIjHUZ8t6RZbAhRC 1qD9/KBh2oXzw9D20MuMvQSxIcFK5rHoTmwknoWpZ/VNZ9xq1NOWh4CutNIrRZFIzXl4hLsVioL3K dCI6IvULGEJZzxL8YReMwLDPWxXReIbkRiC+ShLa4vhwRaCH0PyzEv1JrFipupPx6akTs7YGvaa5T AjbhmLPIBpxNMbc+vTLw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mzgTF-007CAf-0h; Tue, 21 Dec 2021 14:50:29 +0000 Received: from fanzine2.igalia.com ([213.97.179.56]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mzgTB-007C9g-Ga for linux-arm-kernel@lists.infradead.org; Tue, 21 Dec 2021 14:50:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=/gsqKWPtdExpf/zsaK9m+MFdhDOqOcqupHtAeP3pcNI=; b=gE6mFOEIiw001FJVz1bl0ebTzb L5yvzfr64wkqRD/eQDR/c4N+G5gnkELq3p0UHNkW3tDcn+kV6TrCzWQqtdrLBY19TvMEDczHxNB8N xKffST6PN6NW9FghjKIG3/AfX5qJSj9XSFuGpvh1bw+MONxxBO078vU96u/yOq+BCda6PFjDAxlqc BLYGFGPTHUehUo3yjZS+78snuE5H/BtbMQwQallBxhMXdbG7tl8x9HcafEoE/tsxYxM5ZRsEzgERw 1K5Lry78uNrOqYRU1M+K/AhYOv9+knzL3Ta5a/ppFpS2Tw5rw3b5W6PpHddLAanayI2x4U07Biql1 QYTf4i5g==; Received: from 200-153-146-242.dsl.telesp.net.br ([200.153.146.242] helo=localhost) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1mzgT8-0001JV-4W; Tue, 21 Dec 2021 15:50:22 +0100 From: "Guilherme G. Piccoli" To: linux-arm-kernel@lists.infradead.org Cc: catalin.marinas@arm.com, will@kernel.org, broonie@kernel.org, u.kleine-koenig@pengutronix.de, gpiccoli@igalia.com, kernel@gpiccoli.net, robin.murphy@arm.com Subject: [PATCH V2] arm64: Fix early pointer print plus improve comment Date: Tue, 21 Dec 2021 11:49:58 -0300 Message-Id: <20211221144958.1529612-1-gpiccoli@igalia.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211221_065025_578902_F5329A40 X-CRM114-Status: GOOD ( 13.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org When facing a really early issue on DT parsing we have currently a message that shows both the physical and virtual address of the FDT. The printk pointer modifier there is not right for the virtual address, due to the hashed address stuff, so hereby we fix that. Also, we tried to improve a bit the commenting on that function, given that if kernel fails there, it just hangs forever in a cpu_relax() loop. The reason we cannot BUG/panic is that is too early to do so; thanks to Mark Brown for pointing that on IRC. Signed-off-by: Guilherme G. Piccoli --- V2: Fixing the right pointer here - it's the virtual one, not the physical! Thanks a bunch Robin Murphy for the review. arch/arm64/kernel/setup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index be5f85b0a24d..172463ea6877 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -189,11 +189,15 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys) if (!dt_virt || !early_init_dt_scan(dt_virt)) { pr_crit("\n" - "Error: invalid device tree blob at physical address %pa (virtual address 0x%p)\n" + "Error: invalid device tree blob at physical address %pa (virtual address 0x%px)\n" "The dtb must be 8-byte aligned and must not exceed 2 MB in size\n" "\nPlease check your bootloader.", &dt_phys, dt_virt); + /* Note that in this _really_ early stage we cannot even BUG() + * or oops, so the least terrible thing to do is cpu_relax(), + * or else we could end-up printing non-initialized data, etc. + */ while (true) cpu_relax(); }