linux/arch/x86/include/uapi/asm/kvm.h

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

/*
 * KVM x86 specific structures and definitions
 *
 */

#include <linux/const.h>
#include <linux/bits.h>
#include <linux/types.h>
#include <linux/ioctl.h>
#include <linux/stddef.h>

#define KVM_PIO_PAGE_OFFSET
#define KVM_COALESCED_MMIO_PAGE_OFFSET
#define KVM_DIRTY_LOG_PAGE_OFFSET

#define DE_VECTOR
#define DB_VECTOR
#define BP_VECTOR
#define OF_VECTOR
#define BR_VECTOR
#define UD_VECTOR
#define NM_VECTOR
#define DF_VECTOR
#define TS_VECTOR
#define NP_VECTOR
#define SS_VECTOR
#define GP_VECTOR
#define PF_VECTOR
#define MF_VECTOR
#define AC_VECTOR
#define MC_VECTOR
#define XM_VECTOR
#define VE_VECTOR

/* Select x86 specific features in <linux/kvm.h> */
#define __KVM_HAVE_PIT
#define __KVM_HAVE_IOAPIC
#define __KVM_HAVE_IRQ_LINE
#define __KVM_HAVE_MSI
#define __KVM_HAVE_USER_NMI
#define __KVM_HAVE_MSIX
#define __KVM_HAVE_MCE
#define __KVM_HAVE_PIT_STATE2
#define __KVM_HAVE_XEN_HVM
#define __KVM_HAVE_VCPU_EVENTS
#define __KVM_HAVE_DEBUGREGS
#define __KVM_HAVE_XSAVE
#define __KVM_HAVE_XCRS

/* Architectural interrupt line count. */
#define KVM_NR_INTERRUPTS

/* for KVM_GET_IRQCHIP and KVM_SET_IRQCHIP */
struct kvm_pic_state {};

#define KVM_IOAPIC_NUM_PINS
struct kvm_ioapic_state {};

#define KVM_IRQCHIP_PIC_MASTER
#define KVM_IRQCHIP_PIC_SLAVE
#define KVM_IRQCHIP_IOAPIC
#define KVM_NR_IRQCHIPS

#define KVM_RUN_X86_SMM
#define KVM_RUN_X86_BUS_LOCK
#define KVM_RUN_X86_GUEST_MODE

/* for KVM_GET_REGS and KVM_SET_REGS */
struct kvm_regs {};

/* for KVM_GET_LAPIC and KVM_SET_LAPIC */
#define KVM_APIC_REG_SIZE
struct kvm_lapic_state {};

struct kvm_segment {};

struct kvm_dtable {};


/* for KVM_GET_SREGS and KVM_SET_SREGS */
struct kvm_sregs {};

struct kvm_sregs2 {};
#define KVM_SREGS2_FLAGS_PDPTRS_VALID

/* for KVM_GET_FPU and KVM_SET_FPU */
struct kvm_fpu {};

struct kvm_msr_entry {};

/* for KVM_GET_MSRS and KVM_SET_MSRS */
struct kvm_msrs {};

/* for KVM_GET_MSR_INDEX_LIST */
struct kvm_msr_list {};

/* Maximum size of any access bitmap in bytes */
#define KVM_MSR_FILTER_MAX_BITMAP_SIZE

/* for KVM_X86_SET_MSR_FILTER */
struct kvm_msr_filter_range {};

#define KVM_MSR_FILTER_MAX_RANGES
struct kvm_msr_filter {};

struct kvm_cpuid_entry {};

/* for KVM_SET_CPUID */
struct kvm_cpuid {};

struct kvm_cpuid_entry2 {};

#define KVM_CPUID_FLAG_SIGNIFCANT_INDEX
#define KVM_CPUID_FLAG_STATEFUL_FUNC
#define KVM_CPUID_FLAG_STATE_READ_NEXT

/* for KVM_SET_CPUID2 */
struct kvm_cpuid2 {};

/* for KVM_GET_PIT and KVM_SET_PIT */
struct kvm_pit_channel_state {};

struct kvm_debug_exit_arch {};

#define KVM_GUESTDBG_USE_SW_BP
#define KVM_GUESTDBG_USE_HW_BP
#define KVM_GUESTDBG_INJECT_DB
#define KVM_GUESTDBG_INJECT_BP
#define KVM_GUESTDBG_BLOCKIRQ

/* for KVM_SET_GUEST_DEBUG */
struct kvm_guest_debug_arch {};

struct kvm_pit_state {};

#define KVM_PIT_FLAGS_HPET_LEGACY
#define KVM_PIT_FLAGS_SPEAKER_DATA_ON

struct kvm_pit_state2 {};

struct kvm_reinject_control {};

/* When set in flags, include corresponding fields on KVM_SET_VCPU_EVENTS */
#define KVM_VCPUEVENT_VALID_NMI_PENDING
#define KVM_VCPUEVENT_VALID_SIPI_VECTOR
#define KVM_VCPUEVENT_VALID_SHADOW
#define KVM_VCPUEVENT_VALID_SMM
#define KVM_VCPUEVENT_VALID_PAYLOAD
#define KVM_VCPUEVENT_VALID_TRIPLE_FAULT

/* Interrupt shadow states */
#define KVM_X86_SHADOW_INT_MOV_SS
#define KVM_X86_SHADOW_INT_STI

/* for KVM_GET/SET_VCPU_EVENTS */
struct kvm_vcpu_events {};

/* for KVM_GET/SET_DEBUGREGS */
struct kvm_debugregs {};

/* for KVM_CAP_XSAVE and KVM_CAP_XSAVE2 */
struct kvm_xsave {};

#define KVM_MAX_XCRS

struct kvm_xcr {};

struct kvm_xcrs {};

#define KVM_SYNC_X86_REGS
#define KVM_SYNC_X86_SREGS
#define KVM_SYNC_X86_EVENTS

#define KVM_SYNC_X86_VALID_FIELDS

/* kvm_sync_regs struct included by kvm_run struct */
struct kvm_sync_regs {};

#define KVM_X86_QUIRK_LINT0_REENABLED
#define KVM_X86_QUIRK_CD_NW_CLEARED
#define KVM_X86_QUIRK_LAPIC_MMIO_HOLE
#define KVM_X86_QUIRK_OUT_7E_INC_RIP
#define KVM_X86_QUIRK_MISC_ENABLE_NO_MWAIT
#define KVM_X86_QUIRK_FIX_HYPERCALL_INSN
#define KVM_X86_QUIRK_MWAIT_NEVER_UD_FAULTS

#define KVM_STATE_NESTED_FORMAT_VMX
#define KVM_STATE_NESTED_FORMAT_SVM

#define KVM_STATE_NESTED_GUEST_MODE
#define KVM_STATE_NESTED_RUN_PENDING
#define KVM_STATE_NESTED_EVMCS
#define KVM_STATE_NESTED_MTF_PENDING
#define KVM_STATE_NESTED_GIF_SET

#define KVM_STATE_NESTED_SMM_GUEST_MODE
#define KVM_STATE_NESTED_SMM_VMXON

#define KVM_STATE_NESTED_VMX_VMCS_SIZE

#define KVM_STATE_NESTED_SVM_VMCB_SIZE

#define KVM_STATE_VMX_PREEMPTION_TIMER_DEADLINE

/* vendor-independent attributes for system fd (group 0) */
#define KVM_X86_GRP_SYSTEM
#define KVM_X86_XCOMP_GUEST_SUPP

/* vendor-specific groups and attributes for system fd */
#define KVM_X86_GRP_SEV
#define KVM_X86_SEV_VMSA_FEATURES

struct kvm_vmx_nested_state_data {};

struct kvm_vmx_nested_state_hdr {};

struct kvm_svm_nested_state_data {};

struct kvm_svm_nested_state_hdr {};

/* for KVM_CAP_NESTED_STATE */
struct kvm_nested_state {};

/* for KVM_CAP_PMU_EVENT_FILTER */
struct kvm_pmu_event_filter {};

#define KVM_PMU_EVENT_ALLOW
#define KVM_PMU_EVENT_DENY

#define KVM_PMU_EVENT_FLAG_MASKED_EVENTS
#define KVM_PMU_EVENT_FLAGS_VALID_MASK

/* for KVM_CAP_MCE */
struct kvm_x86_mce {};

/* for KVM_CAP_XEN_HVM */
#define KVM_XEN_HVM_CONFIG_HYPERCALL_MSR
#define KVM_XEN_HVM_CONFIG_INTERCEPT_HCALL
#define KVM_XEN_HVM_CONFIG_SHARED_INFO
#define KVM_XEN_HVM_CONFIG_RUNSTATE
#define KVM_XEN_HVM_CONFIG_EVTCHN_2LEVEL
#define KVM_XEN_HVM_CONFIG_EVTCHN_SEND
#define KVM_XEN_HVM_CONFIG_RUNSTATE_UPDATE_FLAG
#define KVM_XEN_HVM_CONFIG_PVCLOCK_TSC_UNSTABLE
#define KVM_XEN_HVM_CONFIG_SHARED_INFO_HVA

struct kvm_xen_hvm_config {};

struct kvm_xen_hvm_attr {};


/* Available with KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_SHARED_INFO */
#define KVM_XEN_ATTR_TYPE_LONG_MODE
#define KVM_XEN_ATTR_TYPE_SHARED_INFO
#define KVM_XEN_ATTR_TYPE_UPCALL_VECTOR
/* Available with KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_EVTCHN_SEND */
#define KVM_XEN_ATTR_TYPE_EVTCHN
#define KVM_XEN_ATTR_TYPE_XEN_VERSION
/* Available with KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_RUNSTATE_UPDATE_FLAG */
#define KVM_XEN_ATTR_TYPE_RUNSTATE_UPDATE_FLAG
/* Available with KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_SHARED_INFO_HVA */
#define KVM_XEN_ATTR_TYPE_SHARED_INFO_HVA

struct kvm_xen_vcpu_attr {};

/* Available with KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_SHARED_INFO */
#define KVM_XEN_VCPU_ATTR_TYPE_VCPU_INFO
#define KVM_XEN_VCPU_ATTR_TYPE_VCPU_TIME_INFO
#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADDR
#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_CURRENT
#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_DATA
#define KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADJUST
/* Available with KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_EVTCHN_SEND */
#define KVM_XEN_VCPU_ATTR_TYPE_VCPU_ID
#define KVM_XEN_VCPU_ATTR_TYPE_TIMER
#define KVM_XEN_VCPU_ATTR_TYPE_UPCALL_VECTOR
/* Available with KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_SHARED_INFO_HVA */
#define KVM_XEN_VCPU_ATTR_TYPE_VCPU_INFO_HVA

/* Secure Encrypted Virtualization command */
enum sev_cmd_id {};

struct kvm_sev_cmd {};

struct kvm_sev_init {};

struct kvm_sev_launch_start {};

struct kvm_sev_launch_update_data {};


struct kvm_sev_launch_secret {};

struct kvm_sev_launch_measure {};

struct kvm_sev_guest_status {};

struct kvm_sev_dbg {};

struct kvm_sev_attestation_report {};

struct kvm_sev_send_start {};

struct kvm_sev_send_update_data {};

struct kvm_sev_receive_start {};

struct kvm_sev_receive_update_data {};

struct kvm_sev_snp_launch_start {};

/* Kept in sync with firmware values for simplicity. */
#define KVM_SEV_SNP_PAGE_TYPE_NORMAL
#define KVM_SEV_SNP_PAGE_TYPE_ZERO
#define KVM_SEV_SNP_PAGE_TYPE_UNMEASURED
#define KVM_SEV_SNP_PAGE_TYPE_SECRETS
#define KVM_SEV_SNP_PAGE_TYPE_CPUID

struct kvm_sev_snp_launch_update {};

#define KVM_SEV_SNP_ID_BLOCK_SIZE
#define KVM_SEV_SNP_ID_AUTH_SIZE
#define KVM_SEV_SNP_FINISH_DATA_SIZE

struct kvm_sev_snp_launch_finish {};

#define KVM_X2APIC_API_USE_32BIT_IDS
#define KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK

struct kvm_hyperv_eventfd {};

#define KVM_HYPERV_CONN_ID_MASK
#define KVM_HYPERV_EVENTFD_DEASSIGN

/*
 * Masked event layout.
 * Bits   Description
 * ----   -----------
 * 7:0    event select (low bits)
 * 15:8   umask match
 * 31:16  unused
 * 35:32  event select (high bits)
 * 36:54  unused
 * 55     exclude bit
 * 63:56  umask mask
 */

#define KVM_PMU_ENCODE_MASKED_ENTRY(event_select, mask, match, exclude)

#define KVM_PMU_MASKED_ENTRY_EVENT_SELECT
#define KVM_PMU_MASKED_ENTRY_UMASK_MASK
#define KVM_PMU_MASKED_ENTRY_UMASK_MATCH
#define KVM_PMU_MASKED_ENTRY_EXCLUDE
#define KVM_PMU_MASKED_ENTRY_UMASK_MASK_SHIFT

/* for KVM_{GET,SET,HAS}_DEVICE_ATTR */
#define KVM_VCPU_TSC_CTRL
#define KVM_VCPU_TSC_OFFSET

/* x86-specific KVM_EXIT_HYPERCALL flags. */
#define KVM_EXIT_HYPERCALL_LONG_MODE

#define KVM_X86_DEFAULT_VM
#define KVM_X86_SW_PROTECTED_VM
#define KVM_X86_SEV_VM
#define KVM_X86_SEV_ES_VM
#define KVM_X86_SNP_VM

#endif /* _ASM_X86_KVM_H */