Re: [PATCH 2/2] Improve SBI HSM extension documentation


atishp@...
 

On Sat, 2020-12-26 at 15:50 +0530, Anup Patel wrote:
We add a figure to show the HSM state machine and improve current
HSM documentation to align with the HSM state machine.

Signed-off-by: Anup Patel <anup.patel@...>
---
 Makefile            |   1 +
 riscv-sbi-hsm.ditaa |  19 ++++++++
 riscv-sbi-hsm.png   | Bin 0 -> 13518 bytes
 riscv-sbi.adoc      | 103 +++++++++++++++++++++++++++++++-----------
--
 4 files changed, 92 insertions(+), 31 deletions(-)
 create mode 100644 riscv-sbi-hsm.ditaa
 create mode 100644 riscv-sbi-hsm.png

diff --git a/Makefile b/Makefile
index f2a52d2..5216ef7 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,7 @@ ASCIIDOCTOR = asciidoctor
 DITAA = ditaa
 IMAGES = riscv-sbi-intro1.png
 IMAGES += riscv-sbi-intro2.png
+IMAGES += riscv-sbi-hsm.png
 TARGETS = riscv-sbi.pdf
 TARGETS += riscv-sbi.html
 
diff --git a/riscv-sbi-hsm.ditaa b/riscv-sbi-hsm.ditaa
new file mode 100644
index 0000000..8833a5e
--- /dev/null
+++ b/riscv-sbi-hsm.ditaa
@@ -0,0 +1,19 @@
+                           +-----------------+
+                           |                 |
+            /------------->|cF78 STOPPED     |--------------\
+            |              |                 |              |
+        SEE |              +-----------------+              |
+   stopping |                                               | SBI
HART
+       HART |                                               | start
call
+            |                                               v
++-----------------------+                       +-------------------
----+
+|cCCC STOP_PENDING      |                       |cCCC
START_PENDING     |
++-----------------------+                       +-------------------
----+
+            ^                                               |
+   SBI HART |                                               | SEE
+  stop call |                                               |
starting
+            |              +-----------------+              | HART
+            |              |                 |              |
+            \--------------|c0DB STARTED     |<-------------/
+                           |                 |
+                           +-----------------+
diff --git a/riscv-sbi-hsm.png b/riscv-sbi-hsm.png
new file mode 100644
index
0000000000000000000000000000000000000000..0a1dcda07b23e04e2c2b4f396d6
d31e7099b9e91
GIT binary patch
literal 13518
zcmd6OXIN8Pw{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m>9tQr)3a~1q)I`OkNgk+Ovaoz
pC%%3QsQ1CAKfk{3StJ}~ra^b4CVW~4-zh;<6*X=aE8KhXzW~uxfG7X}

literal 0
HcmV?d00001

diff --git a/riscv-sbi.adoc b/riscv-sbi.adoc
index 2c2cf62..4ee2621 100644
--- a/riscv-sbi.adoc
+++ b/riscv-sbi.adoc
@@ -659,9 +659,29 @@ valid for harts implementing hypervisor
extension.
 
 == Hart State Management Extension (EID #0x48534D "HSM")
 
-The Hart State Management Extension introduces a set of functions
that allow
-the supervisor to request higher privilege mode to start/stop harts
running
-in supervisor mode.
+The Hart State Management (HSM) Extension introduces a set hart
states and a
+set of functions which allow the supervisor-mode (S-mode or VS-mode)
software
+to request a hart state change.
+
+.The possible hart states are as follows:
+* **STOPPED:** The hart is not executing in S-mode and it is
probably
+  powered-down by the SBI implementation if the underlying platform
has
+  a mechanism to physically power-down harts.
Should we also specify that SBI implementation should keep it WFI state
if the platform doesn't have a physical power-down capability ?

+* **STARTED:** The hart is physically powered-up and executing in S-
mode
+  or higher privilege mode.
+* **START_PENDING:** Some other hart has requested to start (or
power-up)
+  the hart from the **STOPPED** state and the SBI implementation is
still
+  working to get the hart in the **STARTED** state.
+* **STOP_PENDING:** The hart has requested to stop (or power-down)
itself
+  from the **STARTED** state and the SBI implementation is still
working
+  to get the hart in the **STOPPED** state.
+
+At any point in time, a hart should be in one of the above mentioned
hart
+states. The hart state transitions by the SBI implementation should
follow
+the state machine shown below in the figure <<fig_hsm>>.
+
+.SBI HSM State Machine
+image::riscv-sbi-hsm.png[id=fig_hsm,align="center"]
 
same comment as the previous patch about figure titles.

The diagram also specifies "SBI HART start/stop call". In stead of
that, we can just mention the actual sbi hsm function names.

 === Function: HART start (FID #0)
 
@@ -672,18 +692,22 @@ struct sbiret sbi_hart_start(unsigned long
hartid,
                              unsigned long priv)
 ----
 
-Informs the SBI implementation that the supervisor would like the
given hart
-to begin execution. This call is asynchronous -- more specifically,
-`sbi_hart_start()` may return before execution has actually begin as
long as
-the SBI implementation is capable of ensuring the return code is
accurate.
+Request the SBI implementation to start executing the given hart at
specified
+address in supervisor-mode (S-mode or VS-mode). This call is
asynchronous --
+more specifically, the `sbi_hart_start()` may return before target
hart
+starts executing as long as the SBI implemenation is capable of
ensuring
+the return code is accurate.
 
-*start_addr* points to a runtime-specified physical address, where a
hart can
-resume execution after its initialization/resume sequence. Before
jumping to
-*start_addr*, the hart MUST configure PMP if present and switch to
Supervisor
-mode.
+The `hartid` parameter specifies the target hart which is to be
started.
 
-*priv* is an XLEN-bit value. Upon execution from `start_addr`, `a1`
will
-contain this exact value.
+The `start_addr` parameter points to a runtime-specified physical
address,
+where the hart can start executing in supervisor-mode (S-mode or VS-
mode).
+If the SBI implementation is a platform runtime firmware executing
in
+machine-mode (M-mode) then it MUST configure PMP and other the M-
mode state
+before jumping to `start_addr` in supervisor-mode (S-mode or VS-
mode).
+
+The `priv` parameter is a XLEN-bit value which will be set in the
`a1`
+register when the hart starts executing at `start_addr`.
 
 *Returns* one of the following possible SBI error codes through
sbiret.error.
 
@@ -694,7 +718,7 @@ contain this exact value.
                               start executing from `start_addr`.
 | SBI_ERR_INVALID_ADDRESS   | `start_addr` is not valid possibly due
to
                               following reasons: +
-                              * it is not a valid physical address.
+
+                              * It is not a valid physical address.
+
                               * The address is prohibited by PMP to
run in
                                 supervisor mode.
 | SBI_ERR_INVALID_PARAM     | `hartid` is not a valid hartid as
corresponding
@@ -703,8 +727,8 @@ contain this exact value.
 | SBI_ERR_FAILED            | The start request failed for unknown
reasons.
 |===
 
-The target hart jumps to higher privilege mode (S-mode or VS-mode)
by
-executing at `start_addr` with following values in specific
registers.
+The target hart jumps to supervisor-mode (S-mode or VS-mode) at
address
+specified by `start_addr` with following values in specific
registers.
 
 [cols=",", width=50%, align="center", options="header"]
 |===
@@ -724,13 +748,20 @@ All other registers remain in an undefined
state.
 struct sbiret sbi_hart_stop(void)
 ----
 
-Returns ownership of the calling hart back to the SBI
implementation. This
-call is not expected to return under normal conditions.
`sbi_hart_stop()`
-must be called with supervisor and user interrupts disabled.
+Request the SBI implementation to stop executing the calling hart in
+supervisor-mode (S-mode or VS-mode) and return it's ownership to the
SBI
+implementation. This call is not expected to return under normal
conditions.
+The `sbi_hart_stop()` must be called with the supervisor-mode (S-
mode or
+VS-mode) interrupts disabled.
 
-*Returns* following SBI error code through sbiret.error only if it
fails.
+The possible error codes returned in sbiret.error are shown in the
+table below:
 
-* SBI_ERR_FAILED
+[cols="1,2", width=100%, align="center", options="header"]
+|===
+| Error code     | Description
+| SBI_ERR_FAILED | Failed to stop execution of the current hart
+|===
 
 === Function: HART get status (FID #2)
 
@@ -739,23 +770,33 @@ must be called with supervisor and user
interrupts disabled.
 struct sbiret sbi_hart_get_status(unsigned long hartid)
 ----
 
-*Returns* the current status of *hartid* in sbiret.value, or an
error through
-sbiret.error. The possible status values are shown on the table
below.
+Get the current status (or HSM state) of the given hart in
sbiret.value,
+or an error through sbiret.error.
+
+The `hartid` parameter specifies the target hart which is to be
started.
+
+The possible status values returned in sbiret.value are shown in the
+table below:
 
 [cols="2,1,2", width=80%, align="center", options="header"]
 |===
-| Name                  | Value | Description
-| STARTED               |   0   | Already started
-| STOPPED               |   1   | Stopped
-| START_REQUEST_PENDING |   2   | A start request pending
-| STOP_REQUEST_PENDING  |   3   | A stop request pending
+| Name          | Value | Description
+| STARTED       |   0   | Already started
+| STOPPED       |   1   | Stopped
+| START_PENDING |   2   | A start request pending
+| STOP_PENDING  |   3   | A stop request pending
 |===
 
-Possible error code:
+The possible error codes returned in sbiret.error are shown in the
+table below:
 
-* SBI_ERR_INVALID_PARAM: The given hartid is not valid
+[cols="1,2", width=100%, align="center", options="header"]
+|===
+| Error code            | Description
+| SBI_ERR_INVALID_PARAM | The given `hartid` or `start_addr` is not
valid
+|===
 
-Since harts may transition state at any time due to any concurrent
+The harts may transition HSM states at any time due to any
concurrent
 `sbi_hart_start` or `sbi_hart_stop` calls, the return value from
this
 function may not represent the actual state of the hart at the time
of
 return value verification.
--
Regards,
Atish

Join tech-unixplatformspec@lists.riscv.org to automatically receive all group messages.