vmm: support injecting NMI

Inject NMI interrupt when needed, by call ioctl KVM_NMI.

Signed-off-by: Yi Wang <foxywang@tencent.com>
This commit is contained in:
Yi Wang
2023-12-11 17:57:25 +08:00
committed by Rob Bradford
parent f40dd4a993
commit c72bf0b32d
7 changed files with 93 additions and 2 deletions

View File

@@ -316,6 +316,9 @@ pub enum Error {
#[cfg(feature = "igvm")]
#[error("Cannot load the igvm into memory: {0}")]
IgvmLoad(#[source] igvm_loader::Error),
#[error("Error injecting NMI")]
ErrorNmi,
}
pub type Result<T> = result::Result<T, Error>;
@@ -2446,6 +2449,15 @@ impl Vm {
+ note_size as u64
+ size_of::<elf::Elf64_Phdr>() as u64 * phdr_num as u64
}
pub fn nmi(&self) -> Result<()> {
return self
.cpu_manager
.lock()
.unwrap()
.nmi()
.map_err(|_| Error::ErrorNmi);
}
}
impl Pausable for Vm {