Skip to main content

18 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 91 defines 32-bit identifiers for the features which supervisor-mode software may request to set or get.

Table 91. FWFT Feature Types

ValueNameDescription
0x00000000MISALIGNED_EXC_DELEGControl misaligned access exception delegation to supervisor-mode
0x00000001LANDING_PADControl landing pad support for supervisor-mode.
0x00000002SHADOW_STACKControl shadow stack support for supervisor-mode.
0x00000003DOUBLE_TRAPControl double trap support.
0x00000004PTE_AD_HW_UPDATINGControl hardware updating of PTE A/D bits.
0x00000005POINTER_MASKING_PMLENControl the pointer masking length for supervisor-mode.
0x00000006 - 0x3fffffffLocal feature types reserved for future use.
0x40000000 - 0x7fffffffPlatform specific local feature types.
0x80000000 - 0xbfffffffGlobal feature types reserved for future use.
0xc0000000 - 0xffffffffPlatform specific global feature types.

These features have some attributes that define their behavior and are described in Table 92. The attribute values are defined for each feature in Table 93.

Table 92. FWFT Feature Attributes

AttributeDescription
ScopeDefines 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 valueReset value of the feature. Might be implementation defined.
ValuesPer 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.

Table 93. FWFT Feature Attribute Values

Feature NameResetScopeValues
MISALIGNED_EXC_DELEGImplementation-definedLocal| 0 | Disable misaligned exception delegation. | | 1 | Enable misaligned exception delegation. |
LANDING_PAD0Local| 0 | Disable landing pad for supervisor-mode. | | 1 | Enable landing pad for supervisor-mode. |
SHADOW_STACK0Local| 0 | Disable shadow-stack for supervisor-mode. | | 1 | Enable shadow-stack for supervisor-mode. |
DOUBLE_TRAP0Local| 0 | Disable double trap | | 1 | Enable double trap |
PTE_AD_HW_UPDATING0Local| 0 | Disable hardware updating of PTE A/D bits for supervisor-mode. | | 1 | Enable hardware updating of PTE A/D bits for supervisor-mode. |
POINTER_MASKING_PMLEN0Local| 0 | Disable pointer masking for supervisor-mode. | | N | Enable pointer masking for supervisor-mode with PMLEN = N. |

18.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 93 and flags in Table 94.

note

The set operation will succeed if requested value matches the existing value.

Table 94. FWFT Firmware Features Set Flags

NameEncodingDescription
LOCKBIT[0]If provided, once set, the feature value can no longer
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 95 below.

Table 95. FWFT Firmware Features Set Errors

Error codeDescription
SBI_SUCCESSfeature was set successfully.
SBI_ERR_NOT_SUPPORTEDfeature is not reserved and valid, but the platform does not support it due to one or more missing dependencies (Hardware or SBI implementation).
SBI_ERR_INVALID_PARAMProvided value or flags parameter is invalid.
SBI_ERR_DENIED- feature is reserved or is platform-specific and unimplemented
SBI_ERR_DENIED_LOCKEDfeature set operation failed because the feature is locked
SBI_ERR_FAILEDThe set operation failed for unspecified or unknown other reasons.
note

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.

18.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 93 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 96.

Table 96. FWFT Firmware Features Get Errors

Error codeDescription
SBI_SUCCESSFeature status was retrieved successfully.
SBI_ERR_NOT_SUPPORTEDfeature is not reserved and valid, but the platform does not support it due to one or more missing dependencies (Hardware or SBI implementation).
SBI_ERR_DENIEDfeature is reserved or is platform-specific and unimplemented.
SBI_ERR_FAILEDThe get operation failed for unspecified or unknown other reasons.

18.3 Function Listing

Table 97. FWFT Function List

Function NameSBI VersionFIDEID
sbi_fwft_set3.000x46574654
sbi_fwft_get3.010x46574654