mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 11:22:26 +00:00
vmm: Pass MemoryManager through CpuManager creation
Instead of passing the GuestMemoryMmap directly to the CpuManager upon its creation, it's better to pass a reference to the MemoryManager. This way we will be able to know if SGX EPC region along with one or multiple sections are present. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
2b06ce0ed4
commit
1603786374
@ -15,6 +15,7 @@
|
|||||||
use crate::config::CpuTopology;
|
use crate::config::CpuTopology;
|
||||||
use crate::config::CpusConfig;
|
use crate::config::CpusConfig;
|
||||||
use crate::device_manager::DeviceManager;
|
use crate::device_manager::DeviceManager;
|
||||||
|
use crate::memory_manager::MemoryManager;
|
||||||
use crate::CPU_MANAGER_SNAPSHOT_ID;
|
use crate::CPU_MANAGER_SNAPSHOT_ID;
|
||||||
#[cfg(feature = "acpi")]
|
#[cfg(feature = "acpi")]
|
||||||
use acpi_tables::{aml, aml::Aml, sdt::SDT};
|
use acpi_tables::{aml, aml::Aml, sdt::SDT};
|
||||||
@ -579,11 +580,12 @@ impl CpuManager {
|
|||||||
pub fn new(
|
pub fn new(
|
||||||
config: &CpusConfig,
|
config: &CpusConfig,
|
||||||
device_manager: &Arc<Mutex<DeviceManager>>,
|
device_manager: &Arc<Mutex<DeviceManager>>,
|
||||||
guest_memory: GuestMemoryAtomic<GuestMemoryMmap>,
|
memory_manager: &Arc<Mutex<MemoryManager>>,
|
||||||
vm: Arc<dyn hypervisor::Vm>,
|
vm: Arc<dyn hypervisor::Vm>,
|
||||||
reset_evt: EventFd,
|
reset_evt: EventFd,
|
||||||
hypervisor: Arc<dyn hypervisor::Hypervisor>,
|
hypervisor: Arc<dyn hypervisor::Hypervisor>,
|
||||||
) -> Result<Arc<Mutex<CpuManager>>> {
|
) -> Result<Arc<Mutex<CpuManager>>> {
|
||||||
|
let guest_memory = memory_manager.lock().unwrap().guest_memory();
|
||||||
let mut vcpu_states = Vec::with_capacity(usize::from(config.max_vcpus));
|
let mut vcpu_states = Vec::with_capacity(usize::from(config.max_vcpus));
|
||||||
vcpu_states.resize_with(usize::from(config.max_vcpus), VcpuState::default);
|
vcpu_states.resize_with(usize::from(config.max_vcpus), VcpuState::default);
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ impl Vm {
|
|||||||
let cpu_manager = cpu::CpuManager::new(
|
let cpu_manager = cpu::CpuManager::new(
|
||||||
&config.lock().unwrap().cpus.clone(),
|
&config.lock().unwrap().cpus.clone(),
|
||||||
&device_manager,
|
&device_manager,
|
||||||
memory_manager.lock().unwrap().guest_memory(),
|
&memory_manager,
|
||||||
vm.clone(),
|
vm.clone(),
|
||||||
reset_evt,
|
reset_evt,
|
||||||
hypervisor,
|
hypervisor,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user