mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
AArch64: Preparation for vCPU save/restore
This commit ports code from firecracker and refactors the existing AArch64 code as the preparation for implementing save/restore AArch64 vCPU, including: 1. Modification of `arm64_core_reg` macro to retrive the index of arm64 core register and implemention of a helper to determine if a register is a system register. 2. Move some macros and helpers in `arch` crate to the `hypervisor` crate. 3. Added related unit tests for above functions and macros. Signed-off-by: Henry Wang <Henry.Wang@arm.com>
This commit is contained in:
@@ -153,6 +153,11 @@ pub enum HypervisorCpuError {
|
||||
///
|
||||
#[error("Failed to enable HyperV SynIC")]
|
||||
EnableHyperVSynIC(#[source] anyhow::Error),
|
||||
///
|
||||
/// Getting AArch64 system register error
|
||||
///
|
||||
#[error("Failed to get system register: {0}")]
|
||||
GetSysRegister(#[source] anyhow::Error),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -306,6 +311,11 @@ pub trait Vcpu: Send + Sync {
|
||||
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
|
||||
fn get_one_reg(&self, reg_id: u64) -> Result<u64>;
|
||||
///
|
||||
/// Read the MPIDR - Multiprocessor Affinity Register.
|
||||
///
|
||||
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
|
||||
fn read_mpidr(&self) -> Result<u64>;
|
||||
///
|
||||
/// Retrieve the vCPU state.
|
||||
/// This function is necessary to snapshot the VM
|
||||
///
|
||||
@@ -315,7 +325,6 @@ pub trait Vcpu: Send + Sync {
|
||||
/// This function is required when restoring the VM
|
||||
///
|
||||
fn set_state(&self, state: &CpuState) -> Result<()>;
|
||||
|
||||
///
|
||||
/// Triggers the running of the current virtual CPU returning an exit reason.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user