[PATCH v3] Add system reboot extension


Anup Patel
 

-----Original Message-----
From: Bin Meng <bmeng.cn@...>
Sent: 06 April 2020 17:26
To: Anup Patel <Anup.Patel@...>
Cc: tech-unixplatformspec@...; Atish Patra
<Atish.Patra@...>
Subject: Re: [RISC-V] [tech-unixplatformspec] [PATCH v3] Add system reboot
extension

On Mon, Apr 6, 2020 at 11:27 AM Anup Patel <anup.patel@...> wrote:

This patch adds SBI v0.2 compliant system reboot extension. It defines
the sbi_system_reboot function which does different things based on
reboot_type parameter:
1. shutdown - Power-off the entire system
2. cold reboot - Power-cycle the entire system 3. warm reboot -
Power-cycle only parts of system based on SOC vendor
design choices

The sbi_system_reboot function defined here is also a replacement of
SBI v0.1 shutdown function.

Signed-off-by: Atish Patra <atish.patra@...>
Signed-off-by: Anup Patel <anup.patel@...>
---
riscv-sbi.adoc | 47
+++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
A general comment: it would be good to put the reason why a new
extension is introduced, to solve what issue.

Reviewed-by: Bin Meng <bmeng.cn@...>
As suggested on GitHub PR, I will rename SBI extension to "System reset
extension" where Shutdown and Reboot are types of system reset.

Regards,
Anup


Bin Meng
 

On Mon, Apr 6, 2020 at 11:27 AM Anup Patel <anup.patel@...> wrote:

This patch adds SBI v0.2 compliant system reboot extension. It defines
the sbi_system_reboot function which does different things based on
reboot_type parameter:
1. shutdown - Power-off the entire system
2. cold reboot - Power-cycle the entire system
3. warm reboot - Power-cycle only parts of system based on SOC vendor
design choices

The sbi_system_reboot function defined here is also a replacement of
SBI v0.1 shutdown function.

Signed-off-by: Atish Patra <atish.patra@...>
Signed-off-by: Anup Patel <anup.patel@...>
---
riscv-sbi.adoc | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
A general comment: it would be good to put the reason why a new
extension is introduced, to solve what issue.

Reviewed-by: Bin Meng <bmeng.cn@...>


Anup Patel
 

This patch adds SBI v0.2 compliant system reboot extension. It defines
the sbi_system_reboot function which does different things based on
reboot_type parameter:
1. shutdown - Power-off the entire system
2. cold reboot - Power-cycle the entire system
3. warm reboot - Power-cycle only parts of system based on SOC vendor
design choices

The sbi_system_reboot function defined here is also a replacement of
SBI v0.1 shutdown function.

Signed-off-by: Atish Patra <atish.patra@...>
Signed-off-by: Anup Patel <anup.patel@...>
---
riscv-sbi.adoc | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)

diff --git a/riscv-sbi.adoc b/riscv-sbi.adoc
index 8137686..a55a996 100644
--- a/riscv-sbi.adoc
+++ b/riscv-sbi.adoc
@@ -615,6 +615,53 @@ 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 function 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 does not return if it succeeds.
+
+The reboot_type parameter is 32 bit wide and has following possible values:
+
+[cols="<,>",options="header,compact"]
+|===
+| Value | Description
+| 0x00000000 | Shutdown
+| 0x00000001 | Cold reboot
+| 0x00000002 | Warm reboot
+| 0x00000003 - 0xEFFFFFFF | Reserved for future use
+| 0xF0000000 - 0xFFFFFFFF | Vendor or platform specific reboot type
+| 0x100000000 - 2^XELN-1 | Reserved and unusable on RV32
+|===
+
+Cold reboot results in complete power cycle of the entire system while warm
+reboot depends on SOC vendor design choices.
+
+*Returns* one of the following possible SBI error codes through sbiret.error
+upon failure.
+
+[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.
+|===
+
+=== SRBT Function Listing
+
+[cols="<,,>",options="header,compact"]
+|===
+| Function Name | Function ID | Extension ID
+| sbi_system_reboot | 0 | 0x53524254
+|===
+
== Experimental SBI Extension Space, Extension IDs 0x0800000 through 0x08FFFFFF

No management.
--
2.17.1