19.1. SBI Firmware Features Extension (EID #0x46574654 "FWFT")
The Firmware Features extension enables supervisor-mode software to manage and control specific hardware capabilities or SBI implementation features. Table 77 defines 32-bit identifiers for the features which supervisor-mode software may request to set or get.
| Value | Name | Description |
|---|---|---|
0x00000000 |
MISALIGNED_EXC_DELEG |
Control misaligned access exception delegation to supervisor-mode |
0x00000001 |
LANDING_PAD |
Control landing pad support for supervisor-mode. |
0x00000002 |
SHADOW_STACK |
Control shadow stack support for supervisor-mode. |
0x00000003 |
DOUBLE_TRAP |
Control double trap support. |
0x00000004 |
PTE_AD_HW_UPDATING |
Control hardware updating of PTE A/D bits. |
0x00000005 |
POINTER_MASKING_PMLEN |
Control the pointer masking length for supervisor-mode. |
0x00000006 - 0x3fffffff |
Local feature types reserved for future use. |
|
0x40000000 - 0x7fffffff |
Platform specific local feature types. |
|
0x80000000 - 0xbfffffff |
Global feature types reserved for future use. |
|
0xc0000000 - 0xffffffff |
Platform specific global feature types. |
These features have some attributes that define their behavior and are described in Table 78. The attribute values are defined for each feature in Table 79.
| Attribute | Description |
|---|---|
Scope |
Defines if a feature is local (per-hart) or global. Global features only need to be enabled/disabled by a single hart, whereas local features need to be enabled/disabled by each hart. The status and flags of local features can be different from one hart to another. |
Reset value |
Reset value of the feature. Might be implementation defined. |
Values |
Per feature values that can be set. |
During non-retentive suspend, feature values are retained and restored by the SBI when resuming operations. Upon hart reset, local feature values are not retained and reset to their default reset values according to the feature description. Upon system reset, global and local feature values are reset.
| Feature Name | Reset | Scope | Values | ||||
|---|---|---|---|---|---|---|---|
MISALIGNED_EXC_DELEG |
Implementation-defined |
Local |
|
||||
LANDING_PAD |
0 |
Local |
|
||||
SHADOW_STACK |
0 |
Local |
|
||||
DOUBLE_TRAP |
0 |
Local |
|
||||
PTE_AD_HW_UPDATING |
0 |
Local |
|
||||
POINTER_MASKING_PMLEN |
0 |
Local |
|
19.1.1. Function: Firmware Features Set (FID #0)
struct sbiret sbi_fwft_set(uint32_t feature,
unsigned long value,
unsigned long flags)
A successful return from sbi_fwft_set() results in the requested
firmware feature to be set according to the value and flags parameters for
which per feature supported values are described in
Table 79 and flags in Table 4.
The set operation will succeed if requested value matches the existing
value.
|
| Name | Encoding | Description |
|---|---|---|
LOCK |
BIT[0] |
If provided, once set, the feature value can no longer
be modified until: |
BIT[XLEN-1:1] |
Reserved for future use and must be zero. |
In case of failure, feature value is not modified and the possible error codes
returned in sbiret.error are shown in Table 80 below.
| Error code | Description |
|---|---|
SBI_SUCCESS |
|
SBI_ERR_NOT_SUPPORTED |
|
SBI_ERR_INVALID_PARAM |
Provided |
SBI_ERR_DENIED |
|
SBI_ERR_DENIED_LOCKED |
|
SBI_ERR_FAILED |
The set operation failed for unspecified or unknown other reasons. |
The rationale for an SBI implementation to return SBI_ERR_DENIED is for
instance to allow some hypervisors to simply passthrough the misaligned
delegation state to the Guest/VM and deny any changes to that delegation state
from the Guest/VM. If authorized, an SBI call would be required at each Guest/VM
switch if delegation choices are different between Host and Guest/VM.
|
19.1.2. Function: Firmware Features Get (FID #1)
struct sbiret sbi_fwft_get(uint32_t feature)
A successful return from sbi_fwft_get() results in the firmware
feature configuration value to be returned in sbiret.value. Possible
sbiret.value values are described in Table 79 for each
feature ID.
In case of failure, the content of sbiret.value is zero and the possible error
codes returned in sbiret.error are shown in Table 6.
| Error code | Description |
|---|---|
SBI_SUCCESS |
Feature status was retrieved successfully. |
SBI_ERR_NOT_SUPPORTED |
|
SBI_ERR_DENIED |
|
SBI_ERR_FAILED |
The get operation failed for unspecified or unknown other reasons. |