mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
aarch64: Porting AArch64 register implementation from Firecracker
As on AArch64 systems we need register mpidr to create the flattened device tree, here in this commit we add ported AArch64 register implementation from Firecracker and related changes to make this commit build. Signed-off-by: Henry Wang <Henry.Wang@arm.com>
This commit is contained in:
+21
-1
@@ -7,10 +7,15 @@ mod gicv2;
|
||||
mod gicv3;
|
||||
/// Layout for this aarch64 system.
|
||||
pub mod layout;
|
||||
/// Logic for configuring aarch64 registers.
|
||||
pub mod regs;
|
||||
|
||||
use crate::RegionType;
|
||||
use kvm_ioctls::*;
|
||||
use vm_memory::{GuestAddress, GuestMemoryAtomic, GuestMemoryMmap, GuestUsize};
|
||||
use std::fmt::Debug;
|
||||
use vm_memory::{
|
||||
Address, GuestAddress, GuestMemory, GuestMemoryAtomic, GuestMemoryMmap, GuestUsize,
|
||||
};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum Error {}
|
||||
@@ -59,6 +64,21 @@ pub fn get_reserved_mem_addr() -> usize {
|
||||
0
|
||||
}
|
||||
|
||||
// Auxiliary function to get the address where the device tree blob is loaded.
|
||||
fn get_fdt_addr(mem: &GuestMemoryMmap) -> u64 {
|
||||
// If the memory allocated is smaller than the size allocated for the FDT,
|
||||
// we return the start of the DRAM so that
|
||||
// we allow the code to try and load the FDT.
|
||||
|
||||
if let Some(addr) = mem.last_addr().checked_sub(layout::FDT_MAX_SIZE as u64 - 1) {
|
||||
if mem.address_in_range(addr) {
|
||||
return addr.raw_value();
|
||||
}
|
||||
}
|
||||
|
||||
layout::RAM_64BIT_START
|
||||
}
|
||||
|
||||
pub fn get_host_cpu_phys_bits() -> u8 {
|
||||
// The value returned here is used to determine the physical address space size
|
||||
// for a VM (IPA size).
|
||||
|
||||
Reference in New Issue
Block a user