1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// Copyright 2017 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

use kvm_sys::*;

/// A capability the kernel's KVM interface can possibly expose.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u32)]
pub enum KvmCap {
    Irqchip = KVM_CAP_IRQCHIP,
    Hlt = KVM_CAP_HLT,
    MmuShadowCacheControl = KVM_CAP_MMU_SHADOW_CACHE_CONTROL,
    UserMemory = KVM_CAP_USER_MEMORY,
    SetTssAddr = KVM_CAP_SET_TSS_ADDR,
    Vapic = KVM_CAP_VAPIC,
    ExtCpuid = KVM_CAP_EXT_CPUID,
    Clocksource = KVM_CAP_CLOCKSOURCE,
    NrVcpus = KVM_CAP_NR_VCPUS,
    NrMemslots = KVM_CAP_NR_MEMSLOTS,
    Pit = KVM_CAP_PIT,
    NopIoDelay = KVM_CAP_NOP_IO_DELAY,
    PvMmu = KVM_CAP_PV_MMU,
    MpState = KVM_CAP_MP_STATE,
    CoalescedMmio = KVM_CAP_COALESCED_MMIO,
    SyncMmu = KVM_CAP_SYNC_MMU,
    Iommu = KVM_CAP_IOMMU,
    DestroyMemoryRegionWorks = KVM_CAP_DESTROY_MEMORY_REGION_WORKS,
    UserNmi = KVM_CAP_USER_NMI,
    #[cfg(any(target_arch = "x86_64", target_arch = "arm", target_arch = "aarch64"))]
    SetGuestDebug = KVM_CAP_SET_GUEST_DEBUG,
    #[cfg(target_arch = "x86_64")]
    ReinjectControl = KVM_CAP_REINJECT_CONTROL,
    IrqRouting = KVM_CAP_IRQ_ROUTING,
    IrqInjectStatus = KVM_CAP_IRQ_INJECT_STATUS,
    AssignDevIrq = KVM_CAP_ASSIGN_DEV_IRQ,
    JoinMemoryRegionsWorks = KVM_CAP_JOIN_MEMORY_REGIONS_WORKS,
    #[cfg(target_arch = "x86_64")]
    Mce = KVM_CAP_MCE,
    Irqfd = KVM_CAP_IRQFD,
    #[cfg(target_arch = "x86_64")]
    Pit2 = KVM_CAP_PIT2,
    SetBootCpuId = KVM_CAP_SET_BOOT_CPU_ID,
    #[cfg(target_arch = "x86_64")]
    PitState2 = KVM_CAP_PIT_STATE2,
    Ioeventfd = KVM_CAP_IOEVENTFD,
    SetIdentityMapAddr = KVM_CAP_SET_IDENTITY_MAP_ADDR,
    #[cfg(target_arch = "x86_64")]
    XenHvm = KVM_CAP_XEN_HVM,
    AdjustClock = KVM_CAP_ADJUST_CLOCK,
    InternalErrorData = KVM_CAP_INTERNAL_ERROR_DATA,
    #[cfg(target_arch = "x86_64")]
    VcpuEvents = KVM_CAP_VCPU_EVENTS,
    S390Psw = KVM_CAP_S390_PSW,
    PpcSegstate = KVM_CAP_PPC_SEGSTATE,
    Hyperv = KVM_CAP_HYPERV,
    HypervVapic = KVM_CAP_HYPERV_VAPIC,
    HypervSpin = KVM_CAP_HYPERV_SPIN,
    PciSegment = KVM_CAP_PCI_SEGMENT,
    PpcPairedSingles = KVM_CAP_PPC_PAIRED_SINGLES,
    IntrShadow = KVM_CAP_INTR_SHADOW,
    #[cfg(target_arch = "x86_64")]
    Debugregs = KVM_CAP_DEBUGREGS,
    X86RobustSinglestep = KVM_CAP_X86_ROBUST_SINGLESTEP,
    PpcOsi = KVM_CAP_PPC_OSI,
    PpcUnsetIrq = KVM_CAP_PPC_UNSET_IRQ,
    EnableCap = KVM_CAP_ENABLE_CAP,
    #[cfg(target_arch = "x86_64")]
    Xsave = KVM_CAP_XSAVE,
    #[cfg(target_arch = "x86_64")]
    Xcrs = KVM_CAP_XCRS,
    PpcGetPvinfo = KVM_CAP_PPC_GET_PVINFO,
    PpcIrqLevel = KVM_CAP_PPC_IRQ_LEVEL,
    AsyncPf = KVM_CAP_ASYNC_PF,
    TscControl = KVM_CAP_TSC_CONTROL,
    GetTscKhz = KVM_CAP_GET_TSC_KHZ,
    PpcBookeSregs = KVM_CAP_PPC_BOOKE_SREGS,
    SpaprTce = KVM_CAP_SPAPR_TCE,
    PpcSmt = KVM_CAP_PPC_SMT,
    PpcRma = KVM_CAP_PPC_RMA,
    MaxVcpus = KVM_CAP_MAX_VCPUS,
    PpcHior = KVM_CAP_PPC_HIOR,
    PpcPapr = KVM_CAP_PPC_PAPR,
    SwTlb = KVM_CAP_SW_TLB,
    OneReg = KVM_CAP_ONE_REG,
    S390Gmap = KVM_CAP_S390_GMAP,
    TscDeadlineTimer = KVM_CAP_TSC_DEADLINE_TIMER,
    S390Ucontrol = KVM_CAP_S390_UCONTROL,
    SyncRegs = KVM_CAP_SYNC_REGS,
    Pci23 = KVM_CAP_PCI_2_3,
    KvmclockCtrl = KVM_CAP_KVMCLOCK_CTRL,
    SignalMsi = KVM_CAP_SIGNAL_MSI,
    PpcGetSmmuInfo = KVM_CAP_PPC_GET_SMMU_INFO,
    S390Cow = KVM_CAP_S390_COW,
    PpcAllocHtab = KVM_CAP_PPC_ALLOC_HTAB,
    ReadonlyMem = KVM_CAP_READONLY_MEM,
    IrqfdResample = KVM_CAP_IRQFD_RESAMPLE,
    PpcBookeWatchdog = KVM_CAP_PPC_BOOKE_WATCHDOG,
    PpcHtabFd = KVM_CAP_PPC_HTAB_FD,
    S390CssSupport = KVM_CAP_S390_CSS_SUPPORT,
    PpcEpr = KVM_CAP_PPC_EPR,
    ArmPsci = KVM_CAP_ARM_PSCI,
    ArmSetDeviceAddr = KVM_CAP_ARM_SET_DEVICE_ADDR,
    DeviceCtrl = KVM_CAP_DEVICE_CTRL,
    IrqMpic = KVM_CAP_IRQ_MPIC,
    PpcRtas = KVM_CAP_PPC_RTAS,
    IrqXics = KVM_CAP_IRQ_XICS,
    ArmEl132bit = KVM_CAP_ARM_EL1_32BIT,
    SpaprMultitce = KVM_CAP_SPAPR_MULTITCE,
    ExtEmulCpuid = KVM_CAP_EXT_EMUL_CPUID,
    HypervTime = KVM_CAP_HYPERV_TIME,
    IoapicPolarityIgnored = KVM_CAP_IOAPIC_POLARITY_IGNORED,
    EnableCapVm = KVM_CAP_ENABLE_CAP_VM,
    S390Irqchip = KVM_CAP_S390_IRQCHIP,
    IoeventfdNoLength = KVM_CAP_IOEVENTFD_NO_LENGTH,
    VmAttributes = KVM_CAP_VM_ATTRIBUTES,
    ArmPsci02 = KVM_CAP_ARM_PSCI_0_2,
    PpcFixupHcall = KVM_CAP_PPC_FIXUP_HCALL,
    PpcEnableHcall = KVM_CAP_PPC_ENABLE_HCALL,
    CheckExtensionVm = KVM_CAP_CHECK_EXTENSION_VM,
    S390UserSigp = KVM_CAP_S390_USER_SIGP,
    ImmediateExit = KVM_CAP_IMMEDIATE_EXIT,
    ArmPmuV3 = KVM_CAP_ARM_PMU_V3,
    ArmProtectedVm = KVM_CAP_ARM_PROTECTED_VM,
    X86ProtectedVm = KVM_CAP_X86_PROTECTED_VM,
    ArmMte = KVM_CAP_ARM_MTE,
    #[cfg(target_arch = "x86_64")]
    BusLockDetect = KVM_CAP_X86_BUS_LOCK_EXIT,
    MemNoncoherentDma = KVM_CAP_USER_CONFIGURE_NONCOHERENT_DMA,
    UserMemory2 = KVM_CAP_USER_MEMORY2,
}