All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/1] riscv: reset after crash
@ 2020-09-26 23:21 Heinrich Schuchardt
       [not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA4748521@ATCPCS16.andestech.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Heinrich Schuchardt @ 2020-09-26 23:21 UTC (permalink / raw)
  To: u-boot

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.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
v2:
	Remove a superfluous message passed to panic().
---
 arch/riscv/lib/interrupts.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/riscv/lib/interrupts.c b/arch/riscv/lib/interrupts.c
index 8ff40f0f36..43b10a2b9b 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
 }
@@ -79,12 +79,12 @@ static void _exit_trap(ulong code, ulong epc, ulong tval, struct pt_regs *regs)
 	printf("EPC: " REG_FMT " RA: " REG_FMT " TVAL: " REG_FMT "\n",
 	       epc, regs->ra, tval);
 	if (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)
--
2.28.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 1/1] riscv: reset after crash
       [not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA4748521@ATCPCS16.andestech.com>
@ 2020-09-29  8:22   ` Rick Chen
  2020-09-29  9:27     ` Heinrich Schuchardt
  0 siblings, 1 reply; 4+ messages in thread
From: Rick Chen @ 2020-09-29  8:22 UTC (permalink / raw)
  To: u-boot

> From: Heinrich Schuchardt [mailto:xypron.glpk at gmx.de]
> Sent: Sunday, September 27, 2020 7:21 AM
> To: Rick Jian-Zhi Chen(???)
> Cc: Simon Glass; Sean Anderson; Bin Meng; u-boot at lists.denx.de; Heinrich Schuchardt
> Subject: [PATCH v2 1/1] riscv: reset after crash
>
> 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.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> v2:
>         Remove a superfluous message passed to panic().
> ---
>  arch/riscv/lib/interrupts.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/riscv/lib/interrupts.c b/arch/riscv/lib/interrupts.c
> index 8ff40f0f36..43b10a2b9b 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
>  }
> @@ -79,12 +79,12 @@ static void _exit_trap(ulong code, ulong epc, ulong tval, struct pt_regs *regs)
>         printf("EPC: " REG_FMT " RA: " REG_FMT " TVAL: " REG_FMT "\n",
>                epc, regs->ra, tval);
>         if (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)
> --
> 2.28.0

Reviewed-by: Rick Chen <rick@andestech.com>

BTW, it conflicts with Sean's [PATCH v3 0/7] riscv: Correctly handle
IPIs already pending upon boot

error: patch failed: arch/riscv/lib/interrupts.c:79
error: arch/riscv/lib/interrupts.c: patch does not apply
Patch failed at 0001 riscv: reset after crash

Thanks,
Rick

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/1] riscv: reset after crash
  2020-09-29  8:22   ` Rick Chen
@ 2020-09-29  9:27     ` Heinrich Schuchardt
  2020-09-30  2:52       ` Rick Chen
  0 siblings, 1 reply; 4+ messages in thread
From: Heinrich Schuchardt @ 2020-09-29  9:27 UTC (permalink / raw)
  To: u-boot

On 29.09.20 10:22, Rick Chen wrote:
>> From: Heinrich Schuchardt [mailto:xypron.glpk at gmx.de]
>> Sent: Sunday, September 27, 2020 7:21 AM
>> To: Rick Jian-Zhi Chen(???)
>> Cc: Simon Glass; Sean Anderson; Bin Meng; u-boot at lists.denx.de; Heinrich Schuchardt
>> Subject: [PATCH v2 1/1] riscv: reset after crash
>>
>> 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.
>>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
>> ---
>> v2:
>>         Remove a superfluous message passed to panic().
>> ---
>>  arch/riscv/lib/interrupts.c | 8 ++++----
>>  1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/riscv/lib/interrupts.c b/arch/riscv/lib/interrupts.c
>> index 8ff40f0f36..43b10a2b9b 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
>>  }
>> @@ -79,12 +79,12 @@ static void _exit_trap(ulong code, ulong epc, ulong tval, struct pt_regs *regs)
>>         printf("EPC: " REG_FMT " RA: " REG_FMT " TVAL: " REG_FMT "\n",
>>                epc, regs->ra, tval);
>>         if (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)
>> --
>> 2.28.0
>
> Reviewed-by: Rick Chen <rick@andestech.com>
>
> BTW, it conflicts with Sean's [PATCH v3 0/7] riscv: Correctly handle
> IPIs already pending upon boot
>
> error: patch failed: arch/riscv/lib/interrupts.c:79
> error: arch/riscv/lib/interrupts.c: patch does not apply
> Patch failed at 0001 riscv: reset after crash
>
> Thanks,
> Rick
>

Thanks for reviewing. Do you have a git repository and branch on which I
should rebase my patch? Or will you handle the rebase?

Best regards

Heinrich

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/1] riscv: reset after crash
  2020-09-29  9:27     ` Heinrich Schuchardt
@ 2020-09-30  2:52       ` Rick Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Rick Chen @ 2020-09-30  2:52 UTC (permalink / raw)
  To: u-boot

Hi Heinrich

> On 29.09.20 10:22, Rick Chen wrote:
> >> From: Heinrich Schuchardt [mailto:xypron.glpk at gmx.de]
> >> Sent: Sunday, September 27, 2020 7:21 AM
> >> To: Rick Jian-Zhi Chen(???)
> >> Cc: Simon Glass; Sean Anderson; Bin Meng; u-boot at lists.denx.de; Heinrich Schuchardt
> >> Subject: [PATCH v2 1/1] riscv: reset after crash
> >>
> >> 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.
> >>
> >> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> >> ---
> >> v2:
> >>         Remove a superfluous message passed to panic().
> >> ---
> >>  arch/riscv/lib/interrupts.c | 8 ++++----
> >>  1 file changed, 4 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/arch/riscv/lib/interrupts.c b/arch/riscv/lib/interrupts.c
> >> index 8ff40f0f36..43b10a2b9b 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
> >>  }
> >> @@ -79,12 +79,12 @@ static void _exit_trap(ulong code, ulong epc, ulong tval, struct pt_regs *regs)
> >>         printf("EPC: " REG_FMT " RA: " REG_FMT " TVAL: " REG_FMT "\n",
> >>                epc, regs->ra, tval);
> >>         if (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)
> >> --
> >> 2.28.0
> >
> > Reviewed-by: Rick Chen <rick@andestech.com>
> >
> > BTW, it conflicts with Sean's [PATCH v3 0/7] riscv: Correctly handle
> > IPIs already pending upon boot
> >
> > error: patch failed: arch/riscv/lib/interrupts.c:79
> > error: arch/riscv/lib/interrupts.c: patch does not apply
> > Patch failed at 0001 riscv: reset after crash
> >
> > Thanks,
> > Rick
> >
>
> Thanks for reviewing. Do you have a git repository and branch on which I
> should rebase my patch? Or will you handle the rebase?

You can rebase on u-boot-riscv/next.

Thanks,
Rick

>
> Best regards
>
> Heinrich

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-09-30  2:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-26 23:21 [PATCH v2 1/1] riscv: reset after crash Heinrich Schuchardt
     [not found] ` <752D002CFF5D0F4FA35C0100F1D73F3FA4748521@ATCPCS16.andestech.com>
2020-09-29  8:22   ` Rick Chen
2020-09-29  9:27     ` Heinrich Schuchardt
2020-09-30  2:52       ` Rick Chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.