Skip to main content

VmArchVcpuOps

Trait VmArchVcpuOps 

Source
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§

Source

type CreateConfig

Architecture-specific creation configuration.

Source

type SetupConfig

Architecture-specific setup configuration.

Source

type Exit: Debug

Architecture-specific VM-exit type returned by Self::run.

Required Methods§

Source

fn new( vm_id: VMId, vcpu_id: VCpuId, config: Self::CreateConfig, ) -> VmBackendResult<Self>

Creates a new architecture-specific vCPU.

Source

fn set_entry(&mut self, entry: GuestPhysAddr) -> VmBackendResult

Sets the guest entry point.

Source

fn set_nested_page_table( &mut self, config: NestedPagingConfig, ) -> VmBackendResult

Sets the nested page table selected by AxVM.

Source

fn setup(&mut self, config: Self::SetupConfig) -> VmBackendResult

Completes architecture-specific setup.

Source

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.

Source

fn bind(&mut self) -> VmBackendResult

Binds the vCPU to the current physical CPU.

Source

fn unbind(&mut self) -> VmBackendResult

Unbinds the vCPU from the current physical CPU.

Source

fn set_gpr(&mut self, reg: usize, val: usize)

Sets a general-purpose register.

Source

fn inject_interrupt(&mut self, vector: usize) -> VmBackendResult

Injects an interrupt into the vCPU.

Source

fn set_return_value(&mut self, val: usize)

Sets the guest return value.

Provided Methods§

Source

fn guest_mpidr_from_create_config(_config: &Self::CreateConfig) -> Option<u64>

Returns the guest-visible MPIDR encoded in a vCPU create config, if any.

Source

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.

Source

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.

Source

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".

Implementors§