MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / boot

Method boot

vmm/src/vm.rs:2783–2988  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

2781 }
2782
2783 pub fn boot(&mut self) -> Result<()> {
2784 trace_scoped!("Vm::boot");
2785 let current_state = self.state;
2786 if current_state == VmState::Paused {
2787 return self.resume().map_err(Error::Resume);
2788 }
2789
2790 // We acquire all advisory disk image locks here and not on device creation
2791 // to enable live-migration without locking issues.
2792 self.device_manager
2793 .lock()
2794 .unwrap()
2795 .try_lock_disks()
2796 .map_err(Error::LockingError)?;
2797
2798 let new_state = if self.stop_on_boot {
2799 VmState::BreakPoint
2800 } else {
2801 VmState::Running
2802 };
2803
2804 current_state.valid_transition(new_state)?;
2805
2806 #[cfg(feature = "fw_cfg")]
2807 {
2808 let fw_cfg_enabled = self
2809 .config
2810 .lock()
2811 .unwrap()
2812 .payload
2813 .as_ref()
2814 .is_some_and(|p| p.fw_cfg_config.is_some());
2815 if fw_cfg_enabled {
2816 let fw_cfg_config = self
2817 .config
2818 .lock()
2819 .unwrap()
2820 .payload
2821 .as_ref()
2822 .map(|p| p.fw_cfg_config.clone())
2823 .unwrap_or_default()
2824 .ok_or(Error::VmMissingConfig)?;
2825 #[cfg(target_arch = "x86_64")]
2826 let kvm_sev_snp_enabled = {
2827 #[cfg(feature = "sev_snp")]
2828 {
2829 self.config.lock().unwrap().is_sev_snp_enabled()
2830 && self.hypervisor.hypervisor_type() == hypervisor::HypervisorType::Kvm
2831 }
2832 #[cfg(not(feature = "sev_snp"))]
2833 {
2834 false
2835 }
2836 };
2837
2838 Self::populate_fw_cfg(
2839 &fw_cfg_config,
2840 &self.device_manager,

Callers 2

vm_bootMethod · 0.80
vm_rebootMethod · 0.80

Calls 15

newFunction · 0.85
try_lock_disksMethod · 0.80
valid_transitionMethod · 0.80
is_sev_snp_enabledMethod · 0.80
entry_pointMethod · 0.80
is_tdx_enabledMethod · 0.80
get_vgicMethod · 0.80
vcpusMethod · 0.80
configure_vcpuMethod · 0.80
okMethod · 0.80

Tested by

no test coverage detected