(
config: Arc<Mutex<VmConfig>>,
memory_manager: Arc<Mutex<MemoryManager>>,
vm: Arc<dyn hypervisor::Vm>,
exit_evt: EventFd,
reset_evt: EventFd,
guest_exi
| 561 | #[allow(clippy::needless_pass_by_value)] |
| 562 | #[allow(clippy::too_many_arguments)] |
| 563 | pub fn new_from_memory_manager( |
| 564 | config: Arc<Mutex<VmConfig>>, |
| 565 | memory_manager: Arc<Mutex<MemoryManager>>, |
| 566 | vm: Arc<dyn hypervisor::Vm>, |
| 567 | exit_evt: EventFd, |
| 568 | reset_evt: EventFd, |
| 569 | guest_exit_evt: EventFd, |
| 570 | #[cfg(feature = "guest_debug")] vm_debug_evt: EventFd, |
| 571 | seccomp_action: &SeccompAction, |
| 572 | hypervisor: Arc<dyn hypervisor::Hypervisor>, |
| 573 | activate_evt: EventFd, |
| 574 | #[cfg(not(target_arch = "riscv64"))] timestamp: Instant, |
| 575 | console_info: Option<ConsoleInfo>, |
| 576 | console_resize_pipe: Option<Arc<File>>, |
| 577 | original_termios: Arc<Mutex<Option<termios>>>, |
| 578 | snapshot: Option<&Snapshot>, |
| 579 | #[cfg(feature = "igvm")] igvm_file: Option<IgvmFile>, |
| 580 | ) -> Result<Self> { |
| 581 | trace_scoped!("Vm::new_from_memory_manager"); |
| 582 | |
| 583 | let boot_id_list = config |
| 584 | .lock() |
| 585 | .unwrap() |
| 586 | .validate() |
| 587 | .map_err(Error::ConfigValidation)?; |
| 588 | |
| 589 | info!("Booting VM from config: {:?}", &config); |
| 590 | |
| 591 | // Create NUMA nodes based on NumaConfig. |
| 592 | let numa_nodes = |
| 593 | Self::create_numa_nodes(config.lock().unwrap().numa.as_deref(), &memory_manager)?; |
| 594 | |
| 595 | // Determine if VIRTIO_F_ACCESS_PLATFORM should be forced (e.g. for TDX/SEV-SNP) |
| 596 | let force_access_platform = Self::should_force_access_platform(&config); |
| 597 | |
| 598 | let stop_on_boot = Self::should_stop_on_boot(&config); |
| 599 | |
| 600 | let memory = memory_manager.lock().unwrap().guest_memory(); |
| 601 | let io_bus = Arc::new(Bus::new()); |
| 602 | let mmio_bus = Arc::new(Bus::new()); |
| 603 | |
| 604 | let vm_ops: Arc<dyn VmOps> = Arc::new(VmOpsHandler { |
| 605 | memory, |
| 606 | #[cfg(target_arch = "x86_64")] |
| 607 | io_bus: io_bus.clone(), |
| 608 | mmio_bus: mmio_bus.clone(), |
| 609 | }); |
| 610 | |
| 611 | // Create CPU manager |
| 612 | let cpu_manager = Self::create_cpu_manager( |
| 613 | &config, |
| 614 | vm.clone(), |
| 615 | exit_evt.try_clone().map_err(Error::EventFdClone)?, |
| 616 | reset_evt.try_clone().map_err(Error::EventFdClone)?, |
| 617 | #[cfg(feature = "guest_debug")] |
| 618 | vm_debug_evt, |
| 619 | &hypervisor, |
| 620 | seccomp_action.clone(), |
nothing calls this directly
no test coverage detected