mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 03:12:27 +00:00
vmm: Remove VmInfo struct
After refactoring the VmInfo struct is no longer needed. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
07bc292fa5
commit
880a57c920
@ -15,7 +15,6 @@ use crate::config::ConsoleOutputMode;
|
||||
use crate::config::VmConfig;
|
||||
use crate::interrupt::{KvmInterruptManager, KvmRoutingEntry};
|
||||
use crate::memory_manager::{Error as MemoryManagerError, MemoryManager};
|
||||
use crate::vm::VmInfo;
|
||||
#[cfg(feature = "acpi")]
|
||||
use acpi_tables::{aml, aml::Aml};
|
||||
#[cfg(feature = "acpi")]
|
||||
@ -398,7 +397,8 @@ pub struct DeviceManager {
|
||||
|
||||
impl DeviceManager {
|
||||
pub fn new(
|
||||
vm_info: &VmInfo,
|
||||
vm_fd: Arc<VmFd>,
|
||||
config: Arc<Mutex<VmConfig>>,
|
||||
allocator: Arc<Mutex<SystemAllocator>>,
|
||||
memory_manager: Arc<Mutex<MemoryManager>>,
|
||||
_exit_evt: &EventFd,
|
||||
@ -418,7 +418,7 @@ impl DeviceManager {
|
||||
allocator,
|
||||
io_bus: Arc::new(io_bus),
|
||||
mmio_bus: Arc::new(mmio_bus),
|
||||
vm_fd: vm_info.vm_fd.clone(),
|
||||
vm_fd: vm_fd.clone(),
|
||||
});
|
||||
|
||||
// Create a shared list of GSI that can be shared through all PCI
|
||||
@ -441,7 +441,7 @@ impl DeviceManager {
|
||||
let ioapic_interrupt_manager: Arc<dyn InterruptManager> =
|
||||
Arc::new(KvmInterruptManager::new(
|
||||
Arc::clone(&address_manager.allocator),
|
||||
Arc::clone(&vm_info.vm_fd),
|
||||
vm_fd.clone(),
|
||||
Arc::clone(&kvm_gsi_msi_routes),
|
||||
None,
|
||||
));
|
||||
@ -456,7 +456,7 @@ impl DeviceManager {
|
||||
// both interrupt managers are going to share the list correctly.
|
||||
let interrupt_manager: Arc<dyn InterruptManager> = Arc::new(KvmInterruptManager::new(
|
||||
Arc::clone(&address_manager.allocator),
|
||||
Arc::clone(&vm_info.vm_fd),
|
||||
vm_fd,
|
||||
Arc::clone(&kvm_gsi_msi_routes),
|
||||
Some(ioapic.clone()),
|
||||
));
|
||||
@ -483,7 +483,7 @@ impl DeviceManager {
|
||||
cmdline_additions,
|
||||
#[cfg(feature = "acpi")]
|
||||
ged_notification_device: None,
|
||||
config: vm_info.vm_cfg.clone(),
|
||||
config,
|
||||
migratable_devices,
|
||||
memory_manager,
|
||||
};
|
||||
|
@ -29,7 +29,6 @@ use crate::cpu;
|
||||
use crate::device_manager::{get_win_size, Console, DeviceManager, DeviceManagerError};
|
||||
use crate::memory_manager::{get_host_cpu_phys_bits, Error as MemoryManagerError, MemoryManager};
|
||||
use anyhow::anyhow;
|
||||
use arc_swap::ArcSwap;
|
||||
use arch::layout;
|
||||
use devices::{ioapic, HotPlugNotificationFlags};
|
||||
use kvm_bindings::{kvm_enable_cap, kvm_userspace_memory_region, KVM_CAP_SPLIT_IRQCHIP};
|
||||
@ -165,12 +164,6 @@ pub enum Error {
|
||||
}
|
||||
pub type Result<T> = result::Result<T, Error>;
|
||||
|
||||
pub struct VmInfo<'a> {
|
||||
pub memory: &'a Arc<ArcSwap<GuestMemoryMmap>>,
|
||||
pub vm_fd: &'a Arc<VmFd>,
|
||||
pub vm_cfg: Arc<Mutex<VmConfig>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq)]
|
||||
pub enum VmState {
|
||||
Created,
|
||||
@ -325,14 +318,10 @@ impl Vm {
|
||||
.map_err(Error::MemoryManager)?;
|
||||
|
||||
let guest_memory = memory_manager.lock().unwrap().guest_memory();
|
||||
let vm_info = VmInfo {
|
||||
memory: &guest_memory,
|
||||
vm_fd: &fd,
|
||||
vm_cfg: config.clone(),
|
||||
};
|
||||
|
||||
let device_manager = DeviceManager::new(
|
||||
&vm_info,
|
||||
fd.clone(),
|
||||
config.clone(),
|
||||
allocator,
|
||||
memory_manager.clone(),
|
||||
&exit_evt,
|
||||
@ -348,7 +337,7 @@ impl Vm {
|
||||
boot_vcpus,
|
||||
max_vcpus,
|
||||
&device_manager,
|
||||
guest_memory.clone(),
|
||||
guest_memory,
|
||||
fd,
|
||||
cpuid,
|
||||
reset_evt,
|
||||
|
Loading…
x
Reference in New Issue
Block a user