Trait VmArch

Source
pub trait VmArch: Vm {
    // Required methods
    fn get_hypervisor(&self) -> &dyn HypervisorX86_64;
    fn create_vcpu(&self, id: usize) -> Result<Arc<dyn VcpuX86_64>, Error>;
    fn set_tss_addr(&self, addr: GuestAddress) -> Result<(), Error>;
    fn set_identity_map_addr(&self, addr: GuestAddress) -> Result<(), Error>;
    fn load_protected_vm_firmware(
        &self,
        fw_addr: GuestAddress,
        fw_max_size: u64,
    ) -> Result<(), Error>;

    // Provided method
    fn set_boot_cpu_id(&self, _vcpu_id: usize) -> Result<(), Error> { ... }
}
Expand description

A wrapper for using a VM on x86_64 and getting/setting its state.

Required Methods§

Source

fn get_hypervisor(&self) -> &dyn HypervisorX86_64

Gets the HypervisorX86_64 that created this VM.

Source

fn create_vcpu(&self, id: usize) -> Result<Arc<dyn VcpuX86_64>, Error>

Create a Vcpu with the specified Vcpu ID.

Source

fn set_tss_addr(&self, addr: GuestAddress) -> Result<(), Error>

Sets the address of the three-page region in the VM’s address space.

Source

fn set_identity_map_addr(&self, addr: GuestAddress) -> Result<(), Error>

Sets the address of a one-page region in the VM’s address space.

Source

fn load_protected_vm_firmware( &self, fw_addr: GuestAddress, fw_max_size: u64, ) -> Result<(), Error>

Load pVM firmware for the VM, creating a memslot for it as needed.

Only works on protected VMs (i.e. those with vm_type == KVM_X86_PKVM_PROTECTED_VM).

Provided Methods§

Source

fn set_boot_cpu_id(&self, _vcpu_id: usize) -> Result<(), Error>

Designates the vCPU with ID vcpu_id as the bootstrap processor (BSP).

Must be called before any vCPU is created. Hypervisors that can’t choose the boot vCPU return ENOTSUP; for them the boot vCPU is always vCPU 0.

Implementors§