diff --git a/devices/src/acpi.rs b/devices/src/acpi.rs index 9e6790d85..69bcb80d7 100644 --- a/devices/src/acpi.rs +++ b/devices/src/acpi.rs @@ -9,6 +9,7 @@ use std::thread; use std::time::Instant; use acpi_tables::{Aml, AmlSink, aml}; +use log::{error, info, warn}; use vm_device::BusDevice; use vm_device::interrupt::InterruptSourceGroup; use vm_memory::GuestAddress; diff --git a/devices/src/aia.rs b/devices/src/aia.rs index f3956727a..3e17b982a 100644 --- a/devices/src/aia.rs +++ b/devices/src/aia.rs @@ -3,8 +3,6 @@ // // SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause -use super::interrupt_controller::{Error, InterruptController}; -extern crate arch; use std::result; use std::sync::{Arc, Mutex}; @@ -19,6 +17,8 @@ use vm_memory::address::Address; use vm_migration::{Migratable, Pausable, Snapshottable, Transportable}; use vmm_sys_util::eventfd::EventFd; +use super::interrupt_controller::{Error, InterruptController}; + type Result = result::Result; // Reserve 32 IRQs for legacy devices. diff --git a/devices/src/debug_console.rs b/devices/src/debug_console.rs index 8ec63573b..7945edb00 100644 --- a/devices/src/debug_console.rs +++ b/devices/src/debug_console.rs @@ -9,6 +9,7 @@ use std::io; use std::io::Write; use std::sync::{Arc, Barrier}; +use log::error; use vm_device::BusDevice; use vm_migration::{Migratable, MigratableError, Pausable, Snapshot, Snapshottable, Transportable}; diff --git a/devices/src/gic.rs b/devices/src/gic.rs index 2c6493d88..fd7199d00 100644 --- a/devices/src/gic.rs +++ b/devices/src/gic.rs @@ -2,8 +2,6 @@ // // SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause -use super::interrupt_controller::{Error, InterruptController}; -extern crate arch; use std::result; use std::sync::{Arc, Mutex}; @@ -19,6 +17,8 @@ use vm_memory::address::Address; use vm_migration::{Migratable, MigratableError, Pausable, Snapshot, Snapshottable, Transportable}; use vmm_sys_util::eventfd::EventFd; +use super::interrupt_controller::{Error, InterruptController}; + type Result = result::Result; // Reserve 32 IRQs for legacy devices. diff --git a/devices/src/ioapic.rs b/devices/src/ioapic.rs index 3ce827bd1..c43f629d8 100644 --- a/devices/src/ioapic.rs +++ b/devices/src/ioapic.rs @@ -13,6 +13,7 @@ use std::result; use std::sync::{Arc, Barrier}; use byteorder::{ByteOrder, LittleEndian}; +use log::{debug, error, trace, warn}; use serde::{Deserialize, Serialize}; use vm_device::BusDevice; use vm_device::interrupt::{ diff --git a/devices/src/ivshmem.rs b/devices/src/ivshmem.rs index d6f5b5d46..4e1a01bf3 100644 --- a/devices/src/ivshmem.rs +++ b/devices/src/ivshmem.rs @@ -11,6 +11,7 @@ use std::sync::{Arc, Barrier, Mutex}; use anyhow::anyhow; use byteorder::{ByteOrder, LittleEndian}; +use log::{debug, error, warn}; use pci::{ BarReprogrammingParams, PCI_CONFIGURATION_ID, PciBarConfiguration, PciBarPrefetchable, PciBarRegionType, PciClassCode, PciConfiguration, PciDevice, PciDeviceError, PciHeaderType, diff --git a/devices/src/legacy/cmos.rs b/devices/src/legacy/cmos.rs index 6076db7a9..7b23d616d 100644 --- a/devices/src/legacy/cmos.rs +++ b/devices/src/legacy/cmos.rs @@ -13,6 +13,7 @@ use std::{mem, thread}; #[cfg_attr(target_env = "musl", allow(deprecated))] use libc::time_t; use libc::{CLOCK_REALTIME, clock_gettime, gmtime_r, timespec, tm}; +use log::{info, warn}; use vm_device::BusDevice; use vmm_sys_util::eventfd::EventFd; diff --git a/devices/src/legacy/debug_port.rs b/devices/src/legacy/debug_port.rs index 28a58b319..bd9a31d79 100644 --- a/devices/src/legacy/debug_port.rs +++ b/devices/src/legacy/debug_port.rs @@ -6,6 +6,7 @@ use std::fmt; use std::time::Instant; +use log::{error, warn}; use vm_device::BusDevice; /// Debug I/O port, see: diff --git a/devices/src/legacy/fw_cfg.rs b/devices/src/legacy/fw_cfg.rs index df31104af..f33179d83 100644 --- a/devices/src/legacy/fw_cfg.rs +++ b/devices/src/legacy/fw_cfg.rs @@ -35,6 +35,7 @@ use bitfield_struct::bitfield; use linux_loader::bootparam::boot_params; #[cfg(target_arch = "aarch64")] use linux_loader::loader::pe::arm64_image_header as boot_params; +use log::{debug, error}; use vm_device::BusDevice; use vm_memory::bitmap::AtomicBitmap; use vm_memory::{ diff --git a/devices/src/legacy/fwdebug.rs b/devices/src/legacy/fwdebug.rs index e678f4497..1024d262f 100644 --- a/devices/src/legacy/fwdebug.rs +++ b/devices/src/legacy/fwdebug.rs @@ -9,6 +9,7 @@ use std::sync::{Arc, Barrier}; +use log::error; use vm_device::BusDevice; /// Provides firmware debug output via I/O port controls diff --git a/devices/src/legacy/gpio_pl061.rs b/devices/src/legacy/gpio_pl061.rs index 6e7b057d8..0f4ec5f90 100644 --- a/devices/src/legacy/gpio_pl061.rs +++ b/devices/src/legacy/gpio_pl061.rs @@ -10,6 +10,7 @@ use std::sync::{Arc, Barrier}; use std::{io, result}; +use log::warn; use serde::{Deserialize, Serialize}; use thiserror::Error; use vm_device::BusDevice; diff --git a/devices/src/legacy/i8042.rs b/devices/src/legacy/i8042.rs index bbfe94eeb..0e014ab8b 100644 --- a/devices/src/legacy/i8042.rs +++ b/devices/src/legacy/i8042.rs @@ -8,6 +8,7 @@ use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, Barrier}; use std::thread; +use log::{error, info}; use vm_device::BusDevice; use vmm_sys_util::eventfd::EventFd; diff --git a/devices/src/legacy/rtc_pl031.rs b/devices/src/legacy/rtc_pl031.rs index b365ebef4..ac4509113 100644 --- a/devices/src/legacy/rtc_pl031.rs +++ b/devices/src/legacy/rtc_pl031.rs @@ -15,6 +15,7 @@ use std::result; use std::sync::{Arc, Barrier}; use std::time::Instant; +use log::warn; use thiserror::Error; use vm_device::BusDevice; diff --git a/devices/src/legacy/uart_pl011.rs b/devices/src/legacy/uart_pl011.rs index c64f071e5..aac8f12ea 100644 --- a/devices/src/legacy/uart_pl011.rs +++ b/devices/src/legacy/uart_pl011.rs @@ -11,6 +11,7 @@ use std::sync::{Arc, Barrier}; use std::time::Instant; use std::{io, result}; +use log::{debug, warn}; use serde::{Deserialize, Serialize}; use thiserror::Error; use vm_device::BusDevice; diff --git a/devices/src/lib.rs b/devices/src/lib.rs index 0c4bfb8ca..cdec936e2 100644 --- a/devices/src/lib.rs +++ b/devices/src/lib.rs @@ -7,13 +7,6 @@ //! Emulates virtual and hardware devices. -#[macro_use] -extern crate bitflags; -#[macro_use] -extern crate event_monitor; -#[macro_use] -extern crate log; - pub mod acpi; #[cfg(target_arch = "riscv64")] pub mod aia; @@ -34,6 +27,8 @@ pub mod pvpanic; #[cfg(not(target_arch = "riscv64"))] pub mod tpm; +use bitflags::bitflags; + pub use self::acpi::{AcpiGedDevice, AcpiPmTimerDevice, AcpiShutdownDevice}; #[cfg(feature = "ivshmem")] pub use self::ivshmem::IvshmemDevice; diff --git a/devices/src/pvmemcontrol.rs b/devices/src/pvmemcontrol.rs index d078a1db1..d7fd7ff3b 100644 --- a/devices/src/pvmemcontrol.rs +++ b/devices/src/pvmemcontrol.rs @@ -8,6 +8,7 @@ use std::ffi::CString; use std::sync::{Arc, Barrier, Mutex, RwLock}; use std::{io, result}; +use log::{debug, warn}; use num_enum::TryFromPrimitive; use pci::{ BarReprogrammingParams, PciBarConfiguration, PciBarPrefetchable, PciBarRegionType, diff --git a/devices/src/pvpanic.rs b/devices/src/pvpanic.rs index 9150e2e98..ef42b0361 100644 --- a/devices/src/pvpanic.rs +++ b/devices/src/pvpanic.rs @@ -8,6 +8,8 @@ use std::result; use std::sync::{Arc, Barrier, Mutex}; use anyhow::anyhow; +use event_monitor::event; +use log::{debug, info}; use pci::{ BarReprogrammingParams, PCI_CONFIGURATION_ID, PciBarConfiguration, PciBarPrefetchable, PciBarRegionType, PciClassCode, PciConfiguration, PciDevice, PciDeviceError, PciHeaderType, diff --git a/devices/src/tpm.rs b/devices/src/tpm.rs index 1c6879b1a..532b2c4a9 100644 --- a/devices/src/tpm.rs +++ b/devices/src/tpm.rs @@ -11,6 +11,7 @@ use anyhow::anyhow; use arch::aarch64::layout::{TPM_SIZE, TPM_START}; #[cfg(target_arch = "x86_64")] use arch::x86_64::layout::{TPM_SIZE, TPM_START}; +use log::{debug, error, warn}; use thiserror::Error; use tpm::TPM_CRB_BUFFER_MAX; use tpm::emulator::{BackendCmd, Emulator};