Re: [PATCH] Add system reboot extension

Anup Patel

The QEMU “SiFive Test Finisher” device has following issues:

  1. It is not a dedicated reboot/shutdown device. In fact, this device is meant to report test PASS or FAIL to QEMU users.
  2. It does not distinguish between “warm-reboot” and “cold-reboot”.
  3. There is no well-defined spec for “SiFive Test Finisher” device so we first need a spec for this device with improved reboot/shutdown functionality. Even if a spec for “SiFive Test Finisher” is available still it is not guaranteed that all RISC-V SOC vendors will implement it. In fact, SiFive FU540 SOC does not have “SiFive Test Finisher” device.
  4. Due to missing spec, I am not sure which all Hypervisors will be willing to emulate it for Guest/VM





From: tech-unixplatformspec@... <tech-unixplatformspec@...> On Behalf Of Jonathan Behrens
Sent: 01 April 2020 22:43
To: Anup Patel <Anup.Patel@...>
Cc: Bin Meng <>; tech-unixplatformspec@...; Atish Patra <Atish.Patra@...>
Subject: Re: [RISC-V] [tech-unixplatformspec] [PATCH] Add system reboot extension




On Wed, Apr 1, 2020 at 12:35 PM Anup Patel via Lists.Riscv.Org <> wrote:

> -----Original Message-----
> From: Bin Meng <>
> Sent: 01 April 2020 10:29
> To: Anup Patel <Anup.Patel@...>
> Cc: tech-unixplatformspec@...; Atish Patra
> <Atish.Patra@...>
> Subject: Re: [RISC-V] [tech-unixplatformspec] [PATCH] Add system reboot
> extension
> On Tue, Mar 31, 2020 at 12:13 PM Anup Patel <anup.patel@...> wrote:
> >
> > This patch adds SBI v0.2 compliant system reboot extension. It defines
> > two functions:
> > 1. sbi_reboot - A system reboot call with reboot type as parameter 2.
> > sbi_shutdown - A system shutdown/poweroff call
> >
> > The sbi_shutdown function defined here replaces SBI v0.1 shutdown
> > function.
> >
> > Signed-off-by: Atish Patra <atish.patra@...>
> > Signed-off-by: Anup Patel <anup.patel@...>
> > ---
> >  riscv-sbi.adoc | 64
> > ++++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 64 insertions(+)
> >
> One generic comment, pretty much similar to the SBI PMP extension I
> proposed, is that why is this necessary to introduce a new SBI extension to
> support reboot and shutdown?
> Do these functionalities have to be operated from M-mode?

There are two cases:

1. If a system is partitioned between secure and non-secure world then we
cannot allow non-secure S-mode software to shutdown/reboot the system
without secure S-mode software knowing about it. The SBI shutdown/reboot
calls help M-mode software (OpenSBI) to mediate the shutdown/reboot
request coming from non-secure S-mode software.

2. In virtualization world, we don't have a standard way to shutdown/reboot
Guest/VM across architectures. To tackle this, we generally have architecture
specific hypercall for shutdown/reboot. For RISC-V, we don't want each
hypervisor coming up with its own hypercalls so we standardize these as
SBI calls (This rationale is similar to ARM PSCI shutdown/reboot calls).


Doesn't QEMU already have a "SiFive Test Finisher" for this purpose?



Join to automatically receive all group messages.