[PATCH] Add system reboot extension


Anup Patel
 

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(+)

diff --git a/riscv-sbi.adoc b/riscv-sbi.adoc
index 8137686..a39e362 100644
--- a/riscv-sbi.adoc
+++ b/riscv-sbi.adoc
@@ -615,6 +615,70 @@ state of the hart at the time of return value verification.
| sbi_hart_get_status | 2 | 0x48534D
|===

+== System Reboot Extension, Extension ID: 0x53524254 (SRBT)
+
+The System Reboot Extension provides a set of functions that allow the
+supervisor software to request system-level reboot or shutdown.
+
+[source, C]
+----
+struct sbiret sbi_system_reboot(unsigned long reboot_type)
+----
+
+Reboot the system based on provided reboot type. This is a synchronous call
+and is not expected to return if succeeds.
+
+The reboot_type parameter is 32 bit wide and has following possible values:
+
+[cols="<,>",options="header,compact"]
+|===
+| Value | Description
+| 0x00000000 | Cold reboot
+| 0x00000001 | Warm reboot
+| 0x00000002 - 0xEFFFFFFF | Reserved for future use
+| 0xF0000000 - 0xFFFFFFFF | Vendor or platform specific reboot type
+| 0x100000000 - 2^XELN-1 | Reserved for RV64/RV128
+|===
+
+*Returns* one of the following possible SBI error codes through sbiret.error
+upon failure.
+
+Cold reboot results in complete power cycle of the entire system while
+warm reboot depends on SOC vendor design choices.
+
+[cols="<,>",options="header,compact"]
+|===
+| Error code | Description
+| SBI_ERR_INVALID_PARAM | `reboot_type` is not valid.
+| SBI_ERR_FAILED | Reboot request failed for unknown reasons.
+|===
+
+[source, C]
+----
+struct sbiret sbi_system_shutdown()
+----
+
+Shutdown the system. This is a synchronous call and is not expected to
+return if succeeds.
+
+*Returns* one of the following possible SBI error codes through sbiret.error
+upon failure.
+
+[cols="<,>",options="header,compact"]
+|===
+| Error code | Description
+| SBI_ERR_FAILED | The start request failed for unknown reasons.
+|===
+
+=== SRBT Function Listing
+
+[cols="<,,>",options="header,compact"]
+|===
+| Function Name | Function ID | Extension ID
+| sbi_system_reboot | 0 | 0x53524254
+| sbi_system_shutdown | 1 | 0x53524254
+|===
+
== Experimental SBI Extension Space, Extension IDs 0x0800000 through 0x08FFFFFF

No management.
--
2.17.1


Bin Meng
 

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(+)

diff --git a/riscv-sbi.adoc b/riscv-sbi.adoc
index 8137686..a39e362 100644
--- a/riscv-sbi.adoc
+++ b/riscv-sbi.adoc
@@ -615,6 +615,70 @@ state of the hart at the time of return value verification.
| sbi_hart_get_status | 2 | 0x48534D
|===

+== System Reboot Extension, Extension ID: 0x53524254 (SRBT)
+
+The System Reboot Extension provides a set of functions that allow the
+supervisor software to request system-level reboot or shutdown.
+
+[source, C]
+----
+struct sbiret sbi_system_reboot(unsigned long reboot_type)
+----
+
+Reboot the system based on provided reboot type. This is a synchronous call
+and is not expected to return if succeeds.
+
+The reboot_type parameter is 32 bit wide and has following possible values:
+
+[cols="<,>",options="header,compact"]
+|===
+| Value | Description
+| 0x00000000 | Cold reboot
+| 0x00000001 | Warm reboot
+| 0x00000002 - 0xEFFFFFFF | Reserved for future use
+| 0xF0000000 - 0xFFFFFFFF | Vendor or platform specific reboot type
+| 0x100000000 - 2^XELN-1 | Reserved for RV64/RV128
The words are misleading, as it could indicate that the above types
only apply to RV32.

+|===
+
+*Returns* one of the following possible SBI error codes through sbiret.error
+upon failure.
+
+Cold reboot results in complete power cycle of the entire system while
+warm reboot depends on SOC vendor design choices.
+
+[cols="<,>",options="header,compact"]
+|===
+| Error code | Description
+| SBI_ERR_INVALID_PARAM | `reboot_type` is not valid.
+| SBI_ERR_FAILED | Reboot request failed for unknown reasons.
+|===
+
+[source, C]
+----
+struct sbiret sbi_system_shutdown()
+----
+
+Shutdown the system. This is a synchronous call and is not expected to
+return if succeeds.
+
+*Returns* one of the following possible SBI error codes through sbiret.error
+upon failure.
+
+[cols="<,>",options="header,compact"]
+|===
+| Error code | Description
+| SBI_ERR_FAILED | The start request failed for unknown reasons.
The shutdown request

+|===
+
+=== SRBT Function Listing
+
+[cols="<,,>",options="header,compact"]
+|===
+| Function Name | Function ID | Extension ID
+| sbi_system_reboot | 0 | 0x53524254
+| sbi_system_shutdown | 1 | 0x53524254
+|===
+
== Experimental SBI Extension Space, Extension IDs 0x0800000 through 0x08FFFFFF

No management.
Otherwise, looks good to me.

Regards,
Bin


Jonathan Behrens <behrensj@...>
 

Could this just be one function that had cold reboot, warm reboot, and shutdown all as options?

Also:
"This is a synchronous call and is not expected to return if succeeds." -> "This is a synchronous call and does not return if it succeeds"

Jonathan


On Tue, Mar 31, 2020 at 3:31 AM Bin Meng via Lists.Riscv.Org <bmeng.cn=gmail.com@...> wrote:
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(+)
>
> diff --git a/riscv-sbi.adoc b/riscv-sbi.adoc
> index 8137686..a39e362 100644
> --- a/riscv-sbi.adoc
> +++ b/riscv-sbi.adoc
> @@ -615,6 +615,70 @@ state of the hart at the time of return value verification.
>  | sbi_hart_get_status          |           2 |     0x48534D
>  |===
>
> +== System Reboot Extension, Extension ID: 0x53524254 (SRBT)
> +
> +The System Reboot Extension provides a set of functions that allow the
> +supervisor software to request system-level reboot or shutdown.
> +
> +[source, C]
> +----
> +struct sbiret sbi_system_reboot(unsigned long reboot_type)
> +----
> +
> +Reboot the system based on provided reboot type. This is a synchronous call
> +and is not expected to return if succeeds.
> +
> +The reboot_type parameter is 32 bit wide and has following possible values:
> +
> +[cols="<,>",options="header,compact"]
> +|===
> +| Value                        | Description
> +| 0x00000000                   | Cold reboot
> +| 0x00000001                   | Warm reboot
> +| 0x00000002 - 0xEFFFFFFF      | Reserved for future use
> +| 0xF0000000 - 0xFFFFFFFF      | Vendor or platform specific reboot type
> +| 0x100000000 - 2^XELN-1       | Reserved for RV64/RV128

The words are misleading, as it could indicate that the above types
only apply to RV32.

> +|===
> +
> +*Returns* one of the following possible SBI error codes through sbiret.error
> +upon failure.
> +
> +Cold reboot results in complete power cycle of the entire system while
> +warm reboot depends on SOC vendor design choices.
> +
> +[cols="<,>",options="header,compact"]
> +|===
> +| Error code                | Description
> +| SBI_ERR_INVALID_PARAM     | `reboot_type` is not valid.
> +| SBI_ERR_FAILED            | Reboot request failed for unknown reasons.
> +|===
> +
> +[source, C]
> +----
> +struct sbiret sbi_system_shutdown()
> +----
> +
> +Shutdown the system. This is a synchronous call and is not expected to
> +return if succeeds.
> +
> +*Returns* one of the following possible SBI error codes through sbiret.error
> +upon failure.
> +
> +[cols="<,>",options="header,compact"]
> +|===
> +| Error code                | Description
> +| SBI_ERR_FAILED            | The start request failed for unknown reasons.

The shutdown request

> +|===
> +
> +=== SRBT Function Listing
> +
> +[cols="<,,>",options="header,compact"]
> +|===
> +| Function Name                 | Function ID | Extension ID
> +| sbi_system_reboot                    |           0 |   0x53524254
> +| sbi_system_shutdown                  |           1 |   0x53524254
> +|===
> +
>  == Experimental SBI Extension Space, Extension IDs 0x0800000 through 0x08FFFFFF
>
>  No management.

Otherwise, looks good to me.

Regards,
Bin




Bin Meng
 

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?

Regards,
Bin


Anup Patel
 

-----Original Message-----
From: tech-unixplatformspec@... <tech-
unixplatformspec@...> On Behalf Of Bin Meng
Sent: 31 March 2020 13:01
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(+)

diff --git a/riscv-sbi.adoc b/riscv-sbi.adoc index 8137686..a39e362
100644
--- a/riscv-sbi.adoc
+++ b/riscv-sbi.adoc
@@ -615,6 +615,70 @@ state of the hart at the time of return value
verification.
| sbi_hart_get_status | 2 | 0x48534D
|===

+== System Reboot Extension, Extension ID: 0x53524254 (SRBT)
+
+The System Reboot Extension provides a set of functions that allow
+the supervisor software to request system-level reboot or shutdown.
+
+[source, C]
+----
+struct sbiret sbi_system_reboot(unsigned long reboot_type)
+----
+
+Reboot the system based on provided reboot type. This is a
+synchronous call and is not expected to return if succeeds.
+
+The reboot_type parameter is 32 bit wide and has following possible
values:
+
+[cols="<,>",options="header,compact"]
+|===
+| Value | Description
+| 0x00000000 | Cold reboot
+| 0x00000001 | Warm reboot
+| 0x00000002 - 0xEFFFFFFF | Reserved for future use
+| 0xF0000000 - 0xFFFFFFFF | Vendor or platform specific reboot type
+| 0x100000000 - 2^XELN-1 | Reserved for RV64/RV128
The words are misleading, as it could indicate that the above types only apply
to RV32.
Sure, I will update.


+|===
+
+*Returns* one of the following possible SBI error codes through
+sbiret.error upon failure.
+
+Cold reboot results in complete power cycle of the entire system
+while warm reboot depends on SOC vendor design choices.
+
+[cols="<,>",options="header,compact"]
+|===
+| Error code | Description
+| SBI_ERR_INVALID_PARAM | `reboot_type` is not valid.
+| SBI_ERR_FAILED | Reboot request failed for unknown reasons.
+|===
+
+[source, C]
+----
+struct sbiret sbi_system_shutdown()
+----
+
+Shutdown the system. This is a synchronous call and is not expected
+to return if succeeds.
+
+*Returns* one of the following possible SBI error codes through
+sbiret.error upon failure.
+
+[cols="<,>",options="header,compact"]
+|===
+| Error code | Description
+| SBI_ERR_FAILED | The start request failed for unknown reasons.
The shutdown request
Sure, I will update.


+|===
+
+=== SRBT Function Listing
+
+[cols="<,,>",options="header,compact"]
+|===
+| Function Name | Function ID | Extension ID
+| sbi_system_reboot | 0 | 0x53524254
+| sbi_system_shutdown | 1 | 0x53524254
+|===
+
== Experimental SBI Extension Space, Extension IDs 0x0800000 through
0x08FFFFFF

No management.
Otherwise, looks good to me.

Regards,
Bin

Regards,
Anup


Anup Patel
 

I am fine with merging shutdown into reboot call but I am not 100% convinced.

 

Regarding the typo, I will update it.

 

Regards,

Anup

 

From: tech-unixplatformspec@... <tech-unixplatformspec@...> On Behalf Of Jonathan Behrens
Sent: 31 March 2020 19:49
To: Bin Meng <bmeng.cn@...>
Cc: Anup Patel <Anup.Patel@...>; tech-unixplatformspec@...
Subject: Re: [RISC-V] [tech-unixplatformspec] [PATCH] Add system reboot extension

 

Could this just be one function that had cold reboot, warm reboot, and shutdown all as options?

 

Also:

"This is a synchronous call and is not expected to return if succeeds." -> "This is a synchronous call and does not return if it succeeds"

 

Jonathan

 

On Tue, Mar 31, 2020 at 3:31 AM Bin Meng via Lists.Riscv.Org <bmeng.cn=gmail.com@...> wrote:

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(+)
>
> diff --git a/riscv-sbi.adoc b/riscv-sbi.adoc
> index 8137686..a39e362 100644
> --- a/riscv-sbi.adoc
> +++ b/riscv-sbi.adoc
> @@ -615,6 +615,70 @@ state of the hart at the time of return value verification.
>  | sbi_hart_get_status          |           2 |     0x48534D
>  |===
>
> +== System Reboot Extension, Extension ID: 0x53524254 (SRBT)
> +
> +The System Reboot Extension provides a set of functions that allow the
> +supervisor software to request system-level reboot or shutdown.
> +
> +[source, C]
> +----
> +struct sbiret sbi_system_reboot(unsigned long reboot_type)
> +----
> +
> +Reboot the system based on provided reboot type. This is a synchronous call
> +and is not expected to return if succeeds.
> +
> +The reboot_type parameter is 32 bit wide and has following possible values:
> +
> +[cols="<,>",options="header,compact"]
> +|===
> +| Value                        | Description
> +| 0x00000000                   | Cold reboot
> +| 0x00000001                   | Warm reboot
> +| 0x00000002 - 0xEFFFFFFF      | Reserved for future use
> +| 0xF0000000 - 0xFFFFFFFF      | Vendor or platform specific reboot type
> +| 0x100000000 - 2^XELN-1       | Reserved for RV64/RV128

The words are misleading, as it could indicate that the above types
only apply to RV32.

> +|===
> +
> +*Returns* one of the following possible SBI error codes through sbiret.error
> +upon failure.
> +
> +Cold reboot results in complete power cycle of the entire system while
> +warm reboot depends on SOC vendor design choices.
> +
> +[cols="<,>",options="header,compact"]
> +|===
> +| Error code                | Description
> +| SBI_ERR_INVALID_PARAM     | `reboot_type` is not valid.
> +| SBI_ERR_FAILED            | Reboot request failed for unknown reasons.
> +|===
> +
> +[source, C]
> +----
> +struct sbiret sbi_system_shutdown()
> +----
> +
> +Shutdown the system. This is a synchronous call and is not expected to
> +return if succeeds.
> +
> +*Returns* one of the following possible SBI error codes through sbiret.error
> +upon failure.
> +
> +[cols="<,>",options="header,compact"]
> +|===
> +| Error code                | Description
> +| SBI_ERR_FAILED            | The start request failed for unknown reasons.

The shutdown request

> +|===
> +
> +=== SRBT Function Listing
> +
> +[cols="<,,>",options="header,compact"]
> +|===
> +| Function Name                 | Function ID | Extension ID
> +| sbi_system_reboot                    |           0 |   0x53524254
> +| sbi_system_shutdown                  |           1 |   0x53524254
> +|===
> +
>  == Experimental SBI Extension Space, Extension IDs 0x0800000 through 0x08FFFFFF
>
>  No management.

Otherwise, looks good to me.

Regards,
Bin



Anup Patel
 

-----Original Message-----
From: Bin Meng <bmeng.cn@...>
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).

Regards,
Anup


Jonathan Behrens <behrensj@...>
 



On Wed, Apr 1, 2020 at 12:35 PM Anup Patel via Lists.Riscv.Org <anup.patel=wdc.com@...> wrote:


> -----Original Message-----
> From: Bin Meng <bmeng.cn@...>
> 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?

Regards,
Anup




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

 

Regards,

Anup

 

From: tech-unixplatformspec@... <tech-unixplatformspec@...> On Behalf Of Jonathan Behrens
Sent: 01 April 2020 22:43
To: Anup Patel <Anup.Patel@...>
Cc: Bin Meng <bmeng.cn@...>; 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 <anup.patel=wdc.com@...> wrote:



> -----Original Message-----
> From: Bin Meng <bmeng.cn@...>
> 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?

 

Regards,
Anup