From 8f4aa07a803aa5c9500466b556a5191fac1906ff Mon Sep 17 00:00:00 2001 From: Henry Wang Date: Fri, 21 Jan 2022 03:47:21 -0500 Subject: [PATCH] vmm: vm: Init PMU during the VM restore process If a PMU is enabled in a VM, we also need to initialize the PMU when the VM is restored. Otherwise, vCPUs cannot be started after the VM is restored. Signed-off-by: Henry Wang --- vmm/src/vm.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index 100c54859..191d63b8a 100644 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -2142,6 +2142,13 @@ impl Vm { let mut gic_device = create_gic(&self.vm, vcpu_numbers.try_into().unwrap()) .map_err(|e| MigratableError::Restore(anyhow!("Could not create GIC: {:#?}", e)))?; + // PMU interrupt sticks to PPI, so need to be added by 16 to get real irq number. + self.cpu_manager + .lock() + .unwrap() + .init_pmu(arch::aarch64::fdt::AARCH64_PMU_IRQ + 16) + .map_err(|e| MigratableError::Restore(anyhow!("Error init PMU: {:?}", e)))?; + // Here we prepare the GICR_TYPER registers from the restored vCPU states. gic_device.set_gicr_typers(&saved_vcpu_states);