pub trait VmArchVcpuOps: Sized {
type CreateConfig;
type SetupConfig;
type Exit: Debug;
Show 14 methods
// Required methods
fn new(
vm_id: VMId,
vcpu_id: VCpuId,
config: Self::CreateConfig,
) -> VmBackendResult<Self>;
fn set_entry(&mut self, entry: GuestPhysAddr) -> VmBackendResult;
fn set_nested_page_table(
&mut self,
config: NestedPagingConfig,
) -> VmBackendResult;
fn setup(&mut self, config: Self::SetupConfig) -> VmBackendResult;
fn run(&mut self) -> VmBackendResult<Self::Exit>;
fn bind(&mut self) -> VmBackendResult;
fn unbind(&mut self) -> VmBackendResult;
fn set_gpr(&mut self, reg: usize, val: usize);
fn inject_interrupt(&mut self, vector: usize) -> VmBackendResult;
fn set_return_value(&mut self, val: usize);
// Provided methods
fn guest_mpidr_from_create_config(
_config: &Self::CreateConfig,
) -> Option<u64> { ... }
fn decode_mmio_fault(
&mut self,
_fault_addr: GuestPhysAddr,
_access_flags: MappingFlags,
) -> Option<VmExit> { ... }
fn inject_interrupt_with_trigger(
&mut self,
vector: usize,
trigger: InterruptTriggerMode,
) -> VmBackendResult { ... }
fn handle_eoi(&mut self) -> Option<u8> { ... }
}Expand description
Architecture-specific vCPU operations consumed by AxVM.
Required Associated Types§
Sourcetype CreateConfig
type CreateConfig
Architecture-specific creation configuration.
Sourcetype SetupConfig
type SetupConfig
Architecture-specific setup configuration.
Required Methods§
Sourcefn new(
vm_id: VMId,
vcpu_id: VCpuId,
config: Self::CreateConfig,
) -> VmBackendResult<Self>
fn new( vm_id: VMId, vcpu_id: VCpuId, config: Self::CreateConfig, ) -> VmBackendResult<Self>
Creates a new architecture-specific vCPU.
Sourcefn set_entry(&mut self, entry: GuestPhysAddr) -> VmBackendResult
fn set_entry(&mut self, entry: GuestPhysAddr) -> VmBackendResult
Sets the guest entry point.
Sourcefn set_nested_page_table(
&mut self,
config: NestedPagingConfig,
) -> VmBackendResult
fn set_nested_page_table( &mut self, config: NestedPagingConfig, ) -> VmBackendResult
Sets the nested page table selected by AxVM.
Sourcefn setup(&mut self, config: Self::SetupConfig) -> VmBackendResult
fn setup(&mut self, config: Self::SetupConfig) -> VmBackendResult
Completes architecture-specific setup.
Sourcefn run(&mut self) -> VmBackendResult<Self::Exit>
fn run(&mut self) -> VmBackendResult<Self::Exit>
Runs the vCPU until an architecture-specific VM exit.
The caller pins the backend and masks local IRQs across this call. Guest execution must still allow host interrupts to force an exit independently of the guest interrupt mask. Before returning, restore the host trap environment and complete any acknowledged host IRQ on this CPU (or transfer its token to the interrupt controller’s retained route). Leave unacknowledged sources pending for normal host IRQ entry when the caller restores IRQs. The returned exit must not require replaying a host IRQ snapshot after the backend is unloaded.
Sourcefn bind(&mut self) -> VmBackendResult
fn bind(&mut self) -> VmBackendResult
Binds the vCPU to the current physical CPU.
Sourcefn unbind(&mut self) -> VmBackendResult
fn unbind(&mut self) -> VmBackendResult
Unbinds the vCPU from the current physical CPU.
Sourcefn inject_interrupt(&mut self, vector: usize) -> VmBackendResult
fn inject_interrupt(&mut self, vector: usize) -> VmBackendResult
Injects an interrupt into the vCPU.
Sourcefn set_return_value(&mut self, val: usize)
fn set_return_value(&mut self, val: usize)
Sets the guest return value.
Provided Methods§
Sourcefn guest_mpidr_from_create_config(_config: &Self::CreateConfig) -> Option<u64>
fn guest_mpidr_from_create_config(_config: &Self::CreateConfig) -> Option<u64>
Returns the guest-visible MPIDR encoded in a vCPU create config, if any.
Sourcefn decode_mmio_fault(
&mut self,
_fault_addr: GuestPhysAddr,
_access_flags: MappingFlags,
) -> Option<VmExit>
fn decode_mmio_fault( &mut self, _fault_addr: GuestPhysAddr, _access_flags: MappingFlags, ) -> Option<VmExit>
Decodes an architecture-specific memory fault as a legacy normalized MMIO event when possible.
This is kept as a transition helper for backends that still route
device faults through VmExit. New raw vCPU exits should use
Self::Exit and be handled in the architecture-local AxVM adapter.
Sourcefn inject_interrupt_with_trigger(
&mut self,
vector: usize,
trigger: InterruptTriggerMode,
) -> VmBackendResult
fn inject_interrupt_with_trigger( &mut self, vector: usize, trigger: InterruptTriggerMode, ) -> VmBackendResult
Injects an interrupt with trigger-mode metadata.
The compatibility default delegates edge-triggered interrupts to
Self::inject_interrupt. Backends must override this method to
support level-triggered injection.
Sourcefn handle_eoi(&mut self) -> Option<u8>
fn handle_eoi(&mut self) -> Option<u8>
Processes a guest EOI and returns an external EOI vector when needed.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".