[PATCH 1/3] lib: sbi: Print error message during warm boot

Wu Fei atwufei at 163.com
Thu Oct 9 05:17:48 PDT 2025


On 9/30/25 19:33, Anup Patel wrote:
> On Wed, Aug 6, 2025 at 6:39 AM <wu.fei9 at sanechips.com.cn> wrote:
>> It's helpful to print error messages for debugging, here add them in
>> warm boot path just as those in the cold boot path.
>>
>> Signed-off-by: Wu Fei <wu.fei9 at sanechips.com.cn>
>> ---
>>   lib/sbi/sbi_init.c | 65 ++++++++++++++++++++++++++++++++++++----------
>>   1 file changed, 52 insertions(+), 13 deletions(-)
>>
>> diff --git a/lib/sbi/sbi_init.c b/lib/sbi/sbi_init.c
>> index 84a6374..2e1ca66 100644
>> --- a/lib/sbi/sbi_init.c
>> +++ b/lib/sbi/sbi_init.c
>> @@ -415,60 +415,99 @@ static void __noreturn init_warm_startup(struct sbi_scratch *scratch,
>>
>>          /* Note: This has to be first thing in warmboot init sequence */
>>          rc = sbi_hsm_init(scratch, false);
>> -       if (rc)
>> +       if (rc) {
>> +               sbi_printf("%s: hart %d hsm init failed (error %d)\n",
>> +                          __func__, hartid, rc);
>>                  sbi_hart_hang();
>> +       }
> Looks like this patch was not generated using git format-patch or
> not send using git send-email.


Right, my corporate email account was not ready for git send-email yet 
at that time,

I will try it again.


Thanks,

Fei.

>
> I am unable to apply this patch.
>
> Regards,
> Anup
>
>>          rc = sbi_platform_early_init(plat, false);
>> -       if (rc)
>> +       if (rc) {
>> +               sbi_printf("%s: hart %d platform early init failed (error %d)\n",
>> +                          __func__, hartid, rc);
>>                  sbi_hart_hang();
>> +       }
>>
>>          rc = sbi_hart_init(scratch, false);
>> -       if (rc)
>> +       if (rc) {
>> +               sbi_printf("%s: hart %d hart init failed (error %d)\n",
>> +                          __func__, hartid, rc);
>>                  sbi_hart_hang();
>> +       }
>>
>>          rc = sbi_pmu_init(scratch, false);
>> -       if (rc)
>> +       if (rc) {
>> +               sbi_printf("%s: hart %d pmu init failed (error %d)\n",
>> +                          __func__, hartid, rc);
>>                  sbi_hart_hang();
>> +       }
>>
>>          rc = sbi_dbtr_init(scratch, false);
>> -       if (rc)
>> +       if (rc) {
>> +               sbi_printf("%s: hart %d dbtr init failed (error %d)\n",
>> +                          __func__, hartid, rc);
>>                  sbi_hart_hang();
>> +       }
>>
>>          rc = sbi_irqchip_init(scratch, false);
>> -       if (rc)
>> +       if (rc) {
>> +               sbi_printf("%s: hart %d irqchip init failed (error %d)\n",
>> +                          __func__, hartid, rc);
>>                  sbi_hart_hang();
>> +       }
>>
>>          rc = sbi_ipi_init(scratch, false);
>> -       if (rc)
>> +       if (rc) {
>> +               sbi_printf("%s: hart %d ipi init failed (error %d)\n",
>> +                          __func__, hartid, rc);
>>                  sbi_hart_hang();
>> +       }
>>
>>          rc = sbi_tlb_init(scratch, false);
>> -       if (rc)
>> +       if (rc) {
>> +               sbi_printf("%s: hart %d tlb init failed (error %d)\n",
>> +                          __func__, hartid, rc);
>>                  sbi_hart_hang();
>> +       }
>>
>>          rc = sbi_timer_init(scratch, false);
>> -       if (rc)
>> +       if (rc) {
>> +               sbi_printf("%s: hart %d timer init failed (error %d)\n",
>> +                          __func__, hartid, rc);
>>                  sbi_hart_hang();
>> +       }
>>
>>          rc = sbi_fwft_init(scratch, false);
>> -       if (rc)
>> +       if (rc) {
>> +               sbi_printf("%s: hart %d fwft init failed (error %d)\n",
>> +                          __func__, hartid, rc);
>>                  sbi_hart_hang();
>> +       }
>>
>>          rc = sbi_platform_final_init(plat, false);
>> -       if (rc)
>> +       if (rc) {
>> +               sbi_printf("%s: hart %d platform final init failed (error %d)\n",
>> +                          __func__, hartid, rc);
>>                  sbi_hart_hang();
>> +       }
>>
>>          rc = sbi_sse_init(scratch, false);
>> -       if (rc)
>> +       if (rc) {
>> +               sbi_printf("%s: hart %d sse init failed (error %d)\n",
>> +                          __func__, hartid, rc);
>>                  sbi_hart_hang();
>> +       }
>>
>>          /*
>>           * Configure PMP at last because if SMEPMP is detected,
>>           * M-mode access to the S/U space will be rescinded.
>>           */
>>          rc = sbi_hart_pmp_configure(scratch);
>> -       if (rc)
>> +       if (rc) {
>> +               sbi_printf("%s: hart %d PMP configure failed (error %d)\n",
>> +                          __func__, hartid, rc);
>>                  sbi_hart_hang();
>> +       }
>>
>>          count = sbi_scratch_offset_ptr(scratch, init_count_offset);
>>          (*count)++;
>> --
>> 2.43.0
>>
>> --
>> opensbi mailing list
>> opensbi at lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/opensbi




More information about the opensbi mailing list