Skip to main content

Crate sbi_rt

Crate sbi_rt 

Source
Expand description

RISC-V SBI runtime primitives library.

sbi-rt provides fundamental runtime primitives for the RISC-V Supervisor Binary Interface (SBI), wrapping low-level SBI calls in safe Rust interfaces that return SbiRet results.

All the SbiRet types returned by SBI call functions of this crate are SbiRet<usize>, representing the pointer width of the current RISC-V SBI platform. Those calls only works at RISC-V targets when building supervisor software (e.g. kernels or hypervisors); it builds under non-RISC-V targets but for tests or cargo fix purposes only.

Modules§

raw
Raw RISC-V SBI calls.

Structs§

Base
RISC-V SBI Base extension.
ColdReboot
Cold reboot as a reset type.
Console
Debug Console extension.
CounterMask
Counter index mask structure in SBI function calls for the PMU extension §11.
Cppc
SBI CPPC extension.
Dbtr
Debug Triggers extension.
ExtensionInfo
Information about an SBI extension.
Fence
Remote Fence extension.
Fwft
Firmware Features extension.
HartMask
Hart mask structure in SBI function calls.
Hsm
Hart State Monitor extension.
Ipi
Inter-processor Interrupt extension.
Mpxy
Message Proxy extension.
Nacl
Nested Acceleration extension.
NoReason
No reason as a reset reason.
NonRetentive
Default non-retentive hart suspension.
Physical
Physical slice wrapper with type annotation.
Pmu
Performance Monitoring Unit extension.
Reset
System Reset extension.
Retentive
Default retentive hart suspension.
SbiRet
SBI functions return type.
SharedPtr
Shared memory physical address raw pointer with type annotation.
Shutdown
Shutdown as a reset type.
Sse
Supervisor Software Events extension.
Sta
Steal-time Accounting extension.
Suspend
System Suspend extension.
SuspendToRam
Suspend to RAM as sleep type.
SystemFailure
System failure as a reset reason.
Timer
Timer programmer extension.
Version
SBI specification version.
WarmReboot
Warm reboot as a reset type.

Traits§

ConfigFlags
Flags to configure performance counter.
Extension
An SBI extension.
ResetReason
A valid reason for system reset.
ResetType
A valid type for system reset.
SleepType
A valid sleep type for system suspend.
StartFlags
Flags to start performance counter.
StopFlags
Flags to stop performance counter.
SuspendType
A valid suspend type for hart state monitor.

Functions§

console_read
Read bytes from the debug console into an output memory.
console_write
Write bytes to the debug console from input memory.
console_write_byte
Write a single byte to the debug console.
cppc_probe
Probe whether the CPPC register is implemented or not by the platform.
cppc_read
Read the CPPC register identified by given cppc_reg_id.
cppc_read_hi
Read the upper 32-bit value of the CPPC register identified by cppc_reg_id.
cppc_write
Write 64-bit value to the CPPC register identified by given cppc_reg_id.
debug_disable_triggers
Disable a set of debug triggers specified by the triggers mask parameter on the calling hart.
debug_enable_triggers
Enable a set of debug triggers specified by the triggers mask parameter on the calling hart.
debug_install_triggers
Install debug triggers based on an array of trigger configurations in the shared memory of the calling hart. The trig_idx assigned to each installed trigger configuration is written back in the shared memory.
debug_num_triggers
Get the number of debug triggers on the calling hart which can support the trigger configuration specified by trig_tdata1 parameter.
debug_read_triggers
Read the debug trigger state and configuration into shared memory for a range of debug triggers specified by the trig_idx_base and trig_count parameters on the calling hart.
debug_set_shmem
Set and enable the shared memory for debug trigger configuration on the calling hart.
debug_uninstall_triggers
Uninstall a set of debug triggers specified by the triggers mask parameter on the calling hart.
debug_update_triggers
Update already installed debug triggers based on a trigger configuration array in the shared memory of the calling hart.
fwft_get
Get the configuration value of a specific firmware feature.
fwft_set
Set the configuration value of a specific firmware feature.
get_marchid
Return value of marchid register in the current environment.
get_mimpid
Return value of mimpid register in the current environment.
get_mvendorid
Return the value of mvendorid register in the current environment.
get_sbi_impl_id
Return the current SBI implementation ID.
get_sbi_impl_version
Return the current SBI implementation version.
get_spec_version
Return the current SBI specification version.
hart_get_status
Get the current status (or HSM state id) of the given hart.
hart_start
Start executing the given hart at specified address in supervisor-mode.
hart_stop
Stop executing the calling hart in supervisor-mode.
hart_suspend
Put the calling hart into suspend or platform specific lower power states.
mpxy_get_channel_ids
Get channel IDs of the message channels accessible to the supervisor software in the shared memory of the calling hart.
mpxy_get_notification_events
Get the message protocol specific notification events on the MPXY channel specified by the channel_id parameter.
mpxy_get_shmem_size
Get the shared memory size in number of bytes for sending and receiving messages.
mpxy_read_attributes
Read message channel attributes.
mpxy_send_message_with_response
Send a message to the MPXY channel specified by the channel_id parameter and wait until a message response is received from the MPXY channel.
mpxy_send_message_without_response
Send a message to the MPXY channel specified by the channel_id parameter without waiting for a message response from the MPXY channel.
mpxy_set_shmem
Set the shared memory for sending and receiving messages on the calling hart.
mpxy_write_attributes
Write message channel attributes.
nacl_probe_feature
Probe a nested acceleration feature.
nacl_set_shmem
Set and enable the shared memory for nested acceleration on the calling hart.
nacl_sync_csr
Synchronize CSRs in the nested acceleration shared memory.
nacl_sync_hfence
Synchronize HFENCEs in the nested acceleration shared memory.
nacl_sync_sret
Synchronize CSRs and HFENCEs in the NACL shared memory and emulate the SRET instruction.
pmu_counter_config_matching
Find and configure a counter from a set of counters.
pmu_counter_fw_read
Provide the current value of a firmware counter.
pmu_counter_fw_read_hi
Provide the upper 32 bits from the value of a firmware counter.
pmu_counter_get_info
Get details about the specified counter.
pmu_counter_start
Start or enable a set of counters on the calling hart with the specified initial value.
pmu_counter_stop
Stop or disable a set of counters on the calling hart.
pmu_num_counters
Returns the number of counters, both hardware and firmware.
pmu_snapshot_set_shmem
Set and enable the PMU snapshot shared memory on the calling hart.
probe_extension
Probe information about one SBI extension from the current environment.
remote_fence_i
Execute FENCE.I instruction on remote harts.
remote_hfence_gvma
Execute HFENCE.GVMA instructions for all virtual machines on remote harts.
remote_hfence_gvma_vmid
Execute virtual machine id based HFENCE.GVMA instructions on remote harts.
remote_hfence_vvma
Execute HFENCE.VVMA for all address spaces in the current virtual machine on remote harts.
remote_hfence_vvma_asid
Execute address space based HFENCE.VVMA for current virtual machine on remote harts.
remote_sfence_vma
Execute SFENCE.VMA instructions for all address spaces on remote harts.
remote_sfence_vma_asid
Execute address-space-based SFENCE.VMA instructions on remote harts.
send_ipi
Send an inter-processor interrupt to all harts defined in hart mask.
set_timer
Programs the clock for the next event after an absolute time.
sse_complete
Complete the supervisor event handling for the highest priority event in RUNNING state on the calling hart.
sse_disable
Disable the software event specified by the event_id parameter.
sse_enable
Enable the software event specified by the event_id parameter.
sse_hart_mask
Stop receiving (or mask) software events on the calling hart. In other words, the calling hart will no longer be ready to receive software events from the SBI implementation.
sse_hart_unmask
Start receiving (or unmask) software events on the calling hart. In other words, the calling hart is ready to receive software events from the SBI implementation.
sse_inject
The supervisor software can inject a software event with this function.
sse_read_attrs
Read a range of event attribute values from a software event.
sse_register
Register an event handler for the software event.
sse_unregister
Unregister the event handler for given event_id.
sse_write_attrs
Write a range of event attribute values to a software event.
sta_set_shmem
Prepare shared memory for steal-time accounting feature.
system_reset
Reset the system based on provided reset_type and reset_reason.
system_suspend
Suspend the system based on provided sleep_type.