linux/include/uapi/linux/kvm.h

/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef __LINUX_KVM_H
#define __LINUX_KVM_H

/*
 * Userspace interface for /dev/kvm - kernel based virtual machine
 *
 * Note: you must update KVM_API_VERSION if you change this interface.
 */

#include <linux/const.h>
#include <linux/types.h>
#include <linux/compiler.h>
#include <linux/ioctl.h>
#include <asm/kvm.h>

#define KVM_API_VERSION

/*
 * Backwards-compatible definitions.
 */
#define __KVM_HAVE_GUEST_DEBUG

/* for KVM_SET_USER_MEMORY_REGION */
struct kvm_userspace_memory_region {};

/* for KVM_SET_USER_MEMORY_REGION2 */
struct kvm_userspace_memory_region2 {};

/*
 * The bit 0 ~ bit 15 of kvm_userspace_memory_region::flags are visible for
 * userspace, other bits are reserved for kvm internal use which are defined
 * in include/linux/kvm_host.h.
 */
#define KVM_MEM_LOG_DIRTY_PAGES
#define KVM_MEM_READONLY
#define KVM_MEM_GUEST_MEMFD

/* for KVM_IRQ_LINE */
struct kvm_irq_level {};


struct kvm_irqchip {};

/* for KVM_CREATE_PIT2 */
struct kvm_pit_config {};

#define KVM_PIT_SPEAKER_DUMMY

struct kvm_hyperv_exit {};

struct kvm_xen_exit {};

#define KVM_S390_GET_SKEYS_NONE
#define KVM_S390_SKEYS_MAX

#define KVM_EXIT_UNKNOWN
#define KVM_EXIT_EXCEPTION
#define KVM_EXIT_IO
#define KVM_EXIT_HYPERCALL
#define KVM_EXIT_DEBUG
#define KVM_EXIT_HLT
#define KVM_EXIT_MMIO
#define KVM_EXIT_IRQ_WINDOW_OPEN
#define KVM_EXIT_SHUTDOWN
#define KVM_EXIT_FAIL_ENTRY
#define KVM_EXIT_INTR
#define KVM_EXIT_SET_TPR
#define KVM_EXIT_TPR_ACCESS
#define KVM_EXIT_S390_SIEIC
#define KVM_EXIT_S390_RESET
#define KVM_EXIT_DCR
#define KVM_EXIT_NMI
#define KVM_EXIT_INTERNAL_ERROR
#define KVM_EXIT_OSI
#define KVM_EXIT_PAPR_HCALL
#define KVM_EXIT_S390_UCONTROL
#define KVM_EXIT_WATCHDOG
#define KVM_EXIT_S390_TSCH
#define KVM_EXIT_EPR
#define KVM_EXIT_SYSTEM_EVENT
#define KVM_EXIT_S390_STSI
#define KVM_EXIT_IOAPIC_EOI
#define KVM_EXIT_HYPERV
#define KVM_EXIT_ARM_NISV
#define KVM_EXIT_X86_RDMSR
#define KVM_EXIT_X86_WRMSR
#define KVM_EXIT_DIRTY_RING_FULL
#define KVM_EXIT_AP_RESET_HOLD
#define KVM_EXIT_X86_BUS_LOCK
#define KVM_EXIT_XEN
#define KVM_EXIT_RISCV_SBI
#define KVM_EXIT_RISCV_CSR
#define KVM_EXIT_NOTIFY
#define KVM_EXIT_LOONGARCH_IOCSR
#define KVM_EXIT_MEMORY_FAULT

/* For KVM_EXIT_INTERNAL_ERROR */
/* Emulate instruction failed. */
#define KVM_INTERNAL_ERROR_EMULATION
/* Encounter unexpected simultaneous exceptions. */
#define KVM_INTERNAL_ERROR_SIMUL_EX
/* Encounter unexpected vm-exit due to delivery event. */
#define KVM_INTERNAL_ERROR_DELIVERY_EV
/* Encounter unexpected vm-exit reason */
#define KVM_INTERNAL_ERROR_UNEXPECTED_EXIT_REASON

/* Flags that describe what fields in emulation_failure hold valid data. */
#define KVM_INTERNAL_ERROR_EMULATION_FLAG_INSTRUCTION_BYTES

/*
 * struct kvm_run can be modified by userspace at any time, so KVM must be
 * careful to avoid TOCTOU bugs. In order to protect KVM, HINT_UNSAFE_IN_KVM()
 * renames fields in struct kvm_run from <symbol> to <symbol>__unsafe when
 * compiled into the kernel, ensuring that any use within KVM is obvious and
 * gets extra scrutiny.
 */
#ifdef __KERNEL__
#define HINT_UNSAFE_IN_KVM(_symbol)
#else
#define HINT_UNSAFE_IN_KVM
#endif

/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */
struct kvm_run {};

/* for KVM_REGISTER_COALESCED_MMIO / KVM_UNREGISTER_COALESCED_MMIO */

struct kvm_coalesced_mmio_zone {};

struct kvm_coalesced_mmio {};

struct kvm_coalesced_mmio_ring {};

#define KVM_COALESCED_MMIO_MAX

/* for KVM_TRANSLATE */
struct kvm_translation {};

/* for KVM_INTERRUPT */
struct kvm_interrupt {};

/* for KVM_GET_DIRTY_LOG */
struct kvm_dirty_log {};

/* for KVM_CLEAR_DIRTY_LOG */
struct kvm_clear_dirty_log {};

/* for KVM_SET_SIGNAL_MASK */
struct kvm_signal_mask {};

/* for KVM_TPR_ACCESS_REPORTING */
struct kvm_tpr_access_ctl {};

/* for KVM_SET_VAPIC_ADDR */
struct kvm_vapic_addr {};

/* for KVM_SET_MP_STATE */

/* not all states are valid on all architectures */
#define KVM_MP_STATE_RUNNABLE
#define KVM_MP_STATE_UNINITIALIZED
#define KVM_MP_STATE_INIT_RECEIVED
#define KVM_MP_STATE_HALTED
#define KVM_MP_STATE_SIPI_RECEIVED
#define KVM_MP_STATE_STOPPED
#define KVM_MP_STATE_CHECK_STOP
#define KVM_MP_STATE_OPERATING
#define KVM_MP_STATE_LOAD
#define KVM_MP_STATE_AP_RESET_HOLD
#define KVM_MP_STATE_SUSPENDED

struct kvm_mp_state {};

/* for KVM_SET_GUEST_DEBUG */

#define KVM_GUESTDBG_ENABLE
#define KVM_GUESTDBG_SINGLESTEP

struct kvm_guest_debug {};

enum {};

#define KVM_IOEVENTFD_FLAG_DATAMATCH
#define KVM_IOEVENTFD_FLAG_PIO
#define KVM_IOEVENTFD_FLAG_DEASSIGN
#define KVM_IOEVENTFD_FLAG_VIRTIO_CCW_NOTIFY

#define KVM_IOEVENTFD_VALID_FLAG_MASK

struct kvm_ioeventfd {};

#define KVM_X86_DISABLE_EXITS_MWAIT
#define KVM_X86_DISABLE_EXITS_HLT
#define KVM_X86_DISABLE_EXITS_PAUSE
#define KVM_X86_DISABLE_EXITS_CSTATE
#define KVM_X86_DISABLE_VALID_EXITS

/* for KVM_ENABLE_CAP */
struct kvm_enable_cap {};

#define KVMIO

/* machine type bits, to be used as argument to KVM_CREATE_VM */
#define KVM_VM_S390_UCONTROL

/* on ppc, 0 indicate default, 1 should force HV and 2 PR */
#define KVM_VM_PPC_HV
#define KVM_VM_PPC_PR

/* on MIPS, 0 indicates auto, 1 forces VZ ASE, 2 forces trap & emulate */
#define KVM_VM_MIPS_AUTO
#define KVM_VM_MIPS_VZ
#define KVM_VM_MIPS_TE

#define KVM_S390_SIE_PAGE_OFFSET

/*
 * On arm64, machine type can be used to request the physical
 * address size for the VM. Bits[7-0] are reserved for the guest
 * PA size shift (i.e, log2(PA_Size)). For backward compatibility,
 * value 0 implies the default IPA size, 40bits.
 */
#define KVM_VM_TYPE_ARM_IPA_SIZE_MASK
#define KVM_VM_TYPE_ARM_IPA_SIZE(x)
/*
 * ioctls for /dev/kvm fds:
 */
#define KVM_GET_API_VERSION
#define KVM_CREATE_VM
#define KVM_GET_MSR_INDEX_LIST

#define KVM_S390_ENABLE_SIE
/*
 * Check if a kvm extension is available.  Argument is extension number,
 * return is 1 (yes) or 0 (no, sorry).
 */
#define KVM_CHECK_EXTENSION
/*
 * Get size for mmap(vcpu_fd)
 */
#define KVM_GET_VCPU_MMAP_SIZE
#define KVM_GET_SUPPORTED_CPUID
#define KVM_GET_EMULATED_CPUID
#define KVM_GET_MSR_FEATURE_INDEX_LIST

/*
 * Extension capability list.
 */
#define KVM_CAP_IRQCHIP
#define KVM_CAP_HLT
#define KVM_CAP_MMU_SHADOW_CACHE_CONTROL
#define KVM_CAP_USER_MEMORY
#define KVM_CAP_SET_TSS_ADDR
#define KVM_CAP_VAPIC
#define KVM_CAP_EXT_CPUID
#define KVM_CAP_CLOCKSOURCE
#define KVM_CAP_NR_VCPUS
#define KVM_CAP_NR_MEMSLOTS
#define KVM_CAP_PIT
#define KVM_CAP_NOP_IO_DELAY
#define KVM_CAP_PV_MMU
#define KVM_CAP_MP_STATE
#define KVM_CAP_COALESCED_MMIO
#define KVM_CAP_SYNC_MMU
#define KVM_CAP_IOMMU
/* Bug in KVM_SET_USER_MEMORY_REGION fixed: */
#define KVM_CAP_DESTROY_MEMORY_REGION_WORKS
#define KVM_CAP_USER_NMI
#define KVM_CAP_SET_GUEST_DEBUG
#ifdef __KVM_HAVE_PIT
#define KVM_CAP_REINJECT_CONTROL
#endif
#define KVM_CAP_IRQ_ROUTING
#define KVM_CAP_IRQ_INJECT_STATUS
#define KVM_CAP_ASSIGN_DEV_IRQ
/* Another bug in KVM_SET_USER_MEMORY_REGION fixed: */
#define KVM_CAP_JOIN_MEMORY_REGIONS_WORKS
#ifdef __KVM_HAVE_MCE
#define KVM_CAP_MCE
#endif
#define KVM_CAP_IRQFD
#ifdef __KVM_HAVE_PIT
#define KVM_CAP_PIT2
#endif
#define KVM_CAP_SET_BOOT_CPU_ID
#ifdef __KVM_HAVE_PIT_STATE2
#define KVM_CAP_PIT_STATE2
#endif
#define KVM_CAP_IOEVENTFD
#define KVM_CAP_SET_IDENTITY_MAP_ADDR
#ifdef __KVM_HAVE_XEN_HVM
#define KVM_CAP_XEN_HVM
#endif
#define KVM_CAP_ADJUST_CLOCK
#define KVM_CAP_INTERNAL_ERROR_DATA
#ifdef __KVM_HAVE_VCPU_EVENTS
#define KVM_CAP_VCPU_EVENTS
#endif
#define KVM_CAP_S390_PSW
#define KVM_CAP_PPC_SEGSTATE
#define KVM_CAP_HYPERV
#define KVM_CAP_HYPERV_VAPIC
#define KVM_CAP_HYPERV_SPIN
#define KVM_CAP_PCI_SEGMENT
#define KVM_CAP_PPC_PAIRED_SINGLES
#define KVM_CAP_INTR_SHADOW
#ifdef __KVM_HAVE_DEBUGREGS
#define KVM_CAP_DEBUGREGS
#endif
#define KVM_CAP_X86_ROBUST_SINGLESTEP
#define KVM_CAP_PPC_OSI
#define KVM_CAP_PPC_UNSET_IRQ
#define KVM_CAP_ENABLE_CAP
#ifdef __KVM_HAVE_XSAVE
#define KVM_CAP_XSAVE
#endif
#ifdef __KVM_HAVE_XCRS
#define KVM_CAP_XCRS
#endif
#define KVM_CAP_PPC_GET_PVINFO
#define KVM_CAP_PPC_IRQ_LEVEL
#define KVM_CAP_ASYNC_PF
#define KVM_CAP_TSC_CONTROL
#define KVM_CAP_GET_TSC_KHZ
#define KVM_CAP_PPC_BOOKE_SREGS
#define KVM_CAP_SPAPR_TCE
#define KVM_CAP_PPC_SMT
#define KVM_CAP_PPC_RMA
#define KVM_CAP_MAX_VCPUS
#define KVM_CAP_PPC_HIOR
#define KVM_CAP_PPC_PAPR
#define KVM_CAP_SW_TLB
#define KVM_CAP_ONE_REG
#define KVM_CAP_S390_GMAP
#define KVM_CAP_TSC_DEADLINE_TIMER
#define KVM_CAP_S390_UCONTROL
#define KVM_CAP_SYNC_REGS
#define KVM_CAP_PCI_2_3
#define KVM_CAP_KVMCLOCK_CTRL
#define KVM_CAP_SIGNAL_MSI
#define KVM_CAP_PPC_GET_SMMU_INFO
#define KVM_CAP_S390_COW
#define KVM_CAP_PPC_ALLOC_HTAB
#define KVM_CAP_READONLY_MEM
#define KVM_CAP_IRQFD_RESAMPLE
#define KVM_CAP_PPC_BOOKE_WATCHDOG
#define KVM_CAP_PPC_HTAB_FD
#define KVM_CAP_S390_CSS_SUPPORT
#define KVM_CAP_PPC_EPR
#define KVM_CAP_ARM_PSCI
#define KVM_CAP_ARM_SET_DEVICE_ADDR
#define KVM_CAP_DEVICE_CTRL
#define KVM_CAP_IRQ_MPIC
#define KVM_CAP_PPC_RTAS
#define KVM_CAP_IRQ_XICS
#define KVM_CAP_ARM_EL1_32BIT
#define KVM_CAP_SPAPR_MULTITCE
#define KVM_CAP_EXT_EMUL_CPUID
#define KVM_CAP_HYPERV_TIME
#define KVM_CAP_IOAPIC_POLARITY_IGNORED
#define KVM_CAP_ENABLE_CAP_VM
#define KVM_CAP_S390_IRQCHIP
#define KVM_CAP_IOEVENTFD_NO_LENGTH
#define KVM_CAP_VM_ATTRIBUTES
#define KVM_CAP_ARM_PSCI_0_2
#define KVM_CAP_PPC_FIXUP_HCALL
#define KVM_CAP_PPC_ENABLE_HCALL
#define KVM_CAP_CHECK_EXTENSION_VM
#define KVM_CAP_S390_USER_SIGP
#define KVM_CAP_S390_VECTOR_REGISTERS
#define KVM_CAP_S390_MEM_OP
#define KVM_CAP_S390_USER_STSI
#define KVM_CAP_S390_SKEYS
#define KVM_CAP_MIPS_FPU
#define KVM_CAP_MIPS_MSA
#define KVM_CAP_S390_INJECT_IRQ
#define KVM_CAP_S390_IRQ_STATE
#define KVM_CAP_PPC_HWRNG
#define KVM_CAP_DISABLE_QUIRKS
#define KVM_CAP_X86_SMM
#define KVM_CAP_MULTI_ADDRESS_SPACE
#define KVM_CAP_GUEST_DEBUG_HW_BPS
#define KVM_CAP_GUEST_DEBUG_HW_WPS
#define KVM_CAP_SPLIT_IRQCHIP
#define KVM_CAP_IOEVENTFD_ANY_LENGTH
#define KVM_CAP_HYPERV_SYNIC
#define KVM_CAP_S390_RI
#define KVM_CAP_SPAPR_TCE_64
#define KVM_CAP_ARM_PMU_V3
#define KVM_CAP_VCPU_ATTRIBUTES
#define KVM_CAP_MAX_VCPU_ID
#define KVM_CAP_X2APIC_API
#define KVM_CAP_S390_USER_INSTR0
#define KVM_CAP_MSI_DEVID
#define KVM_CAP_PPC_HTM
#define KVM_CAP_SPAPR_RESIZE_HPT
#define KVM_CAP_PPC_MMU_RADIX
#define KVM_CAP_PPC_MMU_HASH_V3
#define KVM_CAP_IMMEDIATE_EXIT
#define KVM_CAP_MIPS_VZ
#define KVM_CAP_MIPS_TE
#define KVM_CAP_MIPS_64BIT
#define KVM_CAP_S390_GS
#define KVM_CAP_S390_AIS
#define KVM_CAP_SPAPR_TCE_VFIO
#define KVM_CAP_X86_DISABLE_EXITS
#define KVM_CAP_ARM_USER_IRQ
#define KVM_CAP_S390_CMMA_MIGRATION
#define KVM_CAP_PPC_FWNMI
#define KVM_CAP_PPC_SMT_POSSIBLE
#define KVM_CAP_HYPERV_SYNIC2
#define KVM_CAP_HYPERV_VP_INDEX
#define KVM_CAP_S390_AIS_MIGRATION
#define KVM_CAP_PPC_GET_CPU_CHAR
#define KVM_CAP_S390_BPB
#define KVM_CAP_GET_MSR_FEATURES
#define KVM_CAP_HYPERV_EVENTFD
#define KVM_CAP_HYPERV_TLBFLUSH
#define KVM_CAP_S390_HPAGE_1M
#define KVM_CAP_NESTED_STATE
#define KVM_CAP_ARM_INJECT_SERROR_ESR
#define KVM_CAP_MSR_PLATFORM_INFO
#define KVM_CAP_PPC_NESTED_HV
#define KVM_CAP_HYPERV_SEND_IPI
#define KVM_CAP_COALESCED_PIO
#define KVM_CAP_HYPERV_ENLIGHTENED_VMCS
#define KVM_CAP_EXCEPTION_PAYLOAD
#define KVM_CAP_ARM_VM_IPA_SIZE
#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT
#define KVM_CAP_HYPERV_CPUID
#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2
#define KVM_CAP_PPC_IRQ_XIVE
#define KVM_CAP_ARM_SVE
#define KVM_CAP_ARM_PTRAUTH_ADDRESS
#define KVM_CAP_ARM_PTRAUTH_GENERIC
#define KVM_CAP_PMU_EVENT_FILTER
#define KVM_CAP_ARM_IRQ_LINE_LAYOUT_2
#define KVM_CAP_HYPERV_DIRECT_TLBFLUSH
#define KVM_CAP_PPC_GUEST_DEBUG_SSTEP
#define KVM_CAP_ARM_NISV_TO_USER
#define KVM_CAP_ARM_INJECT_EXT_DABT
#define KVM_CAP_S390_VCPU_RESETS
#define KVM_CAP_S390_PROTECTED
#define KVM_CAP_PPC_SECURE_GUEST
#define KVM_CAP_HALT_POLL
#define KVM_CAP_ASYNC_PF_INT
#define KVM_CAP_LAST_CPU
#define KVM_CAP_SMALLER_MAXPHYADDR
#define KVM_CAP_S390_DIAG318
#define KVM_CAP_STEAL_TIME
#define KVM_CAP_X86_USER_SPACE_MSR
#define KVM_CAP_X86_MSR_FILTER
#define KVM_CAP_ENFORCE_PV_FEATURE_CPUID
#define KVM_CAP_SYS_HYPERV_CPUID
#define KVM_CAP_DIRTY_LOG_RING
#define KVM_CAP_X86_BUS_LOCK_EXIT
#define KVM_CAP_PPC_DAWR1
#define KVM_CAP_SET_GUEST_DEBUG2
#define KVM_CAP_SGX_ATTRIBUTE
#define KVM_CAP_VM_COPY_ENC_CONTEXT_FROM
#define KVM_CAP_PTP_KVM
#define KVM_CAP_HYPERV_ENFORCE_CPUID
#define KVM_CAP_SREGS2
#define KVM_CAP_EXIT_HYPERCALL
#define KVM_CAP_PPC_RPT_INVALIDATE
#define KVM_CAP_BINARY_STATS_FD
#define KVM_CAP_EXIT_ON_EMULATION_FAILURE
#define KVM_CAP_ARM_MTE
#define KVM_CAP_VM_MOVE_ENC_CONTEXT_FROM
#define KVM_CAP_VM_GPA_BITS
#define KVM_CAP_XSAVE2
#define KVM_CAP_SYS_ATTRIBUTES
#define KVM_CAP_PPC_AIL_MODE_3
#define KVM_CAP_S390_MEM_OP_EXTENSION
#define KVM_CAP_PMU_CAPABILITY
#define KVM_CAP_DISABLE_QUIRKS2
#define KVM_CAP_VM_TSC_CONTROL
#define KVM_CAP_SYSTEM_EVENT_DATA
#define KVM_CAP_ARM_SYSTEM_SUSPEND
#define KVM_CAP_S390_PROTECTED_DUMP
#define KVM_CAP_X86_TRIPLE_FAULT_EVENT
#define KVM_CAP_X86_NOTIFY_VMEXIT
#define KVM_CAP_VM_DISABLE_NX_HUGE_PAGES
#define KVM_CAP_S390_ZPCI_OP
#define KVM_CAP_S390_CPU_TOPOLOGY
#define KVM_CAP_DIRTY_LOG_RING_ACQ_REL
#define KVM_CAP_S390_PROTECTED_ASYNC_DISABLE
#define KVM_CAP_DIRTY_LOG_RING_WITH_BITMAP
#define KVM_CAP_PMU_EVENT_MASKED_EVENTS
#define KVM_CAP_COUNTER_OFFSET
#define KVM_CAP_ARM_EAGER_SPLIT_CHUNK_SIZE
#define KVM_CAP_ARM_SUPPORTED_BLOCK_SIZES
#define KVM_CAP_ARM_SUPPORTED_REG_MASK_RANGES
#define KVM_CAP_USER_MEMORY2
#define KVM_CAP_MEMORY_FAULT_INFO
#define KVM_CAP_MEMORY_ATTRIBUTES
#define KVM_CAP_GUEST_MEMFD
#define KVM_CAP_VM_TYPES
#define KVM_CAP_PRE_FAULT_MEMORY
#define KVM_CAP_X86_APIC_BUS_CYCLES_NS
#define KVM_CAP_X86_GUEST_MODE

struct kvm_irq_routing_irqchip {};

struct kvm_irq_routing_msi {};

struct kvm_irq_routing_s390_adapter {};

struct kvm_irq_routing_hv_sint {};

struct kvm_irq_routing_xen_evtchn {};

#define KVM_IRQ_ROUTING_XEN_EVTCHN_PRIO_2LEVEL

/* gsi routing entry types */
#define KVM_IRQ_ROUTING_IRQCHIP
#define KVM_IRQ_ROUTING_MSI
#define KVM_IRQ_ROUTING_S390_ADAPTER
#define KVM_IRQ_ROUTING_HV_SINT
#define KVM_IRQ_ROUTING_XEN_EVTCHN

struct kvm_irq_routing_entry {};

struct kvm_irq_routing {};

#define KVM_IRQFD_FLAG_DEASSIGN
/*
 * Available with KVM_CAP_IRQFD_RESAMPLE
 *
 * KVM_IRQFD_FLAG_RESAMPLE indicates resamplefd is valid and specifies
 * the irqfd to operate in resampling mode for level triggered interrupt
 * emulation.  See Documentation/virt/kvm/api.rst.
 */
#define KVM_IRQFD_FLAG_RESAMPLE

struct kvm_irqfd {};

/* For KVM_CAP_ADJUST_CLOCK */

/* Do not use 1, KVM_CHECK_EXTENSION returned it before we had flags.  */
#define KVM_CLOCK_TSC_STABLE
#define KVM_CLOCK_REALTIME
#define KVM_CLOCK_HOST_TSC

struct kvm_clock_data {};

/* For KVM_CAP_SW_TLB */

#define KVM_MMU_FSL_BOOKE_NOHV
#define KVM_MMU_FSL_BOOKE_HV

struct kvm_config_tlb {};

struct kvm_dirty_tlb {};

/* Available with KVM_CAP_ONE_REG */

#define KVM_REG_ARCH_MASK
#define KVM_REG_GENERIC

/*
 * Architecture specific registers are to be defined in arch headers and
 * ORed with the arch identifier.
 */
#define KVM_REG_PPC
#define KVM_REG_X86
#define KVM_REG_IA64
#define KVM_REG_ARM
#define KVM_REG_S390
#define KVM_REG_ARM64
#define KVM_REG_MIPS
#define KVM_REG_RISCV
#define KVM_REG_LOONGARCH

#define KVM_REG_SIZE_SHIFT
#define KVM_REG_SIZE_MASK
#define KVM_REG_SIZE_U8
#define KVM_REG_SIZE_U16
#define KVM_REG_SIZE_U32
#define KVM_REG_SIZE_U64
#define KVM_REG_SIZE_U128
#define KVM_REG_SIZE_U256
#define KVM_REG_SIZE_U512
#define KVM_REG_SIZE_U1024
#define KVM_REG_SIZE_U2048

struct kvm_reg_list {};

struct kvm_one_reg {};

#define KVM_MSI_VALID_DEVID
struct kvm_msi {};

struct kvm_arm_device_addr {};

/*
 * Device control API, available with KVM_CAP_DEVICE_CTRL
 */
#define KVM_CREATE_DEVICE_TEST

struct kvm_create_device {};

struct kvm_device_attr {};

#define KVM_DEV_VFIO_FILE

#define KVM_DEV_VFIO_FILE_ADD
#define KVM_DEV_VFIO_FILE_DEL

/* KVM_DEV_VFIO_GROUP aliases are for compile time uapi compatibility */
#define KVM_DEV_VFIO_GROUP

#define KVM_DEV_VFIO_GROUP_ADD
#define KVM_DEV_VFIO_GROUP_DEL
#define KVM_DEV_VFIO_GROUP_SET_SPAPR_TCE

enum kvm_device_type {};

struct kvm_vfio_spapr_tce {};

/*
 * KVM_CREATE_VCPU receives as a parameter the vcpu slot, and returns
 * a vcpu fd.
 */
#define KVM_CREATE_VCPU
#define KVM_GET_DIRTY_LOG
#define KVM_SET_NR_MMU_PAGES
#define KVM_GET_NR_MMU_PAGES
#define KVM_SET_USER_MEMORY_REGION
#define KVM_SET_TSS_ADDR
#define KVM_SET_IDENTITY_MAP_ADDR
#define KVM_SET_USER_MEMORY_REGION2

/* enable ucontrol for s390 */
#define KVM_S390_UCAS_MAP
#define KVM_S390_UCAS_UNMAP
#define KVM_S390_VCPU_FAULT

/* Device model IOC */
#define KVM_CREATE_IRQCHIP
#define KVM_IRQ_LINE
#define KVM_GET_IRQCHIP
#define KVM_SET_IRQCHIP
#define KVM_CREATE_PIT
#define KVM_GET_PIT
#define KVM_SET_PIT
#define KVM_IRQ_LINE_STATUS
#define KVM_REGISTER_COALESCED_MMIO
#define KVM_UNREGISTER_COALESCED_MMIO
#define KVM_SET_GSI_ROUTING
#define KVM_REINJECT_CONTROL
#define KVM_IRQFD
#define KVM_CREATE_PIT2
#define KVM_SET_BOOT_CPU_ID
#define KVM_IOEVENTFD
#define KVM_XEN_HVM_CONFIG
#define KVM_SET_CLOCK
#define KVM_GET_CLOCK
/* Available with KVM_CAP_PIT_STATE2 */
#define KVM_GET_PIT2
#define KVM_SET_PIT2
/* Available with KVM_CAP_PPC_GET_PVINFO */
#define KVM_PPC_GET_PVINFO
/* Available with KVM_CAP_TSC_CONTROL for a vCPU, or with
*  KVM_CAP_VM_TSC_CONTROL to set defaults for a VM */
#define KVM_SET_TSC_KHZ
#define KVM_GET_TSC_KHZ
/* Available with KVM_CAP_SIGNAL_MSI */
#define KVM_SIGNAL_MSI
/* Available with KVM_CAP_PPC_GET_SMMU_INFO */
#define KVM_PPC_GET_SMMU_INFO
/* Available with KVM_CAP_PPC_ALLOC_HTAB */
#define KVM_PPC_ALLOCATE_HTAB
#define KVM_CREATE_SPAPR_TCE
#define KVM_CREATE_SPAPR_TCE_64
/* Available with KVM_CAP_RMA */
#define KVM_ALLOCATE_RMA
/* Available with KVM_CAP_PPC_HTAB_FD */
#define KVM_PPC_GET_HTAB_FD
/* Available with KVM_CAP_ARM_SET_DEVICE_ADDR */
#define KVM_ARM_SET_DEVICE_ADDR
/* Available with KVM_CAP_PPC_RTAS */
#define KVM_PPC_RTAS_DEFINE_TOKEN
/* Available with KVM_CAP_SPAPR_RESIZE_HPT */
#define KVM_PPC_RESIZE_HPT_PREPARE
#define KVM_PPC_RESIZE_HPT_COMMIT
/* Available with KVM_CAP_PPC_MMU_RADIX or KVM_CAP_PPC_MMU_HASH_V3 */
#define KVM_PPC_CONFIGURE_V3_MMU
/* Available with KVM_CAP_PPC_MMU_RADIX */
#define KVM_PPC_GET_RMMU_INFO
/* Available with KVM_CAP_PPC_GET_CPU_CHAR */
#define KVM_PPC_GET_CPU_CHAR
/* Available with KVM_CAP_PMU_EVENT_FILTER */
#define KVM_SET_PMU_EVENT_FILTER
#define KVM_PPC_SVM_OFF
#define KVM_ARM_MTE_COPY_TAGS
/* Available with KVM_CAP_COUNTER_OFFSET */
#define KVM_ARM_SET_COUNTER_OFFSET
#define KVM_ARM_GET_REG_WRITABLE_MASKS

/* ioctl for vm fd */
#define KVM_CREATE_DEVICE

/* ioctls for fds returned by KVM_CREATE_DEVICE */
#define KVM_SET_DEVICE_ATTR
#define KVM_GET_DEVICE_ATTR
#define KVM_HAS_DEVICE_ATTR

/*
 * ioctls for vcpu fds
 */
#define KVM_RUN
#define KVM_GET_REGS
#define KVM_SET_REGS
#define KVM_GET_SREGS
#define KVM_SET_SREGS
#define KVM_TRANSLATE
#define KVM_INTERRUPT
#define KVM_GET_MSRS
#define KVM_SET_MSRS
#define KVM_SET_CPUID
#define KVM_SET_SIGNAL_MASK
#define KVM_GET_FPU
#define KVM_SET_FPU
#define KVM_GET_LAPIC
#define KVM_SET_LAPIC
#define KVM_SET_CPUID2
#define KVM_GET_CPUID2
/* Available with KVM_CAP_VAPIC */
#define KVM_TPR_ACCESS_REPORTING
/* Available with KVM_CAP_VAPIC */
#define KVM_SET_VAPIC_ADDR
/* valid for virtual machine (for floating interrupt)_and_ vcpu */
#define KVM_S390_INTERRUPT
/* store status for s390 */
#define KVM_S390_STORE_STATUS_NOADDR
#define KVM_S390_STORE_STATUS_PREFIXED
#define KVM_S390_STORE_STATUS
/* initial ipl psw for s390 */
#define KVM_S390_SET_INITIAL_PSW
/* initial reset for s390 */
#define KVM_S390_INITIAL_RESET
#define KVM_GET_MP_STATE
#define KVM_SET_MP_STATE
/* Available with KVM_CAP_USER_NMI */
#define KVM_NMI
/* Available with KVM_CAP_SET_GUEST_DEBUG */
#define KVM_SET_GUEST_DEBUG
/* MCE for x86 */
#define KVM_X86_SETUP_MCE
#define KVM_X86_GET_MCE_CAP_SUPPORTED
#define KVM_X86_SET_MCE
/* Available with KVM_CAP_VCPU_EVENTS */
#define KVM_GET_VCPU_EVENTS
#define KVM_SET_VCPU_EVENTS
/* Available with KVM_CAP_DEBUGREGS */
#define KVM_GET_DEBUGREGS
#define KVM_SET_DEBUGREGS
/*
 * vcpu version available with KVM_CAP_ENABLE_CAP
 * vm version available with KVM_CAP_ENABLE_CAP_VM
 */
#define KVM_ENABLE_CAP
/* Available with KVM_CAP_XSAVE */
#define KVM_GET_XSAVE
#define KVM_SET_XSAVE
/* Available with KVM_CAP_XCRS */
#define KVM_GET_XCRS
#define KVM_SET_XCRS
/* Available with KVM_CAP_SW_TLB */
#define KVM_DIRTY_TLB
/* Available with KVM_CAP_ONE_REG */
#define KVM_GET_ONE_REG
#define KVM_SET_ONE_REG
/* VM is being stopped by host */
#define KVM_KVMCLOCK_CTRL
#define KVM_ARM_VCPU_INIT
#define KVM_ARM_PREFERRED_TARGET
#define KVM_GET_REG_LIST
/* Available with KVM_CAP_S390_MEM_OP */
#define KVM_S390_MEM_OP
/* Available with KVM_CAP_S390_SKEYS */
#define KVM_S390_GET_SKEYS
#define KVM_S390_SET_SKEYS
/* Available with KVM_CAP_S390_INJECT_IRQ */
#define KVM_S390_IRQ
/* Available with KVM_CAP_S390_IRQ_STATE */
#define KVM_S390_SET_IRQ_STATE
#define KVM_S390_GET_IRQ_STATE
/* Available with KVM_CAP_X86_SMM */
#define KVM_SMI
/* Available with KVM_CAP_S390_CMMA_MIGRATION */
#define KVM_S390_GET_CMMA_BITS
#define KVM_S390_SET_CMMA_BITS
/* Memory Encryption Commands */
#define KVM_MEMORY_ENCRYPT_OP

struct kvm_enc_region {};

#define KVM_MEMORY_ENCRYPT_REG_REGION
#define KVM_MEMORY_ENCRYPT_UNREG_REGION

/* Available with KVM_CAP_HYPERV_EVENTFD */
#define KVM_HYPERV_EVENTFD

/* Available with KVM_CAP_NESTED_STATE */
#define KVM_GET_NESTED_STATE
#define KVM_SET_NESTED_STATE

/* Available with KVM_CAP_MANUAL_DIRTY_LOG_PROTECT_2 */
#define KVM_CLEAR_DIRTY_LOG

/* Available with KVM_CAP_HYPERV_CPUID (vcpu) / KVM_CAP_SYS_HYPERV_CPUID (system) */
#define KVM_GET_SUPPORTED_HV_CPUID

/* Available with KVM_CAP_ARM_SVE */
#define KVM_ARM_VCPU_FINALIZE

/* Available with  KVM_CAP_S390_VCPU_RESETS */
#define KVM_S390_NORMAL_RESET
#define KVM_S390_CLEAR_RESET

/* Available with KVM_CAP_S390_PROTECTED */
#define KVM_S390_PV_COMMAND

/* Available with KVM_CAP_X86_MSR_FILTER */
#define KVM_X86_SET_MSR_FILTER

/* Available with KVM_CAP_DIRTY_LOG_RING */
#define KVM_RESET_DIRTY_RINGS

/* Per-VM Xen attributes */
#define KVM_XEN_HVM_GET_ATTR
#define KVM_XEN_HVM_SET_ATTR

/* Per-vCPU Xen attributes */
#define KVM_XEN_VCPU_GET_ATTR
#define KVM_XEN_VCPU_SET_ATTR

/* Available with KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_EVTCHN_SEND */
#define KVM_XEN_HVM_EVTCHN_SEND

#define KVM_GET_SREGS2
#define KVM_SET_SREGS2

#define KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE
#define KVM_DIRTY_LOG_INITIALLY_SET

/*
 * Arch needs to define the macro after implementing the dirty ring
 * feature.  KVM_DIRTY_LOG_PAGE_OFFSET should be defined as the
 * starting page offset of the dirty ring structures.
 */
#ifndef KVM_DIRTY_LOG_PAGE_OFFSET
#define KVM_DIRTY_LOG_PAGE_OFFSET
#endif

/*
 * KVM dirty GFN flags, defined as:
 *
 * |---------------+---------------+--------------|
 * | bit 1 (reset) | bit 0 (dirty) | Status       |
 * |---------------+---------------+--------------|
 * |             0 |             0 | Invalid GFN  |
 * |             0 |             1 | Dirty GFN    |
 * |             1 |             X | GFN to reset |
 * |---------------+---------------+--------------|
 *
 * Lifecycle of a dirty GFN goes like:
 *
 *      dirtied         harvested        reset
 * 00 -----------> 01 -------------> 1X -------+
 *  ^                                          |
 *  |                                          |
 *  +------------------------------------------+
 *
 * The userspace program is only responsible for the 01->1X state
 * conversion after harvesting an entry.  Also, it must not skip any
 * dirty bits, so that dirty bits are always harvested in sequence.
 */
#define KVM_DIRTY_GFN_F_DIRTY
#define KVM_DIRTY_GFN_F_RESET
#define KVM_DIRTY_GFN_F_MASK

/*
 * KVM dirty rings should be mapped at KVM_DIRTY_LOG_PAGE_OFFSET of
 * per-vcpu mmaped regions as an array of struct kvm_dirty_gfn.  The
 * size of the gfn buffer is decided by the first argument when
 * enabling KVM_CAP_DIRTY_LOG_RING.
 */
struct kvm_dirty_gfn {};

#define KVM_BUS_LOCK_DETECTION_OFF
#define KVM_BUS_LOCK_DETECTION_EXIT

#define KVM_PMU_CAP_DISABLE

/**
 * struct kvm_stats_header - Header of per vm/vcpu binary statistics data.
 * @flags: Some extra information for header, always 0 for now.
 * @name_size: The size in bytes of the memory which contains statistics
 *             name string including trailing '\0'. The memory is allocated
 *             at the send of statistics descriptor.
 * @num_desc: The number of statistics the vm or vcpu has.
 * @id_offset: The offset of the vm/vcpu stats' id string in the file pointed
 *             by vm/vcpu stats fd.
 * @desc_offset: The offset of the vm/vcpu stats' descriptor block in the file
 *               pointd by vm/vcpu stats fd.
 * @data_offset: The offset of the vm/vcpu stats' data block in the file
 *               pointed by vm/vcpu stats fd.
 *
 * This is the header userspace needs to read from stats fd before any other
 * readings. It is used by userspace to discover all the information about the
 * vm/vcpu's binary statistics.
 * Userspace reads this header from the start of the vm/vcpu's stats fd.
 */
struct kvm_stats_header {};

#define KVM_STATS_TYPE_SHIFT
#define KVM_STATS_TYPE_MASK
#define KVM_STATS_TYPE_CUMULATIVE
#define KVM_STATS_TYPE_INSTANT
#define KVM_STATS_TYPE_PEAK
#define KVM_STATS_TYPE_LINEAR_HIST
#define KVM_STATS_TYPE_LOG_HIST
#define KVM_STATS_TYPE_MAX

#define KVM_STATS_UNIT_SHIFT
#define KVM_STATS_UNIT_MASK
#define KVM_STATS_UNIT_NONE
#define KVM_STATS_UNIT_BYTES
#define KVM_STATS_UNIT_SECONDS
#define KVM_STATS_UNIT_CYCLES
#define KVM_STATS_UNIT_BOOLEAN
#define KVM_STATS_UNIT_MAX

#define KVM_STATS_BASE_SHIFT
#define KVM_STATS_BASE_MASK
#define KVM_STATS_BASE_POW10
#define KVM_STATS_BASE_POW2
#define KVM_STATS_BASE_MAX

/**
 * struct kvm_stats_desc - Descriptor of a KVM statistics.
 * @flags: Annotations of the stats, like type, unit, etc.
 * @exponent: Used together with @flags to determine the unit.
 * @size: The number of data items for this stats.
 *        Every data item is of type __u64.
 * @offset: The offset of the stats to the start of stat structure in
 *          structure kvm or kvm_vcpu.
 * @bucket_size: A parameter value used for histogram stats. It is only used
 *		for linear histogram stats, specifying the size of the bucket;
 * @name: The name string for the stats. Its size is indicated by the
 *        &kvm_stats_header->name_size.
 */
struct kvm_stats_desc {};

#define KVM_GET_STATS_FD

/* Available with KVM_CAP_XSAVE2 */
#define KVM_GET_XSAVE2

/* Available with KVM_CAP_S390_PROTECTED_DUMP */
#define KVM_S390_PV_CPU_COMMAND

/* Available with KVM_CAP_X86_NOTIFY_VMEXIT */
#define KVM_X86_NOTIFY_VMEXIT_ENABLED
#define KVM_X86_NOTIFY_VMEXIT_USER

/* Available with KVM_CAP_S390_ZPCI_OP */
#define KVM_S390_ZPCI_OP

/* Available with KVM_CAP_MEMORY_ATTRIBUTES */
#define KVM_SET_MEMORY_ATTRIBUTES

struct kvm_memory_attributes {};

#define KVM_MEMORY_ATTRIBUTE_PRIVATE

#define KVM_CREATE_GUEST_MEMFD

struct kvm_create_guest_memfd {};

#define KVM_PRE_FAULT_MEMORY

struct kvm_pre_fault_memory {};

#endif /* __LINUX_KVM_H */