[hypervisor] Detect hypervisor
Detect underlying hypervisor as a first step for being able to do
hypervisor-specific operations.
Test: m pvmfw_img
Bug: 271493784
Change-Id: I82cc31f3b852bd295eedd492a20e4ead5d128bf0
diff --git a/libs/hyp/src/error.rs b/libs/hyp/src/error.rs
index 4e25e7f..408150e 100644
--- a/libs/hyp/src/error.rs
+++ b/libs/hyp/src/error.rs
@@ -16,6 +16,7 @@
use crate::KvmError;
use core::{fmt, result};
+use uuid::Uuid;
/// Result type with hypervisor error.
pub type Result<T> = result::Result<T, Error>;
@@ -27,6 +28,8 @@
MmioGuardNotsupported,
/// Failed to invoke a certain KVM HVC function.
KvmError(KvmError, u32),
+ /// Unsupported Hypervisor.
+ UnsupportedHypervisorUuid(Uuid),
/// The MMIO_GUARD granule used by the hypervisor is not supported.
UnsupportedMmioGuardGranule(usize),
}
@@ -38,6 +41,9 @@
Self::KvmError(e, function_id) => {
write!(f, "Failed to invoke the HVC function with function ID {function_id}: {e}")
}
+ Self::UnsupportedHypervisorUuid(u) => {
+ write!(f, "Unsupported Hypervisor UUID {u}")
+ }
Self::UnsupportedMmioGuardGranule(g) => {
write!(f, "Unsupported MMIO guard granule: {g}")
}