Skip to content

Commit

Permalink
ioctls: vcpu: Expose details from KVM_EXIT_FAIL_ENTRY exit
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
  • Loading branch information
rbradford authored and andreeaflorescu committed May 24, 2022
1 parent 8ae794a commit ccf0bda
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion coverage_config_x86_64.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"coverage_score": 85.3,
"coverage_score": 84.6,
"exclude_path": "",
"crate_features": ""
}
15 changes: 13 additions & 2 deletions src/ioctls/vcpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ pub enum VcpuExit<'a> {
/// Corresponds to KVM_EXIT_SHUTDOWN.
Shutdown,
/// Corresponds to KVM_EXIT_FAIL_ENTRY.
FailEntry,
FailEntry(
u64, /* hardware_entry_failure_reason */
u32, /* cpu */
),
/// Corresponds to KVM_EXIT_INTR.
Intr,
/// Corresponds to KVM_EXIT_SET_TPR.
Expand Down Expand Up @@ -1377,7 +1380,15 @@ impl VcpuFd {
}
KVM_EXIT_IRQ_WINDOW_OPEN => Ok(VcpuExit::IrqWindowOpen),
KVM_EXIT_SHUTDOWN => Ok(VcpuExit::Shutdown),
KVM_EXIT_FAIL_ENTRY => Ok(VcpuExit::FailEntry),
KVM_EXIT_FAIL_ENTRY => {
// Safe because the exit_reason (which comes from the kernel) told us which
// union field to use.
let fail_entry = unsafe { &mut run.__bindgen_anon_1.fail_entry };
Ok(VcpuExit::FailEntry(
fail_entry.hardware_entry_failure_reason,
fail_entry.cpu,
))
}
KVM_EXIT_INTR => Ok(VcpuExit::Intr),
KVM_EXIT_SET_TPR => Ok(VcpuExit::SetTpr),
KVM_EXIT_TPR_ACCESS => Ok(VcpuExit::TprAccess),
Expand Down

0 comments on commit ccf0bda

Please sign in to comment.