vmm: cpu: Create vCPUs before the DeviceManager

Moving the creation of the vCPUs before the DeviceManager gets created
will allow for the aarch64 vGIC to be created before the DeviceManager
as well in a follow up patch. The end goal being to adopt the same
creation sequence for both x86_64 and aarch64, and keeping in mind that
the vGIC requires every vCPU to be created.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf 2022-11-04 14:29:06 +01:00
parent 578780ed0c
commit 86e7f07485
2 changed files with 8 additions and 3 deletions

View File

@ -2082,10 +2082,9 @@ impl Snapshottable for CpuManager {
fn restore(&mut self, snapshot: Snapshot) -> std::result::Result<(), MigratableError> {
for (cpu_id, snapshot) in snapshot.snapshots.iter() {
let cpu_id = cpu_id.parse::<usize>().unwrap();
info!("Restoring VCPU {}", cpu_id);
let vcpu = self
.create_vcpu(cpu_id.parse::<u8>().unwrap())
.map_err(|e| MigratableError::Restore(anyhow!("Could not create vCPU {:?}", e)))?;
let vcpu = self.vcpus[cpu_id].clone();
self.configure_vcpu(vcpu, None, Some(*snapshot.clone()))
.map_err(|e| {
MigratableError::Restore(anyhow!("Could not configure vCPU {:?}", e))

View File

@ -538,6 +538,12 @@ impl Vm {
)
.map_err(Error::CpuManager)?;
cpu_manager
.lock()
.unwrap()
.create_boot_vcpus()
.map_err(Error::CpuManager)?;
#[cfg(feature = "tdx")]
let dynamic = !tdx_enabled;
#[cfg(not(feature = "tdx"))]