misc: arch: 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:
parent
3f3489e38e
commit
06a868cb85
11 changed files with 68 additions and 61 deletions
|
|
@ -81,7 +81,7 @@ pub trait DeviceInfoForFdt {
|
|||
#[derive(Debug, Error)]
|
||||
pub enum Error {
|
||||
/// Failure in writing FDT in memory.
|
||||
#[error("Failure in writing FDT in memory: {0}")]
|
||||
#[error("Failure in writing FDT in memory")]
|
||||
WriteFdtToMemory(#[source] GuestMemoryError),
|
||||
}
|
||||
type Result<T> = result::Result<T, Error>;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ pub enum Error {
|
|||
SetupFdt,
|
||||
|
||||
/// Failed to write FDT to memory.
|
||||
#[error("Failed to write FDT to memory: {0}")]
|
||||
#[error("Failed to write FDT to memory")]
|
||||
WriteFdtToMemory(#[source] fdt::Error),
|
||||
|
||||
/// Failed to create a GIC.
|
||||
|
|
@ -44,11 +44,11 @@ pub enum Error {
|
|||
InitramfsAddress,
|
||||
|
||||
/// Error configuring the general purpose registers
|
||||
#[error("Error configuring the general purpose registers: {0}")]
|
||||
#[error("Error configuring the general purpose registers")]
|
||||
RegsConfiguration(#[source] hypervisor::HypervisorCpuError),
|
||||
|
||||
/// Error configuring the MPIDR register
|
||||
#[error("Error configuring the MPIDR register: {0}")]
|
||||
#[error("Error configuring the MPIDR register")]
|
||||
VcpuRegMpidr(#[source] hypervisor::HypervisorCpuError),
|
||||
|
||||
/// Error initializing PMU for vcpu
|
||||
|
|
|
|||
|
|
@ -28,13 +28,13 @@ type GuestRegionMmap = vm_memory::GuestRegionMmap<vm_memory::bitmap::AtomicBitma
|
|||
#[derive(Debug, Error)]
|
||||
pub enum Error {
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
#[error("Platform specific error (x86_64): {0}")]
|
||||
#[error("Platform specific error (x86_64)")]
|
||||
PlatformSpecific(#[from] x86_64::Error),
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
#[error("Platform specific error (aarch64): {0:?}")]
|
||||
#[error("Platform specific error (aarch64)")]
|
||||
PlatformSpecific(#[from] aarch64::Error),
|
||||
#[cfg(target_arch = "riscv64")]
|
||||
#[error("Platform specific error (riscv64): {0:?}")]
|
||||
#[error("Platform specific error (riscv64)")]
|
||||
PlatformSpecific(#[from] riscv64::Error),
|
||||
#[error("The memory map table extends past the end of guest memory")]
|
||||
MemmapTablePastRamEnd,
|
||||
|
|
@ -46,7 +46,7 @@ pub enum Error {
|
|||
StartInfoSetup,
|
||||
#[error("Failed to compute initramfs address")]
|
||||
InitramfsAddress,
|
||||
#[error("Error writing module entry to guest memory: {0}")]
|
||||
#[error("Error writing module entry to guest memory")]
|
||||
ModlistSetup(#[source] vm_memory::GuestMemoryError),
|
||||
#[error("RSDP extends past the end of guest memory")]
|
||||
RsdpPastRamEnd,
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ pub trait DeviceInfoForFdt {
|
|||
#[derive(Debug, Error)]
|
||||
pub enum Error {
|
||||
/// Failure in writing FDT in memory.
|
||||
#[error("Failure in writing FDT in memory: {0}")]
|
||||
#[error("Failure in writing FDT in memory")]
|
||||
WriteFdtToMemory(#[source] GuestMemoryError),
|
||||
}
|
||||
type Result<T> = result::Result<T, Error>;
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ pub enum Error {
|
|||
SetupFdt,
|
||||
|
||||
/// Failed to write FDT to memory.
|
||||
#[error("Failed to write FDT to memory: {0}")]
|
||||
#[error("Failed to write FDT to memory")]
|
||||
WriteFdtToMemory(#[source] fdt::Error),
|
||||
|
||||
/// Failed to create a AIA.
|
||||
|
|
@ -42,7 +42,7 @@ pub enum Error {
|
|||
InitramfsAddress,
|
||||
|
||||
/// Error configuring the general purpose registers
|
||||
#[error("Error configuring the general purpose registers: {0}")]
|
||||
#[error("Error configuring the general purpose registers")]
|
||||
RegsConfiguration(#[source] hypervisor::HypervisorCpuError),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -132,35 +132,35 @@ pub struct CpuidConfig {
|
|||
#[derive(Debug, Error)]
|
||||
pub enum Error {
|
||||
/// Error writing MP table to memory.
|
||||
#[error("Error writing MP table to memory: {0}")]
|
||||
#[error("Error writing MP table to memory")]
|
||||
MpTableSetup(#[source] mptable::Error),
|
||||
|
||||
/// Error configuring the general purpose registers
|
||||
#[error("Error configuring the general purpose registers: {0}")]
|
||||
#[error("Error configuring the general purpose registers")]
|
||||
RegsConfiguration(#[source] regs::Error),
|
||||
|
||||
/// Error configuring the special registers
|
||||
#[error("Error configuring the special registers: {0}")]
|
||||
#[error("Error configuring the special registers")]
|
||||
SregsConfiguration(#[source] regs::Error),
|
||||
|
||||
/// Error configuring the floating point related registers
|
||||
#[error("Error configuring the floating point related registers: {0}")]
|
||||
#[error("Error configuring the floating point related registers")]
|
||||
FpuConfiguration(#[source] regs::Error),
|
||||
|
||||
/// Error configuring the MSR registers
|
||||
#[error("Error configuring the MSR registers: {0}")]
|
||||
#[error("Error configuring the MSR registers")]
|
||||
MsrsConfiguration(#[source] regs::Error),
|
||||
|
||||
/// Failed to set supported CPUs.
|
||||
#[error("Failed to set supported CPUs: {0}")]
|
||||
#[error("Failed to set supported CPUs")]
|
||||
SetSupportedCpusFailed(#[source] anyhow::Error),
|
||||
|
||||
/// Cannot set the local interruption due to bad configuration.
|
||||
#[error("Cannot set the local interruption due to bad configuration: {0}")]
|
||||
#[error("Cannot set the local interruption due to bad configuration")]
|
||||
LocalIntConfiguration(#[source] anyhow::Error),
|
||||
|
||||
/// Error setting up SMBIOS table
|
||||
#[error("Error setting up SMBIOS table: {0}")]
|
||||
#[error("Error setting up SMBIOS table")]
|
||||
SmbiosSetup(#[source] smbios::Error),
|
||||
|
||||
/// Could not find any SGX EPC section
|
||||
|
|
@ -176,15 +176,15 @@ pub enum Error {
|
|||
MissingSgxLaunchControlFeature,
|
||||
|
||||
/// Error getting supported CPUID through the hypervisor (kvm/mshv) API
|
||||
#[error("Error getting supported CPUID through the hypervisor API: {0}")]
|
||||
#[error("Error getting supported CPUID through the hypervisor API")]
|
||||
CpuidGetSupported(#[source] HypervisorError),
|
||||
|
||||
/// Error populating CPUID with KVM HyperV emulation details
|
||||
#[error("Error populating CPUID with KVM HyperV emulation details: {0}")]
|
||||
#[error("Error populating CPUID with KVM HyperV emulation details")]
|
||||
CpuidKvmHyperV(#[source] vmm_sys_util::fam::Error),
|
||||
|
||||
/// Error populating CPUID with CPU identification
|
||||
#[error("Error populating CPUID with CPU identification: {0}")]
|
||||
#[error("Error populating CPUID with CPU identification")]
|
||||
CpuidIdentification(#[source] vmm_sys_util::fam::Error),
|
||||
|
||||
/// Error checking CPUID compatibility
|
||||
|
|
@ -192,16 +192,16 @@ pub enum Error {
|
|||
CpuidCheckCompatibility,
|
||||
|
||||
// Error writing EBDA address
|
||||
#[error("Error writing EBDA address: {0}")]
|
||||
#[error("Error writing EBDA address")]
|
||||
EbdaSetup(#[source] vm_memory::GuestMemoryError),
|
||||
|
||||
// Error getting CPU TSC frequency
|
||||
#[error("Error getting CPU TSC frequency: {0}")]
|
||||
#[error("Error getting CPU TSC frequency")]
|
||||
GetTscFrequency(#[source] HypervisorCpuError),
|
||||
|
||||
/// Error retrieving TDX capabilities through the hypervisor (kvm/mshv) API
|
||||
#[cfg(feature = "tdx")]
|
||||
#[error("Error retrieving TDX capabilities through the hypervisor API: {0}")]
|
||||
#[error("Error retrieving TDX capabilities through the hypervisor API")]
|
||||
TdxCapabilities(#[source] HypervisorError),
|
||||
|
||||
/// Failed to configure E820 map for bzImage
|
||||
|
|
|
|||
|
|
@ -59,31 +59,31 @@ pub enum Error {
|
|||
#[error("The MP table has too little address space to be stored")]
|
||||
AddressOverflow,
|
||||
/// Failure while zeroing out the memory for the MP table.
|
||||
#[error("Failure while zeroing out the memory for the MP table: {0}")]
|
||||
#[error("Failure while zeroing out the memory for the MP table")]
|
||||
Clear(#[source] GuestMemoryError),
|
||||
/// Number of CPUs exceeds the maximum supported CPUs
|
||||
#[error("Number of CPUs exceeds the maximum supported CPUs")]
|
||||
TooManyCpus,
|
||||
/// Failure to write the MP floating pointer.
|
||||
#[error("Failure to write the MP floating pointer: {0}")]
|
||||
#[error("Failure to write the MP floating pointer")]
|
||||
WriteMpfIntel(#[source] GuestMemoryError),
|
||||
/// Failure to write MP CPU entry.
|
||||
#[error("Failure to write MP CPU entry: {0}")]
|
||||
#[error("Failure to write MP CPU entry")]
|
||||
WriteMpcCpu(#[source] GuestMemoryError),
|
||||
/// Failure to write MP ioapic entry.
|
||||
#[error("Failure to write MP ioapic entry: {0}")]
|
||||
#[error("Failure to write MP ioapic entry")]
|
||||
WriteMpcIoapic(#[source] GuestMemoryError),
|
||||
/// Failure to write MP bus entry.
|
||||
#[error("Failure to write MP bus entry: {0}")]
|
||||
#[error("Failure to write MP bus entry")]
|
||||
WriteMpcBus(#[source] GuestMemoryError),
|
||||
/// Failure to write MP interrupt source entry.
|
||||
#[error("Failure to write MP interrupt source entry: {0}")]
|
||||
#[error("Failure to write MP interrupt source entry")]
|
||||
WriteMpcIntsrc(#[source] GuestMemoryError),
|
||||
/// Failure to write MP local interrupt source entry.
|
||||
#[error("Failure to write MP local interrupt source entry: {0}")]
|
||||
#[error("Failure to write MP local interrupt source entry")]
|
||||
WriteMpcLintsrc(#[source] GuestMemoryError),
|
||||
/// Failure to write MP table header.
|
||||
#[error("Failure to write MP table header: {0}")]
|
||||
#[error("Failure to write MP table header")]
|
||||
WriteMpcTable(#[source] GuestMemoryError),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,40 +23,40 @@ use crate::{EntryPoint, GuestMemoryMmap};
|
|||
#[derive(Debug, Error)]
|
||||
pub enum Error {
|
||||
/// Failed to get SREGs for this CPU.
|
||||
#[error("Failed to get SREGs for this CPU: {0}")]
|
||||
#[error("Failed to get SREGs for this CPU")]
|
||||
GetStatusRegisters(#[source] hypervisor::HypervisorCpuError),
|
||||
/// Failed to set base registers for this CPU.
|
||||
#[error("Failed to set base registers for this CPU: {0}")]
|
||||
#[error("Failed to set base registers for this CPU")]
|
||||
SetBaseRegisters(#[source] hypervisor::HypervisorCpuError),
|
||||
/// Failed to configure the FPU.
|
||||
#[error("Failed to configure the FPU: {0}")]
|
||||
#[error("Failed to configure the FPU")]
|
||||
SetFpuRegisters(#[source] hypervisor::HypervisorCpuError),
|
||||
/// Setting up MSRs failed.
|
||||
#[error("Setting up MSRs failed: {0}")]
|
||||
#[error("Setting up MSRs failed")]
|
||||
SetModelSpecificRegisters(#[source] hypervisor::HypervisorCpuError),
|
||||
/// Failed to set SREGs for this CPU.
|
||||
#[error("Failed to set SREGs for this CPU: {0}")]
|
||||
#[error("Failed to set SREGs for this CPU")]
|
||||
SetStatusRegisters(#[source] hypervisor::HypervisorCpuError),
|
||||
/// Checking the GDT address failed.
|
||||
#[error("Checking the GDT address failed")]
|
||||
CheckGdtAddr,
|
||||
/// Writing the GDT to RAM failed.
|
||||
#[error("Writing the GDT to RAM failed: {0}")]
|
||||
#[error("Writing the GDT to RAM failed")]
|
||||
WriteGdt(#[source] GuestMemoryError),
|
||||
/// Writing the IDT to RAM failed.
|
||||
#[error("Writing the IDT to RAM failed: {0}")]
|
||||
#[error("Writing the IDT to RAM failed")]
|
||||
WriteIdt(#[source] GuestMemoryError),
|
||||
/// Writing PDPTE to RAM failed.
|
||||
#[error("Writing PDPTE to RAM failed: {0}")]
|
||||
#[error("Writing PDPTE to RAM failed")]
|
||||
WritePdpteAddress(#[source] GuestMemoryError),
|
||||
/// Writing PDE to RAM failed.
|
||||
#[error("Writing PDE to RAM failed: {0}")]
|
||||
#[error("Writing PDE to RAM failed")]
|
||||
WritePdeAddress(#[source] GuestMemoryError),
|
||||
/// Writing PML4 to RAM failed.
|
||||
#[error("Writing PML4 to RAM failed: {0}")]
|
||||
#[error("Writing PML4 to RAM failed")]
|
||||
WritePml4Address(#[source] GuestMemoryError),
|
||||
/// Writing PML5 to RAM failed.
|
||||
#[error("Writing PML5 to RAM failed: {0}")]
|
||||
#[error("Writing PML5 to RAM failed")]
|
||||
WritePml5Address(#[source] GuestMemoryError),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ pub enum Error {
|
|||
#[error("Failure to write additional data to memory")]
|
||||
WriteData,
|
||||
/// Failure to parse uuid, uuid format may be error
|
||||
#[error("Failure to parse uuid: {0}")]
|
||||
#[error("Failure to parse uuid")]
|
||||
ParseUuid(#[source] uuid::Error),
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ use crate::GuestMemoryMmap;
|
|||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum TdvfError {
|
||||
#[error("Failed read TDVF descriptor: {0}")]
|
||||
#[error("Failed read TDVF descriptor")]
|
||||
ReadDescriptor(#[source] std::io::Error),
|
||||
#[error("Failed read TDVF descriptor offset: {0}")]
|
||||
#[error("Failed read TDVF descriptor offset")]
|
||||
ReadDescriptorOffset(#[source] std::io::Error),
|
||||
#[error("Failed read GUID table: {0}")]
|
||||
#[error("Failed read GUID table")]
|
||||
ReadGuidTable(#[source] std::io::Error),
|
||||
#[error("Invalid descriptor signature")]
|
||||
InvalidDescriptorSignature,
|
||||
|
|
@ -25,9 +25,9 @@ pub enum TdvfError {
|
|||
InvalidDescriptorSize,
|
||||
#[error("Invalid descriptor version")]
|
||||
InvalidDescriptorVersion,
|
||||
#[error("Failed to write HOB details to guest memory: {0}")]
|
||||
#[error("Failed to write HOB details to guest memory")]
|
||||
GuestMemoryWriteHob(#[source] GuestMemoryError),
|
||||
#[error("Failed to create Uuid: {0}")]
|
||||
#[error("Failed to create Uuid")]
|
||||
UuidCreation(#[source] uuid::Error),
|
||||
}
|
||||
|
||||
|
|
|
|||
29
fuzz/Cargo.lock
generated
29
fuzz/Cargo.lock
generated
|
|
@ -442,14 +442,14 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "getrandom"
|
||||
version = "0.3.1"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8"
|
||||
checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"wasi 0.13.3+wasi-0.2.2",
|
||||
"windows-targets",
|
||||
"r-efi",
|
||||
"wasi 0.14.2+wasi-0.2.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -678,7 +678,7 @@ name = "net_util"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"epoll",
|
||||
"getrandom 0.3.1",
|
||||
"getrandom 0.3.3",
|
||||
"libc",
|
||||
"log",
|
||||
"net_gen",
|
||||
|
|
@ -818,6 +818,12 @@ dependencies = [
|
|||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "r-efi"
|
||||
version = "5.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5"
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.9.0"
|
||||
|
|
@ -845,7 +851,7 @@ version = "0.9.3"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38"
|
||||
dependencies = [
|
||||
"getrandom 0.3.1",
|
||||
"getrandom 0.3.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1106,7 +1112,7 @@ version = "1.15.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0f540e3240398cce6128b64ba83fdbdd86129c16a3aa1a3a252efd66eb3d587"
|
||||
dependencies = [
|
||||
"getrandom 0.3.1",
|
||||
"getrandom 0.3.3",
|
||||
"rand",
|
||||
"uuid-macro-internal",
|
||||
]
|
||||
|
|
@ -1324,6 +1330,7 @@ dependencies = [
|
|||
"uuid",
|
||||
"vfio-ioctls",
|
||||
"vfio_user",
|
||||
"virtio-bindings",
|
||||
"virtio-devices",
|
||||
"virtio-queue",
|
||||
"vm-allocator",
|
||||
|
|
@ -1355,9 +1362,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
|||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.13.3+wasi-0.2.2"
|
||||
version = "0.14.2+wasi-0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2"
|
||||
checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
|
||||
dependencies = [
|
||||
"wit-bindgen-rt",
|
||||
]
|
||||
|
|
@ -1523,9 +1530,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "wit-bindgen-rt"
|
||||
version = "0.33.0"
|
||||
version = "0.39.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
|
||||
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
|
||||
dependencies = [
|
||||
"bitflags 2.9.0",
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue