2019-02-25 21:53:01 +00:00
|
|
|
// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
|
|
pub mod layout;
|
|
|
|
|
2020-05-12 09:49:12 +00:00
|
|
|
use crate::RegionType;
|
|
|
|
use kvm_ioctls::*;
|
2020-05-28 07:27:22 +00:00
|
|
|
use vm_memory::{GuestAddress, GuestMemoryAtomic, GuestMemoryMmap, GuestUsize};
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
pub enum Error {}
|
|
|
|
|
|
|
|
impl From<Error> for super::Error {
|
|
|
|
fn from(e: Error) -> super::Error {
|
|
|
|
super::Error::AArch64Setup(e)
|
|
|
|
}
|
|
|
|
}
|
2019-02-25 21:53:01 +00:00
|
|
|
|
|
|
|
/// Stub function that needs to be implemented when aarch64 functionality is added.
|
2020-05-12 09:49:12 +00:00
|
|
|
pub fn arch_memory_regions(size: GuestUsize) -> Vec<(GuestAddress, usize, RegionType)> {
|
|
|
|
vec![(GuestAddress(0), size as usize, RegionType::Ram)]
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone)]
|
|
|
|
/// Specifies the entry point address where the guest must start
|
|
|
|
/// executing code.
|
|
|
|
pub struct EntryPoint {
|
|
|
|
/// Address in guest memory where the guest must start execution
|
|
|
|
pub entry_addr: GuestAddress,
|
2019-02-25 21:53:01 +00:00
|
|
|
}
|
|
|
|
|
2020-05-28 07:27:22 +00:00
|
|
|
pub fn configure_vcpu(
|
|
|
|
_fd: &VcpuFd,
|
|
|
|
_id: u8,
|
|
|
|
_kernel_entry_point: Option<EntryPoint>,
|
|
|
|
_vm_memory: &GuestMemoryAtomic<GuestMemoryMmap>,
|
|
|
|
) -> super::Result<()> {
|
|
|
|
unimplemented!();
|
|
|
|
}
|
|
|
|
|
2019-02-25 21:53:01 +00:00
|
|
|
/// Stub function that needs to be implemented when aarch64 functionality is added.
|
|
|
|
pub fn configure_system(
|
2020-05-12 09:49:12 +00:00
|
|
|
_guest_mem: &GuestMemoryMmap,
|
2019-02-25 21:53:01 +00:00
|
|
|
_cmdline_addr: GuestAddress,
|
|
|
|
_cmdline_size: usize,
|
|
|
|
_num_cpus: u8,
|
2019-11-06 17:20:55 +00:00
|
|
|
_rsdp_addr: Option<GuestAddress>,
|
2019-02-25 21:53:01 +00:00
|
|
|
) -> super::Result<()> {
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Stub function that needs to be implemented when aarch64 functionality is added.
|
|
|
|
pub fn get_reserved_mem_addr() -> usize {
|
|
|
|
0
|
|
|
|
}
|
2020-05-12 09:49:12 +00:00
|
|
|
|
|
|
|
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).
|
|
|
|
// In recent kernel versions, the maxium IPA size supported by the host can be
|
|
|
|
// known by querying cap KVM_CAP_ARM_VM_IPA_SIZE. And the IPA size for a
|
|
|
|
// guest can be configured smaller.
|
|
|
|
// But in Cloud-Hypervisor we simply use the maxium value for the VM.
|
|
|
|
// Reference https://lwn.net/Articles/766767/.
|
|
|
|
//
|
|
|
|
// The correct way to query KVM_CAP_ARM_VM_IPA_SIZE is via rust-vmm/kvm-ioctls,
|
|
|
|
// which wraps all IOCTL's and provides easy interface to user hypervisors.
|
|
|
|
// For now the cap hasn't been supported. A separate patch will be submitted to
|
|
|
|
// rust-vmm to add it.
|
|
|
|
// So a hardcoded value is used here as a temporary solution.
|
|
|
|
// It will be replace once rust-vmm/kvm-ioctls is ready.
|
|
|
|
//
|
|
|
|
40
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn check_required_kvm_extensions(kvm: &Kvm) -> super::Result<()> {
|
|
|
|
if !kvm.check_extension(Cap::SignalMsi) {
|
|
|
|
return Err(super::Error::CapabilityMissing(Cap::SignalMsi));
|
|
|
|
}
|
|
|
|
Ok(())
|
|
|
|
}
|