From 744a0490072e018b31e50585b2a3e093cca587ef Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Thu, 28 Apr 2022 16:33:39 +0100 Subject: [PATCH] vmm: Parallelise functionality with kernel loading Move fuctionality earlier in the boot so as to run in parallel with the loading of the kernel. Signed-off-by: Rob Bradford --- vmm/src/vm.rs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index be2daa5c7..46b39f55a 100644 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -2139,6 +2139,13 @@ impl Vm { }; current_state.valid_transition(new_state)?; + // Do earlier to parallelise with loading kernel + #[cfg(target_arch = "x86_64")] + let rsdp_addr = self.create_acpi_tables(); + + self.setup_signal_handler()?; + self.setup_tty()?; + // Load kernel if configured let entry_point = self.entry_point()?; @@ -2163,8 +2170,6 @@ impl Vm { Vec::new() }; - let rsdp_addr = self.create_acpi_tables(); - // Configuring the TDX regions requires that the vCPUs are created. #[cfg(feature = "tdx")] let hob_address = if self.config.lock().unwrap().tdx.is_some() { @@ -2174,6 +2179,11 @@ impl Vm { None }; + // On aarch64 the ACPI tables depend on the vCPU mpidr which is only + // available after they are configured + #[cfg(target_arch = "aarch64")] + let rsdp_addr = self.create_acpi_tables(); + // Configure shared state based on loaded kernel entry_point .map(|_| { @@ -2208,9 +2218,6 @@ impl Vm { .map_err(Error::CpuManager)?; } - self.setup_signal_handler()?; - self.setup_tty()?; - let mut state = self.state.try_write().map_err(|_| Error::PoisonedState)?; *state = new_state; event!("vm", "booted");