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:
@@ -9,7 +9,9 @@
|
||||
//
|
||||
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
pub use crate::aarch64::{check_required_kvm_extensions, VcpuInit, VcpuKvmState as CpuState};
|
||||
pub use crate::aarch64::{
|
||||
check_required_kvm_extensions, VcpuInit, VcpuKvmState as CpuState, MPIDR_EL1,
|
||||
};
|
||||
use crate::cpu;
|
||||
use crate::device;
|
||||
use crate::hypervisor;
|
||||
@@ -763,6 +765,15 @@ impl cpu::Vcpu for KvmVcpu {
|
||||
.get_one_reg(reg_id)
|
||||
.map_err(|e| cpu::HypervisorCpuError::GetOneReg(e.into()))
|
||||
}
|
||||
///
|
||||
/// Read the MPIDR - Multiprocessor Affinity Register.
|
||||
///
|
||||
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
|
||||
fn read_mpidr(&self) -> cpu::Result<u64> {
|
||||
self.fd
|
||||
.get_one_reg(MPIDR_EL1)
|
||||
.map_err(|e| cpu::HypervisorCpuError::GetSysRegister(e.into()))
|
||||
}
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
///
|
||||
/// Get the current CPU state
|
||||
|
||||
Reference in New Issue
Block a user