hypervisor, vmm: Implement the mshv module and add mshv support in vmm

Implement hypervisor, Vm, Vcpu crate at a minimal
functionalities. Also adds the mshv feature gate,
separates out the functionalities between kvm and
mshv inside the vmm crate.

Co-Developed-by: Nuno Das Neves <nudasnev@microsoft.com>
Signed-off-by: Nuno Das Neves <nudasnev@microsoft.com>
Co-Developed-by: Praveen Paladugu <prapal@microsoft.com>
Signed-off-by: Praveen Paladugu <prapal@microsoft.com>
Co-Developed-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Co-Developed-by: Wei Liu <liuwe@microsoft.com>
Signed-off-by: Wei Liu <liuwe@microsoft.com>
Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
Muminul Islam
2020-12-03 15:24:57 -08:00
committed by Samuel Ortiz
parent f4af668d76
commit 23c46b162e
5 changed files with 499 additions and 7 deletions

View File

@@ -9,7 +9,9 @@
//
use crate::vm::Vm;
#[cfg(target_arch = "x86_64")]
use crate::x86_64::{CpuId, MsrList};
use crate::x86_64::CpuId;
#[cfg(target_arch = "x86_64")]
use crate::x86_64::MsrList;
#[cfg(all(feature = "kvm", target_arch = "x86_64"))]
use kvm_ioctls::Cap;
use std::sync::Arc;
@@ -20,6 +22,11 @@ use thiserror::Error;
///
///
pub enum HypervisorError {
///
/// hypervisor creation error
///
#[error("Failed to create the hypervisor: {0}")]
HypervisorCreate(#[source] anyhow::Error),
///
/// Vm creation failure
///
@@ -103,6 +110,7 @@ pub trait Hypervisor: Send + Sync {
/// Get the supported CpuID
///
fn get_cpuid(&self) -> Result<CpuId>;
#[cfg(not(feature = "mshv"))]
///
/// Check particular extensions if any
///