From patchwork Wed Dec 2 13:36:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1409738 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=JBtzFe/4; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CmKlM5qW8z9sSf for ; Thu, 3 Dec 2020 00:37:07 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 66E698269D; Wed, 2 Dec 2020 14:36:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="JBtzFe/4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A999D8269D; Wed, 2 Dec 2020 14:36:54 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 83C4D825F0 for ; Wed, 2 Dec 2020 14:36:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1606916192; bh=C/WuvDXoRSs7cqd2+pIlA7yz3xwaMGVDyyM2K5ct0MU=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date; b=JBtzFe/44VL1OU3p3ueUJvK1bVJnBez2rlxwS3zcE8rD1dn3fRjMzzMWSmHZBcx/g QyApDvCTgkZvuShNX9HhBAycFAemFnbO0qFJRCr3B2nfv4yzcUo0nP5h/UGY3DYpjq 9C5Z8syoJRkQl3WEoZ+ATt0jWeghj3pj+skjr00k= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from workstation5.fritz.box ([62.143.246.89]) by mail.gmx.com (mrgmx105 [212.227.17.174]) with ESMTPSA (Nemesis) id 1McY8T-1kBwVR0c3x-00d0KV; Wed, 02 Dec 2020 14:36:32 +0100 From: Heinrich Schuchardt To: Rick Chen Cc: Bin Meng , Sean Anderson , Simon Glass , u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH v3 1/1] riscv: reset after crash Date: Wed, 2 Dec 2020 14:36:26 +0100 Message-Id: <20201202133626.456340-1-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-Provags-ID: V03:K1:FjB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VrgNu3 JtW2JY8O9jC0YODAagoL6IbgjnKEm8LoC0tqcL3p6GEnrxZ9O+IRsxcqDv0DI9G6mhrVKPc1R kTF3M/yKYkCEm7ukUf2g== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean If an exception occurs on ARM or x86, we call panic() which will try to reset the board. Do the same on RISC-V. To avoid -Werror=format-zero-length move a '\n' to the string passed to panic. We don't need a message here as depending on CONFIG_PANIC_HANG we will either see ### ERROR ### Please RESET the board ### or resetting ... as next message. Reviewed-by: Rick Chen Signed-off-by: Heinrich Schuchardt --- v3: rebased v2: Remove a superfluous message passed to panic(). --- arch/riscv/lib/interrupts.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.29.2 diff --git a/arch/riscv/lib/interrupts.c b/arch/riscv/lib/interrupts.c index 35de98e8ce..fb3ce118c1 100644 --- a/arch/riscv/lib/interrupts.c +++ b/arch/riscv/lib/interrupts.c @@ -27,7 +27,7 @@ static void show_efi_loaded_images(uintptr_t epc) static void show_regs(struct pt_regs *regs) { #ifdef CONFIG_SHOW_REGS - printf("SP: " REG_FMT " GP: " REG_FMT " TP: " REG_FMT "\n", + printf("\nSP: " REG_FMT " GP: " REG_FMT " TP: " REG_FMT "\n", regs->sp, regs->gp, regs->tp); printf("T0: " REG_FMT " T1: " REG_FMT " T2: " REG_FMT "\n", regs->t0, regs->t1, regs->t2); @@ -45,7 +45,7 @@ static void show_regs(struct pt_regs *regs) regs->s7, regs->s8, regs->s9); printf("S10: " REG_FMT " S11: " REG_FMT " T3: " REG_FMT "\n", regs->s10, regs->s11, regs->t3); - printf("T4: " REG_FMT " T5: " REG_FMT " T6: " REG_FMT "\n\n", + printf("T4: " REG_FMT " T5: " REG_FMT " T6: " REG_FMT "\n", regs->t4, regs->t5, regs->t6); #endif } @@ -80,12 +80,12 @@ static void _exit_trap(ulong code, ulong epc, ulong tval, struct pt_regs *regs) epc, regs->ra, tval); /* Print relocation adjustments, but only if gd is initialized */ if (gd && gd->flags & GD_FLG_RELOC) - printf("EPC: " REG_FMT " RA: " REG_FMT " reloc adjusted\n\n", + printf("EPC: " REG_FMT " RA: " REG_FMT " reloc adjusted\n", epc - gd->reloc_off, regs->ra - gd->reloc_off); show_regs(regs); show_efi_loaded_images(epc); - hang(); + panic("\n"); } int interrupt_init(void)