mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 19:32:20 +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::config::VmConfig;
|
||||||
use crate::interrupt::{KvmInterruptManager, KvmRoutingEntry};
|
use crate::interrupt::{KvmInterruptManager, KvmRoutingEntry};
|
||||||
use crate::memory_manager::{Error as MemoryManagerError, MemoryManager};
|
use crate::memory_manager::{Error as MemoryManagerError, MemoryManager};
|
||||||
use crate::vm::VmInfo;
|
|
||||||
#[cfg(feature = "acpi")]
|
#[cfg(feature = "acpi")]
|
||||||
use acpi_tables::{aml, aml::Aml};
|
use acpi_tables::{aml, aml::Aml};
|
||||||
#[cfg(feature = "acpi")]
|
#[cfg(feature = "acpi")]
|
||||||
@ -398,7 +397,8 @@ pub struct DeviceManager {
|
|||||||
|
|
||||||
impl DeviceManager {
|
impl DeviceManager {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
vm_info: &VmInfo,
|
vm_fd: Arc<VmFd>,
|
||||||
|
config: Arc<Mutex<VmConfig>>,
|
||||||
allocator: Arc<Mutex<SystemAllocator>>,
|
allocator: Arc<Mutex<SystemAllocator>>,
|
||||||
memory_manager: Arc<Mutex<MemoryManager>>,
|
memory_manager: Arc<Mutex<MemoryManager>>,
|
||||||
_exit_evt: &EventFd,
|
_exit_evt: &EventFd,
|
||||||
@ -418,7 +418,7 @@ impl DeviceManager {
|
|||||||
allocator,
|
allocator,
|
||||||
io_bus: Arc::new(io_bus),
|
io_bus: Arc::new(io_bus),
|
||||||
mmio_bus: Arc::new(mmio_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
|
// 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> =
|
let ioapic_interrupt_manager: Arc<dyn InterruptManager> =
|
||||||
Arc::new(KvmInterruptManager::new(
|
Arc::new(KvmInterruptManager::new(
|
||||||
Arc::clone(&address_manager.allocator),
|
Arc::clone(&address_manager.allocator),
|
||||||
Arc::clone(&vm_info.vm_fd),
|
vm_fd.clone(),
|
||||||
Arc::clone(&kvm_gsi_msi_routes),
|
Arc::clone(&kvm_gsi_msi_routes),
|
||||||
None,
|
None,
|
||||||
));
|
));
|
||||||
@ -456,7 +456,7 @@ impl DeviceManager {
|
|||||||
// both interrupt managers are going to share the list correctly.
|
// both interrupt managers are going to share the list correctly.
|
||||||
let interrupt_manager: Arc<dyn InterruptManager> = Arc::new(KvmInterruptManager::new(
|
let interrupt_manager: Arc<dyn InterruptManager> = Arc::new(KvmInterruptManager::new(
|
||||||
Arc::clone(&address_manager.allocator),
|
Arc::clone(&address_manager.allocator),
|
||||||
Arc::clone(&vm_info.vm_fd),
|
vm_fd,
|
||||||
Arc::clone(&kvm_gsi_msi_routes),
|
Arc::clone(&kvm_gsi_msi_routes),
|
||||||
Some(ioapic.clone()),
|
Some(ioapic.clone()),
|
||||||
));
|
));
|
||||||
@ -483,7 +483,7 @@ impl DeviceManager {
|
|||||||
cmdline_additions,
|
cmdline_additions,
|
||||||
#[cfg(feature = "acpi")]
|
#[cfg(feature = "acpi")]
|
||||||
ged_notification_device: None,
|
ged_notification_device: None,
|
||||||
config: vm_info.vm_cfg.clone(),
|
config,
|
||||||
migratable_devices,
|
migratable_devices,
|
||||||
memory_manager,
|
memory_manager,
|
||||||
};
|
};
|
||||||
|
@ -29,7 +29,6 @@ use crate::cpu;
|
|||||||
use crate::device_manager::{get_win_size, Console, DeviceManager, DeviceManagerError};
|
use crate::device_manager::{get_win_size, Console, DeviceManager, DeviceManagerError};
|
||||||
use crate::memory_manager::{get_host_cpu_phys_bits, Error as MemoryManagerError, MemoryManager};
|
use crate::memory_manager::{get_host_cpu_phys_bits, Error as MemoryManagerError, MemoryManager};
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use arc_swap::ArcSwap;
|
|
||||||
use arch::layout;
|
use arch::layout;
|
||||||
use devices::{ioapic, HotPlugNotificationFlags};
|
use devices::{ioapic, HotPlugNotificationFlags};
|
||||||
use kvm_bindings::{kvm_enable_cap, kvm_userspace_memory_region, KVM_CAP_SPLIT_IRQCHIP};
|
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 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)]
|
#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq)]
|
||||||
pub enum VmState {
|
pub enum VmState {
|
||||||
Created,
|
Created,
|
||||||
@ -325,14 +318,10 @@ impl Vm {
|
|||||||
.map_err(Error::MemoryManager)?;
|
.map_err(Error::MemoryManager)?;
|
||||||
|
|
||||||
let guest_memory = memory_manager.lock().unwrap().guest_memory();
|
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(
|
let device_manager = DeviceManager::new(
|
||||||
&vm_info,
|
fd.clone(),
|
||||||
|
config.clone(),
|
||||||
allocator,
|
allocator,
|
||||||
memory_manager.clone(),
|
memory_manager.clone(),
|
||||||
&exit_evt,
|
&exit_evt,
|
||||||
@ -348,7 +337,7 @@ impl Vm {
|
|||||||
boot_vcpus,
|
boot_vcpus,
|
||||||
max_vcpus,
|
max_vcpus,
|
||||||
&device_manager,
|
&device_manager,
|
||||||
guest_memory.clone(),
|
guest_memory,
|
||||||
fd,
|
fd,
|
||||||
cpuid,
|
cpuid,
|
||||||
reset_evt,
|
reset_evt,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user