misc: hypervisor: streamline error Display::fmt()

The changes were mostly automatically applied using the Python
script mentioned in the first commit of this series.

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
Philipp Schuster
2025-05-21 12:32:09 +02:00
committed by Rob Bradford
parent 1b91aa8ef3
commit 72c8178335
7 changed files with 127 additions and 127 deletions
+3 -3
View File
@@ -16,13 +16,13 @@ use crate::{CpuState, HypervisorDeviceError, HypervisorVmError};
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum Error { pub enum Error {
/// Error while calling KVM ioctl for setting up the global interrupt controller. /// Error while calling KVM ioctl for setting up the global interrupt controller.
#[error("Failed creating GIC device: {0}")] #[error("Failed creating GIC device")]
CreateGic(#[source] HypervisorVmError), CreateGic(#[source] HypervisorVmError),
/// Error while setting device attributes for the GIC. /// Error while setting device attributes for the GIC.
#[error("Failed setting device attributes for the GIC: {0}")] #[error("Failed setting device attributes for the GIC")]
SetDeviceAttribute(#[source] HypervisorDeviceError), SetDeviceAttribute(#[source] HypervisorDeviceError),
/// Error while getting device attributes for the GIC. /// Error while getting device attributes for the GIC.
#[error("Failed getting device attributes for the GIC: {0}")] #[error("Failed getting device attributes for the GIC")]
GetDeviceAttribute(#[source] HypervisorDeviceError), GetDeviceAttribute(#[source] HypervisorDeviceError),
} }
pub type Result<T> = result::Result<T, Error>; pub type Result<T> = result::Result<T, Error>;
+17 -17
View File
@@ -36,58 +36,58 @@ impl<T: Debug> Display for Exception<T> {
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum PlatformError { pub enum PlatformError {
#[error("Invalid address: {0}")] #[error("Invalid address")]
InvalidAddress(#[source] anyhow::Error), InvalidAddress(#[source] anyhow::Error),
#[error("Invalid register: {0}")] #[error("Invalid register")]
InvalidRegister(#[source] anyhow::Error), InvalidRegister(#[source] anyhow::Error),
#[error("Invalid state: {0}")] #[error("Invalid state")]
InvalidState(#[source] anyhow::Error), InvalidState(#[source] anyhow::Error),
#[error("Memory read failure: {0}")] #[error("Memory read failure")]
MemoryReadFailure(#[source] anyhow::Error), MemoryReadFailure(#[source] anyhow::Error),
#[error("Memory write failure: {0}")] #[error("Memory write failure")]
MemoryWriteFailure(#[source] anyhow::Error), MemoryWriteFailure(#[source] anyhow::Error),
#[error("Get CPU state failure: {0}")] #[error("Get CPU state failure")]
GetCpuStateFailure(#[source] anyhow::Error), GetCpuStateFailure(#[source] anyhow::Error),
#[error("Set CPU state failure: {0}")] #[error("Set CPU state failure")]
SetCpuStateFailure(#[source] anyhow::Error), SetCpuStateFailure(#[source] anyhow::Error),
#[error("Translate virtual address: {0}")] #[error("Translate virtual address")]
TranslateVirtualAddress(#[source] anyhow::Error), TranslateVirtualAddress(#[source] anyhow::Error),
#[error("Unsupported CPU Mode: {0}")] #[error("Unsupported CPU Mode")]
UnsupportedCpuMode(#[source] anyhow::Error), UnsupportedCpuMode(#[source] anyhow::Error),
#[error("Invalid instruction operand: {0}")] #[error("Invalid instruction operand")]
InvalidOperand(#[source] anyhow::Error), InvalidOperand(#[source] anyhow::Error),
} }
#[derive(Error, Debug)] #[derive(Error, Debug)]
pub enum EmulationError<T: Debug> { pub enum EmulationError<T: Debug> {
#[error("Unsupported instruction: {0}")] #[error("Unsupported instruction")]
UnsupportedInstruction(#[source] anyhow::Error), UnsupportedInstruction(#[source] anyhow::Error),
#[error("Unsupported memory size: {0}")] #[error("Unsupported memory size")]
UnsupportedMemorySize(#[source] anyhow::Error), UnsupportedMemorySize(#[source] anyhow::Error),
#[error("Invalid operand: {0}")] #[error("Invalid operand")]
InvalidOperand(#[source] anyhow::Error), InvalidOperand(#[source] anyhow::Error),
#[error("Wrong number of operands: {0}")] #[error("Wrong number of operands")]
WrongNumberOperands(#[source] anyhow::Error), WrongNumberOperands(#[source] anyhow::Error),
#[error("Instruction Exception: {0}")] #[error("Instruction Exception")]
InstructionException(#[source] Exception<T>), InstructionException(#[source] Exception<T>),
#[error("Instruction fetching error: {0}")] #[error("Instruction fetching error")]
InstructionFetchingError(#[source] anyhow::Error), InstructionFetchingError(#[source] anyhow::Error),
#[error("Platform emulation error: {0}")] #[error("Platform emulation error")]
PlatformEmulationError(#[source] PlatformError), PlatformEmulationError(#[source] PlatformError),
#[error(transparent)] #[error(transparent)]
+3 -3
View File
@@ -13,13 +13,13 @@ use crate::{AiaState, HypervisorDeviceError, HypervisorVmError};
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum Error { pub enum Error {
/// Error while calling KVM ioctl for setting up the global interrupt controller. /// Error while calling KVM ioctl for setting up the global interrupt controller.
#[error("Failed creating AIA device: {0}")] #[error("Failed creating AIA device")]
CreateAia(#[source] HypervisorVmError), CreateAia(#[source] HypervisorVmError),
/// Error while setting device attributes for the AIA. /// Error while setting device attributes for the AIA.
#[error("Failed setting device attributes for the AIA: {0}")] #[error("Failed setting device attributes for the AIA")]
SetDeviceAttribute(#[source] HypervisorDeviceError), SetDeviceAttribute(#[source] HypervisorDeviceError),
/// Error while getting device attributes for the AIA. /// Error while getting device attributes for the AIA.
#[error("Failed getting device attributes for the AIA: {0}")] #[error("Failed getting device attributes for the AIA")]
GetDeviceAttribute(#[source] HypervisorDeviceError), GetDeviceAttribute(#[source] HypervisorDeviceError),
} }
pub type Result<T> = result::Result<T, Error>; pub type Result<T> = result::Result<T, Error>;
+52 -52
View File
@@ -43,171 +43,171 @@ pub enum HypervisorCpuError {
/// ///
/// Setting standard registers error /// Setting standard registers error
/// ///
#[error("Failed to set standard register: {0}")] #[error("Failed to set standard register")]
SetStandardRegs(#[source] anyhow::Error), SetStandardRegs(#[source] anyhow::Error),
/// ///
/// Setting standard registers error /// Setting standard registers error
/// ///
#[error("Failed to get standard registers: {0}")] #[error("Failed to get standard registers")]
GetStandardRegs(#[source] anyhow::Error), GetStandardRegs(#[source] anyhow::Error),
/// ///
/// Setting special register error /// Setting special register error
/// ///
#[error("Failed to set special registers: {0}")] #[error("Failed to set special registers")]
SetSpecialRegs(#[source] anyhow::Error), SetSpecialRegs(#[source] anyhow::Error),
/// ///
/// Getting standard register error /// Getting standard register error
/// ///
#[error("Failed to get special registers: {0}")] #[error("Failed to get special registers")]
GetSpecialRegs(#[source] anyhow::Error), GetSpecialRegs(#[source] anyhow::Error),
/// ///
/// Setting floating point registers error /// Setting floating point registers error
/// ///
#[error("Failed to set floating point registers: {0}")] #[error("Failed to set floating point registers")]
SetFloatingPointRegs(#[source] anyhow::Error), SetFloatingPointRegs(#[source] anyhow::Error),
/// ///
/// Getting floating point register error /// Getting floating point register error
/// ///
#[error("Failed to get floating points registers: {0}")] #[error("Failed to get floating points registers")]
GetFloatingPointRegs(#[source] anyhow::Error), GetFloatingPointRegs(#[source] anyhow::Error),
/// ///
/// Setting Cpuid error /// Setting Cpuid error
/// ///
#[error("Failed to set Cpuid: {0}")] #[error("Failed to set Cpuid")]
SetCpuid(#[source] anyhow::Error), SetCpuid(#[source] anyhow::Error),
/// ///
/// Getting Cpuid error /// Getting Cpuid error
/// ///
#[error("Failed to get Cpuid: {0}")] #[error("Failed to get Cpuid")]
GetCpuid(#[source] anyhow::Error), GetCpuid(#[source] anyhow::Error),
/// ///
/// Setting lapic state error /// Setting lapic state error
/// ///
#[error("Failed to set Lapic state: {0}")] #[error("Failed to set Lapic state")]
SetLapicState(#[source] anyhow::Error), SetLapicState(#[source] anyhow::Error),
/// ///
/// Getting Lapic state error /// Getting Lapic state error
/// ///
#[error("Failed to get Lapic state: {0}")] #[error("Failed to get Lapic state")]
GetlapicState(#[source] anyhow::Error), GetlapicState(#[source] anyhow::Error),
/// ///
/// Setting MSR entries error /// Setting MSR entries error
/// ///
#[error("Failed to set Msr entries: {0}")] #[error("Failed to set Msr entries")]
SetMsrEntries(#[source] anyhow::Error), SetMsrEntries(#[source] anyhow::Error),
/// ///
/// Getting Msr entries error /// Getting Msr entries error
/// ///
#[error("Failed to get Msr entries: {0}")] #[error("Failed to get Msr entries")]
GetMsrEntries(#[source] anyhow::Error), GetMsrEntries(#[source] anyhow::Error),
/// ///
/// Setting multi-processing state error /// Setting multi-processing state error
/// ///
#[error("Failed to set MP state: {0}")] #[error("Failed to set MP state")]
SetMpState(#[source] anyhow::Error), SetMpState(#[source] anyhow::Error),
/// ///
/// Getting multi-processing state error /// Getting multi-processing state error
/// ///
#[error("Failed to get MP state: {0}")] #[error("Failed to get MP state")]
GetMpState(#[source] anyhow::Error), GetMpState(#[source] anyhow::Error),
/// ///
/// Setting Saved Processor Extended States error /// Setting Saved Processor Extended States error
/// ///
#[cfg(feature = "kvm")] #[cfg(feature = "kvm")]
#[error("Failed to set Saved Processor Extended States: {0}")] #[error("Failed to set Saved Processor Extended States")]
SetXsaveState(#[source] anyhow::Error), SetXsaveState(#[source] anyhow::Error),
/// ///
/// Getting Saved Processor Extended States error /// Getting Saved Processor Extended States error
/// ///
#[cfg(feature = "kvm")] #[cfg(feature = "kvm")]
#[error("Failed to get Saved Processor Extended States: {0}")] #[error("Failed to get Saved Processor Extended States")]
GetXsaveState(#[source] anyhow::Error), GetXsaveState(#[source] anyhow::Error),
/// ///
/// Getting the VP state components error /// Getting the VP state components error
/// ///
#[cfg(feature = "mshv")] #[cfg(feature = "mshv")]
#[error("Failed to get VP State Components: {0}")] #[error("Failed to get VP State Components")]
GetAllVpStateComponents(#[source] anyhow::Error), GetAllVpStateComponents(#[source] anyhow::Error),
/// ///
/// Setting the VP state components error /// Setting the VP state components error
/// ///
#[cfg(feature = "mshv")] #[cfg(feature = "mshv")]
#[error("Failed to set VP State Components: {0}")] #[error("Failed to set VP State Components")]
SetAllVpStateComponents(#[source] anyhow::Error), SetAllVpStateComponents(#[source] anyhow::Error),
/// ///
/// Setting Extended Control Registers error /// Setting Extended Control Registers error
/// ///
#[error("Failed to set Extended Control Registers: {0}")] #[error("Failed to set Extended Control Registers")]
SetXcsr(#[source] anyhow::Error), SetXcsr(#[source] anyhow::Error),
/// ///
/// Getting Extended Control Registers error /// Getting Extended Control Registers error
/// ///
#[error("Failed to get Extended Control Registers: {0}")] #[error("Failed to get Extended Control Registers")]
GetXcsr(#[source] anyhow::Error), GetXcsr(#[source] anyhow::Error),
/// ///
/// Running Vcpu error /// Running Vcpu error
/// ///
#[error("Failed to run vcpu: {0}")] #[error("Failed to run vcpu")]
RunVcpu(#[source] anyhow::Error), RunVcpu(#[source] anyhow::Error),
/// ///
/// Getting Vcpu events error /// Getting Vcpu events error
/// ///
#[error("Failed to get Vcpu events: {0}")] #[error("Failed to get Vcpu events")]
GetVcpuEvents(#[source] anyhow::Error), GetVcpuEvents(#[source] anyhow::Error),
/// ///
/// Setting Vcpu events error /// Setting Vcpu events error
/// ///
#[error("Failed to set Vcpu events: {0}")] #[error("Failed to set Vcpu events")]
SetVcpuEvents(#[source] anyhow::Error), SetVcpuEvents(#[source] anyhow::Error),
/// ///
/// Vcpu Init error /// Vcpu Init error
/// ///
#[error("Failed to init vcpu: {0}")] #[error("Failed to init vcpu")]
VcpuInit(#[source] anyhow::Error), VcpuInit(#[source] anyhow::Error),
/// ///
/// Vcpu Finalize error /// Vcpu Finalize error
/// ///
#[error("Failed to finalize vcpu: {0}")] #[error("Failed to finalize vcpu")]
VcpuFinalize(#[source] anyhow::Error), VcpuFinalize(#[source] anyhow::Error),
/// ///
/// Setting one reg error /// Setting one reg error
/// ///
#[error("Failed to set one reg: {0}")] #[error("Failed to set one reg")]
SetRegister(#[source] anyhow::Error), SetRegister(#[source] anyhow::Error),
/// ///
/// Getting one reg error /// Getting one reg error
/// ///
#[error("Failed to get one reg: {0}")] #[error("Failed to get one reg")]
GetRegister(#[source] anyhow::Error), GetRegister(#[source] anyhow::Error),
/// ///
/// Getting guest clock paused error /// Getting guest clock paused error
/// ///
#[error("Failed to notify guest its clock was paused: {0}")] #[error("Failed to notify guest its clock was paused")]
NotifyGuestClockPaused(#[source] anyhow::Error), NotifyGuestClockPaused(#[source] anyhow::Error),
/// ///
/// Setting debug register error /// Setting debug register error
/// ///
#[error("Failed to set debug registers: {0}")] #[error("Failed to set debug registers")]
SetDebugRegs(#[source] anyhow::Error), SetDebugRegs(#[source] anyhow::Error),
/// ///
/// Getting debug register error /// Getting debug register error
/// ///
#[error("Failed to get debug registers: {0}")] #[error("Failed to get debug registers")]
GetDebugRegs(#[source] anyhow::Error), GetDebugRegs(#[source] anyhow::Error),
/// ///
/// Setting misc register error /// Setting misc register error
/// ///
#[error("Failed to set misc registers: {0}")] #[error("Failed to set misc registers")]
SetMiscRegs(#[source] anyhow::Error), SetMiscRegs(#[source] anyhow::Error),
/// ///
/// Getting misc register error /// Getting misc register error
/// ///
#[error("Failed to get misc registers: {0}")] #[error("Failed to get misc registers")]
GetMiscRegs(#[source] anyhow::Error), GetMiscRegs(#[source] anyhow::Error),
/// ///
/// Write to Guest Mem /// Write to Guest Mem
/// ///
#[error("Failed to write to Guest Mem at: {0}")] #[error("Failed to write to Guest Mem at")]
GuestMemWrite(#[source] anyhow::Error), GuestMemWrite(#[source] anyhow::Error),
/// Enabling HyperV SynIC error /// Enabling HyperV SynIC error
/// ///
@@ -216,68 +216,68 @@ pub enum HypervisorCpuError {
/// ///
/// Getting AArch64 core register error /// Getting AArch64 core register error
/// ///
#[error("Failed to get aarch64 core register: {0}")] #[error("Failed to get aarch64 core register")]
GetAarchCoreRegister(#[source] anyhow::Error), GetAarchCoreRegister(#[source] anyhow::Error),
/// ///
/// Setting AArch64 core register error /// Setting AArch64 core register error
/// ///
#[error("Failed to set aarch64 core register: {0}")] #[error("Failed to set aarch64 core register")]
SetAarchCoreRegister(#[source] anyhow::Error), SetAarchCoreRegister(#[source] anyhow::Error),
/// ///
/// Getting RISC-V 64-bit core register error /// Getting RISC-V 64-bit core register error
/// ///
#[error("Failed to get riscv64 core register: {0}")] #[error("Failed to get riscv64 core register")]
GetRiscvCoreRegister(#[source] anyhow::Error), GetRiscvCoreRegister(#[source] anyhow::Error),
/// ///
/// Setting RISC-V 64-bit core register error /// Setting RISC-V 64-bit core register error
/// ///
#[error("Failed to set riscv64 core register: {0}")] #[error("Failed to set riscv64 core register")]
SetRiscvCoreRegister(#[source] anyhow::Error), SetRiscvCoreRegister(#[source] anyhow::Error),
/// ///
/// Getting registers list error /// Getting registers list error
/// ///
#[error("Failed to retrieve list of registers: {0}")] #[error("Failed to retrieve list of registers")]
GetRegList(#[source] anyhow::Error), GetRegList(#[source] anyhow::Error),
/// ///
/// Getting AArch64 system register error /// Getting AArch64 system register error
/// ///
#[error("Failed to get system register: {0}")] #[error("Failed to get system register")]
GetSysRegister(#[source] anyhow::Error), GetSysRegister(#[source] anyhow::Error),
/// ///
/// Setting AArch64 system register error /// Setting AArch64 system register error
/// ///
#[error("Failed to set system register: {0}")] #[error("Failed to set system register")]
SetSysRegister(#[source] anyhow::Error), SetSysRegister(#[source] anyhow::Error),
/// ///
/// Getting RISC-V 64-bit non-core register error /// Getting RISC-V 64-bit non-core register error
/// ///
#[error("Failed to get non-core register: {0}")] #[error("Failed to get non-core register")]
GetNonCoreRegister(#[source] anyhow::Error), GetNonCoreRegister(#[source] anyhow::Error),
/// ///
/// Setting RISC-V 64-bit non-core register error /// Setting RISC-V 64-bit non-core register error
/// ///
#[error("Failed to set non-core register: {0}")] #[error("Failed to set non-core register")]
SetNonCoreRegister(#[source] anyhow::Error), SetNonCoreRegister(#[source] anyhow::Error),
/// ///
/// GVA translation error /// GVA translation error
/// ///
#[error("Failed to translate GVA: {0}")] #[error("Failed to translate GVA")]
TranslateVirtualAddress(#[source] anyhow::Error), TranslateVirtualAddress(#[source] anyhow::Error),
/// ///
/// Set cpu attribute error /// Set cpu attribute error
/// ///
#[error("Failed to set vcpu attribute: {0}")] #[error("Failed to set vcpu attribute")]
SetVcpuAttribute(#[source] anyhow::Error), SetVcpuAttribute(#[source] anyhow::Error),
/// ///
/// Check if cpu has a certain attribute error /// Check if cpu has a certain attribute error
/// ///
#[error("Failed to check if vcpu has attribute: {0}")] #[error("Failed to check if vcpu has attribute")]
HasVcpuAttribute(#[source] anyhow::Error), HasVcpuAttribute(#[source] anyhow::Error),
/// ///
/// Failed to initialize TDX on CPU /// Failed to initialize TDX on CPU
/// ///
#[cfg(feature = "tdx")] #[cfg(feature = "tdx")]
#[error("Failed to initialize TDX: {0}")] #[error("Failed to initialize TDX")]
InitializeTdx(#[source] std::io::Error), InitializeTdx(#[source] std::io::Error),
/// ///
/// Unknown TDX VM call /// Unknown TDX VM call
@@ -295,33 +295,33 @@ pub enum HypervisorCpuError {
/// ///
/// Error getting TSC frequency /// Error getting TSC frequency
/// ///
#[error("Failed to get TSC frequency: {0}")] #[error("Failed to get TSC frequency")]
GetTscKhz(#[source] anyhow::Error), GetTscKhz(#[source] anyhow::Error),
/// ///
/// Error setting TSC frequency /// Error setting TSC frequency
/// ///
#[error("Failed to set TSC frequency: {0}")] #[error("Failed to set TSC frequency")]
SetTscKhz(#[source] anyhow::Error), SetTscKhz(#[source] anyhow::Error),
/// ///
/// Error reading value at given GPA /// Error reading value at given GPA
/// ///
#[error("Failed to read from GPA: {0}")] #[error("Failed to read from GPA")]
GpaRead(#[source] anyhow::Error), GpaRead(#[source] anyhow::Error),
/// ///
/// Error writing value at given GPA /// Error writing value at given GPA
/// ///
#[error("Failed to write to GPA: {0}")] #[error("Failed to write to GPA")]
GpaWrite(#[source] anyhow::Error), GpaWrite(#[source] anyhow::Error),
/// ///
/// Error getting CPUID leaf /// Error getting CPUID leaf
/// ///
#[error("Failed to get CPUID entries: {0}")] #[error("Failed to get CPUID entries")]
GetCpuidVales(#[source] anyhow::Error), GetCpuidVales(#[source] anyhow::Error),
/// ///
/// Setting SEV control register error /// Setting SEV control register error
/// ///
#[cfg(feature = "sev_snp")] #[cfg(feature = "sev_snp")]
#[error("Failed to set sev control register: {0}")] #[error("Failed to set sev control register")]
SetSevControlRegister(#[source] anyhow::Error), SetSevControlRegister(#[source] anyhow::Error),
/// ///
/// Unsupported SysReg registers /// Unsupported SysReg registers
+2 -2
View File
@@ -18,11 +18,11 @@ pub enum HypervisorDeviceError {
/// ///
/// Set device attribute error /// Set device attribute error
/// ///
#[error("Failed to set device attribute: {0}")] #[error("Failed to set device attribute")]
SetDeviceAttribute(#[source] anyhow::Error), SetDeviceAttribute(#[source] anyhow::Error),
/// ///
/// Get device attribute error /// Get device attribute error
/// ///
#[error("Failed to get device attribute: {0}")] #[error("Failed to get device attribute")]
GetDeviceAttribute(#[source] anyhow::Error), GetDeviceAttribute(#[source] anyhow::Error),
} }
+11 -11
View File
@@ -27,37 +27,37 @@ pub enum HypervisorError {
/// ///
/// Hypervisor availability check error /// Hypervisor availability check error
/// ///
#[error("Failed to check availability of the hypervisor: {0}")] #[error("Failed to check availability of the hypervisor")]
HypervisorAvailableCheck(#[source] anyhow::Error), HypervisorAvailableCheck(#[source] anyhow::Error),
/// ///
/// hypervisor creation error /// hypervisor creation error
/// ///
#[error("Failed to create the hypervisor: {0}")] #[error("Failed to create the hypervisor")]
HypervisorCreate(#[source] anyhow::Error), HypervisorCreate(#[source] anyhow::Error),
/// ///
/// Vm creation failure /// Vm creation failure
/// ///
#[error("Failed to create Vm: {0}")] #[error("Failed to create Vm")]
VmCreate(#[source] anyhow::Error), VmCreate(#[source] anyhow::Error),
/// ///
/// Vm setup failure /// Vm setup failure
/// ///
#[error("Failed to setup Vm: {0}")] #[error("Failed to setup Vm")]
VmSetup(#[source] anyhow::Error), VmSetup(#[source] anyhow::Error),
/// ///
/// API version error /// API version error
/// ///
#[error("Failed to get API Version: {0}")] #[error("Failed to get API Version")]
GetApiVersion(#[source] anyhow::Error), GetApiVersion(#[source] anyhow::Error),
/// ///
/// CpuId error /// CpuId error
/// ///
#[error("Failed to get cpuid: {0}")] #[error("Failed to get cpuid")]
GetCpuId(#[source] anyhow::Error), GetCpuId(#[source] anyhow::Error),
/// ///
/// Failed to retrieve list of MSRs. /// Failed to retrieve list of MSRs.
/// ///
#[error("Failed to get the list of supported MSRs: {0}")] #[error("Failed to get the list of supported MSRs")]
GetMsrList(#[source] anyhow::Error), GetMsrList(#[source] anyhow::Error),
/// ///
/// API version is not compatible /// API version is not compatible
@@ -67,22 +67,22 @@ pub enum HypervisorError {
/// ///
/// Checking extensions failed /// Checking extensions failed
/// ///
#[error("Checking extensions: {0}")] #[error("Checking extensions")]
CheckExtensions(#[source] anyhow::Error), CheckExtensions(#[source] anyhow::Error),
/// ///
/// Failed to retrieve TDX capabilities /// Failed to retrieve TDX capabilities
/// ///
#[error("Failed to retrieve TDX capabilities: {0}")] #[error("Failed to retrieve TDX capabilities")]
TdxCapabilities(#[source] anyhow::Error), TdxCapabilities(#[source] anyhow::Error),
/// ///
/// Failed to set partition property /// Failed to set partition property
/// ///
#[error("Failed to set partition property: {0}")] #[error("Failed to set partition property")]
SetPartitionProperty(#[source] anyhow::Error), SetPartitionProperty(#[source] anyhow::Error),
/// ///
/// Running on an unsupported CPU /// Running on an unsupported CPU
/// ///
#[error("Unsupported CPU: {0}")] #[error("Unsupported CPU")]
UnsupportedCpu(#[source] anyhow::Error), UnsupportedCpu(#[source] anyhow::Error),
/// ///
/// Launching a VM with unsupported VM Type /// Launching a VM with unsupported VM Type
+39 -39
View File
@@ -58,196 +58,196 @@ pub enum HypervisorVmError {
/// ///
/// Create Vcpu error /// Create Vcpu error
/// ///
#[error("Failed to create Vcpu: {0}")] #[error("Failed to create Vcpu")]
CreateVcpu(#[source] anyhow::Error), CreateVcpu(#[source] anyhow::Error),
/// ///
/// Identity map address error /// Identity map address error
/// ///
#[error("Failed to set identity map address: {0}")] #[error("Failed to set identity map address")]
SetIdentityMapAddress(#[source] anyhow::Error), SetIdentityMapAddress(#[source] anyhow::Error),
/// ///
/// TSS address error /// TSS address error
/// ///
#[error("Failed to set TSS address: {0}")] #[error("Failed to set TSS address")]
SetTssAddress(#[source] anyhow::Error), SetTssAddress(#[source] anyhow::Error),
/// ///
/// Create interrupt controller error /// Create interrupt controller error
/// ///
#[error("Failed to create interrupt controller: {0}")] #[error("Failed to create interrupt controller")]
CreateIrq(#[source] anyhow::Error), CreateIrq(#[source] anyhow::Error),
/// ///
/// Register interrupt event error /// Register interrupt event error
/// ///
#[error("Failed to register interrupt event: {0}")] #[error("Failed to register interrupt event")]
RegisterIrqFd(#[source] anyhow::Error), RegisterIrqFd(#[source] anyhow::Error),
/// ///
/// Un register interrupt event error /// Un register interrupt event error
/// ///
#[error("Failed to unregister interrupt event: {0}")] #[error("Failed to unregister interrupt event")]
UnregisterIrqFd(#[source] anyhow::Error), UnregisterIrqFd(#[source] anyhow::Error),
/// ///
/// Register IO event error /// Register IO event error
/// ///
#[error("Failed to register IO event: {0}")] #[error("Failed to register IO event")]
RegisterIoEvent(#[source] anyhow::Error), RegisterIoEvent(#[source] anyhow::Error),
/// ///
/// Unregister IO event error /// Unregister IO event error
/// ///
#[error("Failed to unregister IO event: {0}")] #[error("Failed to unregister IO event")]
UnregisterIoEvent(#[source] anyhow::Error), UnregisterIoEvent(#[source] anyhow::Error),
/// ///
/// Set GSI routing error /// Set GSI routing error
/// ///
#[error("Failed to set GSI routing: {0}")] #[error("Failed to set GSI routing")]
SetGsiRouting(#[source] anyhow::Error), SetGsiRouting(#[source] anyhow::Error),
/// ///
/// Create user memory error /// Create user memory error
/// ///
#[error("Failed to create user memory: {0}")] #[error("Failed to create user memory")]
CreateUserMemory(#[source] anyhow::Error), CreateUserMemory(#[source] anyhow::Error),
/// ///
/// Remove user memory region error /// Remove user memory region error
/// ///
#[error("Failed to remove user memory: {0}")] #[error("Failed to remove user memory")]
RemoveUserMemory(#[source] anyhow::Error), RemoveUserMemory(#[source] anyhow::Error),
/// ///
/// Create device error /// Create device error
/// ///
#[error("Failed to set GSI routing: {0}")] #[error("Failed to set GSI routing")]
CreateDevice(#[source] anyhow::Error), CreateDevice(#[source] anyhow::Error),
/// ///
/// Get preferred target error /// Get preferred target error
/// ///
#[error("Failed to get preferred target: {0}")] #[error("Failed to get preferred target")]
GetPreferredTarget(#[source] anyhow::Error), GetPreferredTarget(#[source] anyhow::Error),
/// ///
/// Enable split Irq error /// Enable split Irq error
/// ///
#[error("Failed to enable split Irq: {0}")] #[error("Failed to enable split Irq")]
EnableSplitIrq(#[source] anyhow::Error), EnableSplitIrq(#[source] anyhow::Error),
/// ///
/// Enable SGX attribute error /// Enable SGX attribute error
/// ///
#[error("Failed to enable SGX attribute: {0}")] #[error("Failed to enable SGX attribute")]
EnableSgxAttribute(#[source] anyhow::Error), EnableSgxAttribute(#[source] anyhow::Error),
/// ///
/// Get clock error /// Get clock error
/// ///
#[error("Failed to get clock: {0}")] #[error("Failed to get clock")]
GetClock(#[source] anyhow::Error), GetClock(#[source] anyhow::Error),
/// ///
/// Set clock error /// Set clock error
/// ///
#[error("Failed to set clock: {0}")] #[error("Failed to set clock")]
SetClock(#[source] anyhow::Error), SetClock(#[source] anyhow::Error),
/// ///
/// Create passthrough device /// Create passthrough device
/// ///
#[error("Failed to create passthrough device: {0}")] #[error("Failed to create passthrough device")]
CreatePassthroughDevice(#[source] anyhow::Error), CreatePassthroughDevice(#[source] anyhow::Error),
/// Write to Guest memory /// Write to Guest memory
/// ///
#[error("Failed to write to guest memory: {0}")] #[error("Failed to write to guest memory")]
GuestMemWrite(#[source] anyhow::Error), GuestMemWrite(#[source] anyhow::Error),
/// ///
/// Read Guest memory /// Read Guest memory
/// ///
#[error("Failed to read guest memory: {0}")] #[error("Failed to read guest memory")]
GuestMemRead(#[source] anyhow::Error), GuestMemRead(#[source] anyhow::Error),
/// ///
/// Read from MMIO Bus /// Read from MMIO Bus
/// ///
#[error("Failed to read from MMIO Bus: {0}")] #[error("Failed to read from MMIO Bus")]
MmioBusRead(#[source] anyhow::Error), MmioBusRead(#[source] anyhow::Error),
/// ///
/// Write to MMIO Bus /// Write to MMIO Bus
/// ///
#[error("Failed to write to MMIO Bus: {0}")] #[error("Failed to write to MMIO Bus")]
MmioBusWrite(#[source] anyhow::Error), MmioBusWrite(#[source] anyhow::Error),
/// ///
/// Read from IO Bus /// Read from IO Bus
/// ///
#[error("Failed to read from IO Bus: {0}")] #[error("Failed to read from IO Bus")]
IoBusRead(#[source] anyhow::Error), IoBusRead(#[source] anyhow::Error),
/// ///
/// Write to IO Bus /// Write to IO Bus
/// ///
#[error("Failed to write to IO Bus: {0}")] #[error("Failed to write to IO Bus")]
IoBusWrite(#[source] anyhow::Error), IoBusWrite(#[source] anyhow::Error),
/// ///
/// Start dirty log error /// Start dirty log error
/// ///
#[error("Failed to get dirty log: {0}")] #[error("Failed to get dirty log")]
StartDirtyLog(#[source] anyhow::Error), StartDirtyLog(#[source] anyhow::Error),
/// ///
/// Stop dirty log error /// Stop dirty log error
/// ///
#[error("Failed to get dirty log: {0}")] #[error("Failed to get dirty log")]
StopDirtyLog(#[source] anyhow::Error), StopDirtyLog(#[source] anyhow::Error),
/// ///
/// Get dirty log error /// Get dirty log error
/// ///
#[error("Failed to get dirty log: {0}")] #[error("Failed to get dirty log")]
GetDirtyLog(#[source] anyhow::Error), GetDirtyLog(#[source] anyhow::Error),
/// ///
/// Assert virtual interrupt error /// Assert virtual interrupt error
/// ///
#[error("Failed to assert virtual Interrupt: {0}")] #[error("Failed to assert virtual Interrupt")]
AssertVirtualInterrupt(#[source] anyhow::Error), AssertVirtualInterrupt(#[source] anyhow::Error),
#[cfg(feature = "sev_snp")] #[cfg(feature = "sev_snp")]
/// ///
/// Error initializing SEV-SNP on the VM /// Error initializing SEV-SNP on the VM
/// ///
#[error("Failed to initialize SEV-SNP: {0}")] #[error("Failed to initialize SEV-SNP")]
InitializeSevSnp(#[source] std::io::Error), InitializeSevSnp(#[source] std::io::Error),
#[cfg(feature = "tdx")] #[cfg(feature = "tdx")]
/// ///
/// Error initializing TDX on the VM /// Error initializing TDX on the VM
/// ///
#[error("Failed to initialize TDX: {0}")] #[error("Failed to initialize TDX")]
InitializeTdx(#[source] std::io::Error), InitializeTdx(#[source] std::io::Error),
#[cfg(feature = "tdx")] #[cfg(feature = "tdx")]
/// ///
/// Error finalizing the TDX configuration on the VM /// Error finalizing the TDX configuration on the VM
/// ///
#[error("Failed to finalize TDX: {0}")] #[error("Failed to finalize TDX")]
FinalizeTdx(#[source] std::io::Error), FinalizeTdx(#[source] std::io::Error),
#[cfg(feature = "tdx")] #[cfg(feature = "tdx")]
/// ///
/// Error initializing the TDX memory region /// Error initializing the TDX memory region
/// ///
#[error("Failed to initialize memory region TDX: {0}")] #[error("Failed to initialize memory region TDX")]
InitMemRegionTdx(#[source] std::io::Error), InitMemRegionTdx(#[source] std::io::Error),
/// ///
/// Create Vgic error /// Create Vgic error
/// ///
#[error("Failed to create Vgic: {0}")] #[error("Failed to create Vgic")]
CreateVgic(#[source] anyhow::Error), CreateVgic(#[source] anyhow::Error),
/// ///
/// Create Vaia error /// Create Vaia error
/// ///
#[error("Failed to create Vaia: {0}")] #[error("Failed to create Vaia")]
CreateVaia(#[source] anyhow::Error), CreateVaia(#[source] anyhow::Error),
/// ///
/// Import isolated pages error /// Import isolated pages error
/// ///
#[error("Failed to import isolated pages: {0}")] #[error("Failed to import isolated pages")]
ImportIsolatedPages(#[source] anyhow::Error), ImportIsolatedPages(#[source] anyhow::Error),
/// Failed to complete isolated import /// Failed to complete isolated import
/// ///
#[error("Failed to complete isolated import: {0}")] #[error("Failed to complete isolated import")]
CompleteIsolatedImport(#[source] anyhow::Error), CompleteIsolatedImport(#[source] anyhow::Error),
/// Failed to set VM property /// Failed to set VM property
/// ///
#[error("Failed to set VM property: {0}")] #[error("Failed to set VM property")]
SetVmProperty(#[source] anyhow::Error), SetVmProperty(#[source] anyhow::Error),
/// ///
/// Modify GPA host access error /// Modify GPA host access error
/// ///
#[cfg(feature = "sev_snp")] #[cfg(feature = "sev_snp")]
#[error("Failed to modify GPA host access: {0}")] #[error("Failed to modify GPA host access")]
ModifyGpaHostAccess(#[source] anyhow::Error), ModifyGpaHostAccess(#[source] anyhow::Error),
/// ///
/// Failed to mmap /// Failed to mmap
@@ -258,7 +258,7 @@ pub enum HypervisorVmError {
/// ///
/// Failed to initialize VM /// Failed to initialize VM
/// ///
#[error("Failed to initialize VM: {0}")] #[error("Failed to initialize VM")]
InitializeVm(#[source] anyhow::Error), InitializeVm(#[source] anyhow::Error),
} }
/// ///