hypervisor: Support creating a VM of a specified KVM type

This is necessary to support creating a TD VM.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford
2021-02-23 14:19:32 +00:00
parent 57ce0986f7
commit 1c54fc3ab7
2 changed files with 22 additions and 5 deletions

View File

@@ -15,7 +15,6 @@ use crate::x86_64::MsrList;
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
use kvm_ioctls::Cap;
use std::sync::Arc;
use thiserror::Error;
#[derive(Error, Debug)]
@@ -87,6 +86,12 @@ pub trait Hypervisor: Send + Sync {
fn create_vm(&self) -> Result<Arc<dyn Vm>>;
#[cfg(feature = "kvm")]
///
/// Create a Vm of a specific type using the underlying hypervisor
/// Return a hypervisor-agnostic Vm trait object
///
fn create_vm_with_type(&self, vm_type: u64) -> Result<Arc<dyn Vm>>;
#[cfg(feature = "kvm")]
///
/// Returns the size of the memory mapping required to use the vcpu's structures
///
fn get_vcpu_mmap_size(&self) -> Result<usize>;