Skip to content

Commit

Permalink
Introduce Physical Memory Protection Extension
Browse files Browse the repository at this point in the history
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:
riscv-software-src/opensbi#103

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
  • Loading branch information
lbmeng committed Mar 7, 2020
1 parent 9196248 commit 8efae8c
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions riscv-sbi.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,52 @@ 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 the PMP
protected SBI firmware information.

[source, C]
----
struct sbiret sbi_get_fw_prot_base()
----
*Returns* the protected SBI firmware base physical address through sbiret.value,
or one of the following possible SBI error codes through sbiret.error.

[cols="<,>",options="header,compact"]
|===
| Error code | Description
| SBI_SUCCESS | SBI firmware is protected via PMP, and its base +
physical address is returned through sbiret.value.
| SBI_ERR_NOT_SUPPORTED | PMP is not available on this platform, or SBI +
firmware is not protected via PMP.
|===

[source, C]
----
struct sbiret sbi_get_fw_prot_size()
----
*Returns* the protected SBI firmware size through sbiret.value, or one of the
following possible SBI error codes through sbiret.error.

[cols="<,>",options="header,compact"]
|===
| Error code | Description
| SBI_SUCCESS | SBI firmware is protected via PMP, and its size +
is returned through sbiret.value.
| SBI_ERR_NOT_SUPPORTED | PMP is not available on this platform, or SBI +
firmware is not protected via PMP.
|===

=== PMP Function Listing

[cols="<,,>",options="header,compact"]
|===
| Function Name | Function ID | Extension ID
| sbi_get_fw_prot_base | 0 | 0x504D50
| sbi_get_fw_prot_size | 1 | 0x504D50
|===

== Experimental SBI Extension Space, Extension IDs 0x0800000 through 0x08FFFFFF

No management.
Expand Down

0 comments on commit 8efae8c

Please sign in to comment.