|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 2/3] xen/riscv: use the SBI SRST extension to reboot in machine_restart()
> machine_restart() just calls machine_halt(), which uses the legacy SBI
> v0.1 SHUTDOWN call, so every reboot request, including the one after a
> panic ("Reboot in five seconds..."), powers the system off instead of
> rebooting it. Commit 6471badeeec9 ("RISCV/shutdown: Implement
> machine_{halt,restart}()") left SRST support for later.
>
> Probe for the SBI System Reset (SRST) extension in sbi_init() and add
> sbi_system_reset(). Use it in machine_restart() to request a cold
> reboot. If SRST isn't available or the call returns, fall back to
> machine_halt() as before. A failed reset request is logged.
>
> Now that udelay() exists, also honour delay_millisecs before resetting
> or falling back.
>
> As Arm and x86 do, call console_start_sync() first, so that pending
> console output is flushed before the reset. panic() already does this,
> but other callers, such as the 'R' debug key, don't.
Very clear like that, thanks.
> [ ... 32 lines skipped ... ]
>
> +/* SBI function IDs for SRST extension */
> +#define SBI_EXT_SRST_RESET 0x0
> +
> +/* SBI SRST reset types and reasons */
Nit: Could we separate types from reasons as the list may evolve?
> [ ... 31 lines skipped ... ]
> +void sbi_system_reset(unsigned int type, unsigned int reason)
> +{
> + struct sbiret ret;
> +
> + if ( !sbi_has_srst )
> + return;
> +
> + ret = sbi_ecall(SBI_EXT_SRST, SBI_EXT_SRST_RESET, type, reason,
> + 0, 0, 0, 0);
> +
> + printk(XENLOG_ERR "%s: type=%u reason=%u failed (error %ld)\n",
> + __func__, type, reason, ret.error);
__func__ in a plain printk is not needed, the message already says what
failed.
> +}
With that fixed, lgtm!
Reviewed-by: Baptiste Le Duc <baptiste.le-duc@xxxxxxxxxx>
--
Baptiste Le Duc <baptiste.le-duc@xxxxxxxxxx>
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |