1 // Copyright 2020 The ChromiumOS Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 /// An enumeration of different hypervisor capabilities. 6 #[derive(Clone, Copy, Debug, Eq, PartialEq)] 7 pub enum HypervisorCap { 8 ArmPmuV3, 9 ImmediateExit, 10 S390UserSigp, 11 TscDeadlineTimer, 12 UserMemory, 13 #[cfg(target_arch = "x86_64")] 14 Xcrs, 15 #[cfg(target_arch = "x86_64")] 16 /// CPUID leaf 0x15 is available on some Intel chips and contains the TSC 17 /// frequency, which can be used to calibrate the guest's TSC clocksource; 18 /// however, it is not typically accurate enough (being off by 1-2% is a 19 /// big problem for a clocksource), and inside the guest, calibration by 20 /// other means is not always reliable. 21 /// 22 /// Hypervisors which do not provide the TSC frequency (e.g. via the kvm 23 /// pvclock) or have another suitable calibration source can declare this 24 /// capability, which causes crosvm to substitute a calibrated value in leaf 25 /// 0x15 that will be accurate enough for use in a clocksource. 26 CalibratedTscLeafRequired, 27 // By default, when swiotlb is enabled, crosvm will only specify its size in the device tree 28 // and allow the guest to decide where to allocate the buffer in guest phsyical memory. 29 // 30 // If this capability is declared, then instead crosvm will allocate space for the swiotlb 31 // outside of guest physical memory and specify both the address and size in the device tree. 32 StaticSwiotlbAllocationRequired, 33 /// Some hypervisors (presently: Gunyah) will configure initial boot-time registers 34 /// for vCPUs without need for CrosVM to specify. 35 /// 36 /// If this capability is declared, then crosvm will not try to initialize vcpu 37 /// registers when creating the VM. 38 HypervisorInitializedBootContext, 39 } 40 41 /// A capability the `Vm` can possibly expose. 42 #[derive(Clone, Copy, Debug, Eq, PartialEq)] 43 pub enum VmCap { 44 /// Track dirty pages 45 DirtyLog, 46 /// Paravirtualized clock device 47 PvClock, 48 /// VM can be run in protected mode, where the host does not have access to its memory. 49 Protected, 50 /// VM completes initialization of CPUID at creation time, not required after. 51 EarlyInitCpuid, 52 /// VM can detect the bus lock 53 #[cfg(target_arch = "x86_64")] 54 BusLockDetect, 55 /// Supports read-only memory regions. 56 ReadOnlyMemoryRegion, 57 /// VM can set guest memory cache noncoherent DMA flag 58 MemNoncoherentDma, 59 } 60