Date   

Upcoming Event: Unix platform working group meeting (02/05 8AM PST) @ Wed Feb 5, 2020 8am - 9am (PST) - Wed, 02/05/2020 8:00am-9:00am #cal-reminder

tech-unixplatformspec@lists.riscv.org Calendar <tech-unixplatformspec@...>
 

Reminder: Unix platform working group meeting (02/05 8AM PST) @ Wed Feb 5, 2020 8am - 9am (PST)

When: Wednesday, 5 February 2020, 8:00am to 9:00am, (GMT-08:00) America/Los Angeles

Where:webex

View Event

Description: Hi All,
The next Unix platform specification working group meeting is scheduled on next Wednesday(5th Feb 2020) at 8AM PST.
Agenda:

  *   SBI v0.2 specification merge and ratification process discussion
  *   PLIC specification future
  *   Discuss other components of Unix platform specification
  *   Discuss the road map for Unix Platform specification working group
  *   Anything else ?

Regards,
Atish

-- Do not delete or change any of the following text. --


Options to Join this Meeting

From any computer or mobile device, Click to Join WebEx.<https://wdc.webex.com/wdc/j.php?MTID=m3c18e442ac7ba8116d347854ff40d7d9>

From any video conference unit, enter "54 643 072 189" from remote or touch panel.

Meeting password: 8888793673 (88887936 from phones)
________________________________

Toll and Toll free numbers are billed at a higher per minute rate. Follow the below instructions for cost effective conferencing.
1. Click link above to join WebEx meeting.
2. Once you are in the meeting, click the Phone icon and select 'Call Me'.
3. Enter your full number, starting with country code followed by remaining digits. The system will then place a call to that number.

If you are unable to use WebEx 'Call Me' or 'Call Using Computer' features, use the following dial in numbers:

Join by phone
+1-408-717-7733 USA Toll
Meeting Number: 643 072 189

Global call-in numbers<https://wdc.webex.com/wdc/globalcallin.php>


Upcoming Event: Unix platform working group meeting (02/05 8AM PST) @ Wed Feb 5, 2020 8am - 9am (PST) - Wed, 02/05/2020 8:00am-9:00am #cal-reminder

tech-unixplatformspec@lists.riscv.org Calendar <tech-unixplatformspec@...>
 

Reminder: Unix platform working group meeting (02/05 8AM PST) @ Wed Feb 5, 2020 8am - 9am (PST)

When: Wednesday, 5 February 2020, 8:00am to 9:00am, (GMT-08:00) America/Los Angeles

Where:webex

View Event

Description: Hi All,
The next Unix platform specification working group meeting is scheduled on next Wednesday(5th Feb 2020) at 8AM PST.
Agenda:

  *   SBI v0.2 specification merge and ratification process discussion
  *   PLIC specification future
  *   Discuss other components of Unix platform specification
  *   Discuss the road map for Unix Platform specification working group
  *   Anything else ?

Regards,
Atish

-- Do not delete or change any of the following text. --


Options to Join this Meeting

From any computer or mobile device, Click to Join WebEx.<https://wdc.webex.com/wdc/j.php?MTID=m3c18e442ac7ba8116d347854ff40d7d9>

From any video conference unit, enter "54 643 072 189" from remote or touch panel.

Meeting password: 8888793673 (88887936 from phones)
________________________________

Toll and Toll free numbers are billed at a higher per minute rate. Follow the below instructions for cost effective conferencing.
1. Click link above to join WebEx meeting.
2. Once you are in the meeting, click the Phone icon and select 'Call Me'.
3. Enter your full number, starting with country code followed by remaining digits. The system will then place a call to that number.

If you are unable to use WebEx 'Call Me' or 'Call Using Computer' features, use the following dial in numbers:

Join by phone
+1-408-717-7733 USA Toll
Meeting Number: 643 072 189

Global call-in numbers<https://wdc.webex.com/wdc/globalcallin.php>


Unix platform working group meeting (02/05 8AM PST) @ Wed Feb 5, 2020 8am - 9am (PST) - Wed, 02/05/2020 #cal-notice

tech-unixplatformspec@lists.riscv.org Calendar <noreply@...>
 

Unix platform working group meeting (02/05 8AM PST) @ Wed Feb 5, 2020 8am - 9am (PST)

When:
Wednesday, 5 February 2020
8:00am to 9:00am
(GMT-08:00) America/Los Angeles

Where:
webex

Description:
Hi All,
The next Unix platform specification working group meeting is scheduled on next Wednesday(5th Feb 2020) at 8AM PST.
Agenda:

  *   SBI v0.2 specification merge and ratification process discussion
  *   PLIC specification future
  *   Discuss other components of Unix platform specification
  *   Discuss the road map for Unix Platform specification working group
  *   Anything else ?

Regards,
Atish

-- Do not delete or change any of the following text. --


Options to Join this Meeting

From any computer or mobile device, Click to Join WebEx.<https://wdc.webex.com/wdc/j.php?MTID=m3c18e442ac7ba8116d347854ff40d7d9>

From any video conference unit, enter "54 643 072 189" from remote or touch panel.

Meeting password: 8888793673 (88887936 from phones)
________________________________

Toll and Toll free numbers are billed at a higher per minute rate. Follow the below instructions for cost effective conferencing.
1. Click link above to join WebEx meeting.
2. Once you are in the meeting, click the Phone icon and select 'Call Me'.
3. Enter your full number, starting with country code followed by remaining digits. The system will then place a call to that number.

If you are unable to use WebEx 'Call Me' or 'Call Using Computer' features, use the following dial in numbers:

Join by phone
+1-408-717-7733 USA Toll
Meeting Number: 643 072 189

Global call-in numbers<https://wdc.webex.com/wdc/globalcallin.php>


[PATCH 0/1] SBI: Introduce Physical Memory Protection Extension

Bin Meng
 

S-mode software needs a way to know memory used by SBI firmware so
that it can correctly mark such memory as reserved.

This patch was already posted on github as a PR [1], and I was told
to send this patch to this mailing list for broader discussion.

For details on why and possible solutions to debate, please visit
the github PR. Comments are welcome!

[1] https://github.com/riscv/riscv-sbi-doc/pull/37


Bin Meng (1):
Introduce Physical Memory Protection Extension

riscv-sbi.adoc | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)

--
2.7.4


[PATCH] Introduce Physical Memory Protection Extension

Bin Meng
 

S-mode software needs a way to know memory used by SBI firmware so
that it can correctly mark such memory as reserved.

Related discussion:
https://github.com/riscv/opensbi/issues/103

Signed-off-by: Bin Meng <bmeng.cn@...>

---

riscv-sbi.adoc | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)

diff --git a/riscv-sbi.adoc b/riscv-sbi.adoc
index 37d0791..c9dba7c 100644
--- a/riscv-sbi.adoc
+++ b/riscv-sbi.adoc
@@ -592,6 +592,71 @@ state of the hart at the time of return value verification.
| sbi_hart_get_status | 2 | 0x48534D
|===

+== Physical Memory Protection Extension, Extension ID: 0x504D50 (PMP)
+The Physical Memory Protection Extension introduces a set of functions that
+allow the supervisor to request higher privilege mode to return information
+of the memory regions protected by the SBI firmware via the PMP unit.
+
+Every memory region protected by the SBI firmware can be described by a C
+structure (or descriptor) below:
+
+[source, C]
+----
+struct pmp_fw_prot_desc {
+ unsigned long base;
+ unsigned long size;
+};
+----
+
+If there are mutiple memory regions protected, multiple descriptors should
+be used with each one describing a single memory region.
+
+[source, C]
+----
+struct sbiret sbi_get_fw_prot_desc_size()
+----
+*Returns* the size of memory (in bytes) required to describe the protected
+memory regions by the SBI firmware via PMP through sbiret.value, or one of
+the following possible SBI error codes through sbiret.error.
+
+[cols="<,>",options="header,compact"]
+|===
+| Error code | Description
+| SBI_SUCCESS | The size of memory (in bytes) required to +
+ describe the protected memory regions by the SBI +
+ firmware via PMP is written to sbiret.value. +
+ The size should be multiple of one descriptor +
+ size, that is sizeof(struct pmp_fw_prot_desc). +
+ If no memory region is protected, zero is set +
+ to sbiret.value.
+| SBI_ERR_NOT_SUPPORTED | PMP is not available on this platform.
+|===
+
+[source, C]
+----
+struct sbiret sbi_get_fw_prot_desc(struct pmp_fw_prot_desc *desc)
+----
+*Returns* one of the following possible SBI error codes through sbiret.error.
+
+[cols="<,>",options="header,compact"]
+|===
+| Error code | Description
+| SBI_SUCCESS | The physical address of RAM pointed by desc +
+ where memory region information is to be written +
+ are filled in by SBI firmware, one after another +
+ if multiple memory regions are protected.
+| SBI_ERR_NOT_SUPPORTED | PMP is not available on this platform.
+|===
+
+=== PMP Function Listing
+
+[cols="<,,>",options="header,compact"]
+|===
+| Function Name | Function ID | Extension ID
+| sbi_get_fw_prot_desc_size | 0 | 0x504D50
+| sbi_get_fw_prot_desc | 1 | 0x504D50
+|===
+
== Experimental SBI Extension Space, Extension IDs 0x0800000 through 0x08FFFFFF

No management.
--
2.7.4


Re: [PATCH 0/1] SBI: Introduce Physical Memory Protection Extension

atishp@...
 

On Tue, 2020-03-10 at 07:25 -0700, Bin Meng wrote:
S-mode software needs a way to know memory used by SBI firmware so
that it can correctly mark such memory as reserved.

This patch was already posted on github as a PR [1], and I was told
to send this patch to this mailing list for broader discussion.

For details on why and possible solutions to debate, please visit
the github PR. Comments are welcome!

[1] https://github.com/riscv/riscv-sbi-doc/pull/37


Bin Meng (1):
Introduce Physical Memory Protection Extension

riscv-sbi.adoc | 65
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)
Let's continue the discussion here as it has a wider audience than
github PR. I have also cc'd all the possible stakeholders.

The other alternatives propsed so far

1. Just parse the deveice tree node in S-mode software.

Pros: No additional SBI extensions are required.
Cons: U-Boot is responsible for copying the reserved-memory node from
the DT passed by OpenSBI and set it to the final DT if it is a
different one. OpenSBI also need to provide the DT where the previous
stage (FSBL/U-Boot SPL) doesn't provide a DT.

IMHO, this is not a very difficult problem to solve. The U-Boot
implementation is available here (just ~40 lines of code).
https://patchwork.ozlabs.org/patch/1254740/

2. Trap-n-Emulate PMP CSR reads from S-mode. The details are available
here.

https://github.com/riscv/riscv-sbi-doc/pull/37#issuecomment-596944084

Pros: No SBI extension or prior DTB fixup required in U-Boot.
Cons: As PMP extensions proposals are already in place, this may need
to be extended. Privilege spec may need to be modified to explicitly
say that M-mode can provide PMP csr emulation.


Any thoughts ?

--
Regards,
Atish


[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


Re: [PATCH] Add system reboot extension

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


Re: [PATCH] Add system reboot extension

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




Re: [PATCH] Add system reboot extension

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


Re: [PATCH] Add system reboot extension

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


Re: [PATCH] Add system reboot extension

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



Re: [PATCH] Add system reboot extension

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


Re: [PATCH] Add system reboot extension

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




Re: [PATCH 0/1] SBI: Introduce Physical Memory Protection Extension

Nick Kossifidis
 

Hello all,

Let's continue the discussion here as it has a wider audience than
github PR. I have also cc'd all the possible stakeholders.
The other alternatives propsed so far
1. Just parse the deveice tree node in S-mode software.
Pros: No additional SBI extensions are required.
Cons: U-Boot is responsible for copying the reserved-memory node from
the DT passed by OpenSBI and set it to the final DT if it is a
different one. OpenSBI also need to provide the DT where the previous
stage (FSBL/U-Boot SPL) doesn't provide a DT.
IMHO, this is not a very difficult problem to solve. The U-Boot
implementation is available here (just ~40 lines of code).
https://patchwork.ozlabs.org/patch/1254740/
2. Trap-n-Emulate PMP CSR reads from S-mode. The details are available
here.
https://github.com/riscv/riscv-sbi-doc/pull/37#issuecomment-596944084
Pros: No SBI extension or prior DTB fixup required in U-Boot.
Cons: As PMP extensions proposals are already in place, this may need
to be extended. Privilege spec may need to be modified to explicitly
say that M-mode can provide PMP csr emulation.
Any thoughts ?

The assumption that there'll always be a PMP rule for marking the firmware's memory isn't always true. M-mode can access any region without a matching PMP rule so basically the firmware can be anywhere and work fine, without any PMP rule marking its region. With the current PMP spec this is probably the best approach since it will also prevent S-mode from ever accessing this region (S-mode will fail if there is no matching PMP rule). Why waste a rule for the firmware's region to deny any access from S-mode, when you can have the same result by not putting that rule on PMP ? Even if that assumption was always true, what about systems without PMP, systems with a different number of PMP regions, or systems with custom PMP-equivalent solutions ? Trap-n-emulate is not that generic (e.g. in the case of different number of PMP regions). Any interface from S-mode to PMP or a PMP-equivalent mechanism, should be more abstract than this IMHO.

We should also consider the security implications of exposing the PMP configuration to a less privileged mode. It's one thing to let S-mode know about the DRAM regions that it can't touch because the firmware is there, and another to reveal the full PMP configuration. PMP may contain settings that S-mode doesn't even know about, devices that are not on the device tree for example or DRAM regions that are outside the device tree's /memory node range (so S-mode won't touch them anyway). I'm not a fan of security through obscurity but there are good reasons to keep PMP configuration accessible only to M-mode (in addition to having a more abstract API with S-mode to be able to handle the various system configurations / implementations). We can have S-mode request M-mode to protect specific physical regions that S-mode manages through PMP (or a vendor-specific PMP-equivalent mechanism) but anything more than that doesn't make much sense to me.

If we just want to prevent S-mode from touching firmware's memory we can either exclude its region from the /memory node on the device tree, or let the firmware modify the device tree it passes on to the next-stage boot loader and add a reserved-memory node. I think that's the best approach since it's the most generic one and it's standards-compliant, plus the device-tree is platform-specific anyway, even if it's included on the kernel blob directly without passing through OpenSBI or whatever boot loader is there, we can always add there a reserved region, or modify the /memory node manually.

Regards,
Nick


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

 

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



Re: [PATCH 0/1] SBI: Introduce Physical Memory Protection Extension

Jonathan Behrens <behrensj@...>
 

There are different sorts of security threats to keep in mind. I'm generally not a fan of threat models where the "person who legally purchased the computer" is the threat, but that is admittedly a case hardware vendors often care about. Another security concern for many organizations is basically the reverse: somebody has attached an extra device or some DRAM with unauthorized M-mode code that the operating system software doesn't know about, and now it is being used to exfiltrate data from the system. This isn't necessarily the place to try to resolve this sort of threat, but it is worth keeping in mind that decisions we make don't make it even harder to address.

Jonathan

(sorry for the duplicate... my other address isn't subscribed to the mailing list)

On Wed, Apr 1, 2020 at 9:48 PM Nick Kossifidis <mick@...> wrote:
Hello all,

>
> Let's continue the discussion here as it has a wider audience than
> github PR. I have also cc'd all the possible stakeholders.
>
> The other alternatives propsed so far
>
> 1. Just parse the deveice tree node in S-mode software.
>
> Pros: No additional SBI extensions are required.
> Cons: U-Boot is responsible for copying the reserved-memory node from
> the DT passed by OpenSBI and set it to the final DT if it is a
> different one. OpenSBI also need to provide the DT where the previous
> stage (FSBL/U-Boot SPL) doesn't provide a DT.
>
> IMHO, this is not a very difficult problem to solve. The U-Boot
> implementation is available here (just ~40 lines of code).
> https://patchwork.ozlabs.org/patch/1254740/
>
> 2. Trap-n-Emulate PMP CSR reads from S-mode. The details are available
> here.
>
> https://github.com/riscv/riscv-sbi-doc/pull/37#issuecomment-596944084
>
> Pros: No SBI extension or prior DTB fixup required in U-Boot.
> Cons: As PMP extensions proposals are already in place, this may need
> to be extended. Privilege spec may need to be modified to explicitly
> say that M-mode can provide PMP csr emulation.
>
>
> Any thoughts ?


The assumption that there'll always be a PMP rule for marking the
firmware's memory isn't always true. M-mode can access any region
without a matching PMP rule so basically the firmware can be anywhere
and work fine, without any PMP rule marking its region. With the current
PMP spec this is probably the best approach since it will also prevent
S-mode from ever accessing this region (S-mode will fail if there is no
matching PMP rule). Why waste a rule for the firmware's region to deny
any access from S-mode, when you can have the same result by not putting
that rule on PMP ? Even if that assumption was always true, what about
systems without PMP, systems with a different number of PMP regions, or
systems with custom PMP-equivalent solutions ? Trap-n-emulate is not
that generic (e.g. in the case of different number of PMP regions). Any
interface from S-mode to PMP or a PMP-equivalent mechanism, should be
more abstract than this IMHO.

We should also consider the security implications of exposing the PMP
configuration to a less privileged mode. It's one thing to let S-mode
know about the DRAM regions that it can't touch because the firmware is
there, and another to reveal the full PMP configuration. PMP may contain
settings that S-mode doesn't even know about, devices that are not on
the device tree for example or DRAM regions that are outside the device
tree's /memory node range (so S-mode won't touch them anyway). I'm not a
fan of security through obscurity but there are good reasons to keep PMP
configuration accessible only to M-mode (in addition to having a more
abstract API with S-mode to be able to handle the various system
configurations / implementations). We can have S-mode request M-mode to
protect specific physical regions that S-mode manages through PMP (or a
vendor-specific PMP-equivalent mechanism) but anything more than that
doesn't make much sense to me.

If we just want to prevent S-mode from touching firmware's memory we can
either exclude its region from the /memory node on the device tree, or
let the firmware modify the device tree it passes on to the next-stage
boot loader and add a reserved-memory node. I think that's the best
approach since it's the most generic one and it's standards-compliant,
plus the device-tree is platform-specific anyway, even if it's included
on the kernel blob directly without passing through OpenSBI or whatever
boot loader is there, we can always add there a reserved region, or
modify the /memory node manually.

Regards,
Nick


[PATCH v2] Add system reboot extension

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 an 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..d93a5c2 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 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 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


Re: [PATCH v2] Add system reboot extension

Jonathan Behrens <behrensj@...>
 

> The System Reboot Extension provides a set of functions that allow the

nit: "a set of functions" -> "a function"


On Fri, Apr 3, 2020 at 1:36 AM Anup Patel via lists.riscv.org <anup.patel=wdc.com@...> 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 an 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..d93a5c2 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 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 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





Re: [PATCH v2] Add system reboot extension

Anup Patel
 

Sure, I will fix this in next revision.

 

Thanks for catching.

 

Regards,

Anup

 

From: tech-unixplatformspec@... <tech-unixplatformspec@...> On Behalf Of Jonathan Behrens
Sent: 03 April 2020 20:18
To: Anup Patel <Anup.Patel@...>
Cc: tech-unixplatformspec@...; Atish Patra <Atish.Patra@...>
Subject: Re: [RISC-V] [tech-unixplatformspec] [PATCH v2] Add system reboot extension

 

> The System Reboot Extension provides a set of functions that allow the

 

nit: "a set of functions" -> "a function"

 

On Fri, Apr 3, 2020 at 1:36 AM Anup Patel via lists.riscv.org <anup.patel=wdc.com@...> 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 an 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..d93a5c2 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 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 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



1 - 20 of 1847