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

Method init

vmm/src/cpu.rs:609–633  ·  view source on GitHub ↗
(&self, vm: &dyn hypervisor::Vm)

Source from the content-addressed store, hash-verified

607 /// Initializes an aarch64 specific vcpu for booting Linux.
608 #[cfg(target_arch = "aarch64")]
609 pub fn init(&self, vm: &dyn hypervisor::Vm) -> Result<()> {
610 use std::arch::is_aarch64_feature_detected;
611 #[allow(clippy::nonminimal_bool)]
612 let sve_supported =
613 is_aarch64_feature_detected!("sve") || is_aarch64_feature_detected!("sve2");
614 let mut kvi = self.vcpu.create_vcpu_init();
615
616 // This reads back the kernel's preferred target type.
617 vm.get_preferred_target(&mut kvi)
618 .map_err(Error::VcpuArmPreferredTarget)?;
619
620 self.vcpu
621 .vcpu_set_processor_features(vm, &mut kvi, self.id)
622 .map_err(Error::VcpuSetProcessorFeatures)?;
623
624 self.vcpu.vcpu_init(&kvi).map_err(Error::VcpuArmInit)?;
625
626 if sve_supported {
627 let finalized_features = self.vcpu.vcpu_get_finalized_features();
628 self.vcpu
629 .vcpu_finalize(finalized_features)
630 .map_err(Error::VcpuArmFinalize)?;
631 }
632 Ok(())
633 }
634
635 /// Runs the VCPU until it exits, returning the reason.
636 ///

Callers 6

configureMethod · 0.45
create_vcpuMethod · 0.45
init_sev_snpMethod · 0.45
init_mshvMethod · 0.45
init_kvmMethod · 0.45

Calls 6

create_vcpu_initMethod · 0.45
get_preferred_targetMethod · 0.45
vcpu_initMethod · 0.45
vcpu_finalizeMethod · 0.45

Tested by

no test coverage detected