mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
hypervisor: aarch64: capture the guest counter for snapshot/restore
Unlike x86, ARM64 has no kvmclock support to sync guest time upon required. However, the guest reads the architected virtual timer (CNTVCT_EL0) directly which can be modified by the VMM to update the time after snapshot restore. Since the CNTVCT is in ticks, we also need to read CNTFRQ (via mrs due to lack of ONEREG interface) to compute the ticks from wall clock difference. Because the counter is a vCPU register, the capture must run with the vCPUs quiesced, so the VMM now captures the clock just after cpu_manager.pause() through the boot vCPU. This is behaviorally identical for x86, whose clock is VM-wide. There is no restore/advance yet, so aarch64 guests still resume behind real time until the following commit. Signed-off-by: Atish Patra <atishp@meta.com>
This commit is contained in:
committed by
Rob Bradford
parent
ad909a3d71
commit
69637dde69
@@ -511,6 +511,11 @@ pub trait Vcpu: Send + Sync {
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
fn get_sys_reg(&self, sys_reg: u32) -> Result<u64>;
|
||||
///
|
||||
/// Gets the guest virtual counter (`CNTVCT_EL0`) via `KVM_REG_ARM_TIMER_CNT`.
|
||||
///
|
||||
#[cfg(all(target_arch = "aarch64", feature = "kvm"))]
|
||||
fn get_cntvct(&self) -> Result<u64>;
|
||||
///
|
||||
/// Gets the value of a non-core register on RISC-V 64-bit
|
||||
///
|
||||
#[cfg(target_arch = "riscv64")]
|
||||
|
||||
Reference in New Issue
Block a user