// Copyright 2020 The ChromiumOS Authors1// Use of this source code is governed by a BSD-style license that can be2// found in the LICENSE file.34/// An enumeration of different hypervisor capabilities.5#[derive(Clone, Copy, Debug, Eq, PartialEq)]6pub enum HypervisorCap {7ImmediateExit,8UserMemory,9#[cfg(target_arch = "x86_64")]10Xcrs,11#[cfg(target_arch = "x86_64")]12/// CPUID leaf 0x15 is available on some Intel chips and contains the TSC13/// frequency, which can be used to calibrate the guest's TSC clocksource;14/// however, it is not typically accurate enough (being off by 1-2% is a15/// big problem for a clocksource), and inside the guest, calibration by16/// other means is not always reliable.17///18/// Hypervisors which do not provide the TSC frequency (e.g. via the kvm19/// pvclock) or have another suitable calibration source can declare this20/// capability, which causes crosvm to substitute a calibrated value in leaf21/// 0x15 that will be accurate enough for use in a clocksource.22CalibratedTscLeafRequired,23// By default, when swiotlb is enabled, crosvm will only specify its size in the device tree24// and allow the guest to decide where to allocate the buffer in guest phsyical memory.25//26// If this capability is declared, then instead crosvm will carve out space at the end of27// physical memory and register it as a distinct memory region. Then, both the address and28// size will be specified in the device tree. This region will still be reported as part29// of the main memory region in the device tree.30StaticSwiotlbAllocationRequired,31/// Some hypervisors (presently: Gunyah) will configure initial boot-time registers32/// for vCPUs without need for CrosVM to specify.33///34/// If this capability is declared, then crosvm will not try to initialize vcpu35/// registers when creating the VM.36HypervisorInitializedBootContext,37}3839/// A capability the `Vm` can possibly expose.40#[derive(Clone, Copy, Debug, Eq, PartialEq)]41pub enum VmCap {42#[cfg(target_arch = "aarch64")]43ArmPmuV3,44/// Track dirty pages45DirtyLog,46/// Paravirtualized clock device47PvClock,48/// VM can be run in protected mode, where the host does not have access to its memory.49Protected,50/// VM completes initialization of CPUID at creation time, not required after.51EarlyInitCpuid,52/// VM can detect the bus lock53#[cfg(target_arch = "x86_64")]54BusLockDetect,55/// Supports read-only memory regions.56ReadOnlyMemoryRegion,57/// VM can set guest memory cache noncoherent DMA flag58MemNoncoherentDma,59/// If supported, this VM supports enabling ARM SVE (Scalable Vector Extension)60/// by requesting `VcpuFeature::Sve` when calling `VcpuAarch64::init()`.61#[cfg(target_arch = "aarch64")]62Sve,63}646566