Lines Matching +full:max +full:- +full:outbound +full:- +full:regions

1 .. SPDX-License-Identifier: GPL-2.0
4 The Definitive KVM (Kernel-based Virtual Machine) API Documentation
13 - System ioctls: These query and set global attributes which affect the
17 - VM ioctls: These query and set attributes that affect an entire virtual
24 - vcpu ioctls: These query and set attributes that control the operation
32 - device ioctls: These query and set attributes that control the operation
80 facility that allows backward-compatible extensions to the API to be
104 the ioctl returns -ENOTTY.
122 -----------------------
139 -----------------
159 address used by the VM. The IPA_Bits is encoded in bits[7-0] of the
177 ioctl() at run-time.
189 ----------------------------------------------------------
195 :Returns: 0 on success; -1 on error
231 -----------------------
250 --------------------------
263 the VCPU file descriptor can be mmap-ed, including:
265 - if KVM_CAP_COALESCED_MMIO is available, a page at
270 - if KVM_CAP_DIRTY_LOG_RING is available, a number of pages at
276 -------------------
282 :Returns: vcpu fd on success, -1 on error
288 the KVM_CHECK_EXTENSION ioctl() at run-time.
290 KVM_CAP_MAX_VCPUS of the KVM_CHECK_EXTENSION ioctl() at run-time.
293 cpus max.
298 KVM_CAP_MAX_VCPU_ID of the KVM_CHECK_EXTENSION ioctl() at run-time.
313 single-threaded guest vcpus, it should make all vcpu ids be a multiple
323 --------------------------------
329 :Returns: 0 on success, -1 on error
348 If KVM_CAP_MULTI_ADDRESS_SPACE is available, bits 16-31 of slot field specifies
361 ------------
367 :Returns: 0 on success, -1 on error
388 -----------------
394 :Returns: 0 on success, -1 on error
421 -----------------
427 :Returns: 0 on success, -1 on error
435 ------------------
441 :Returns: 0 on success, -1 on error
458 /* ppc -- see arch/powerpc/include/uapi/asm/kvm.h */
466 ------------------
472 :Returns: 0 on success, -1 on error
479 ------------------
485 :Returns: 0 on success, -1 on error
506 ------------------
531 -EEXIST if an interrupt is already enqueued
532 -EINVAL the irq number is invalid
533 -ENXIO if the PIC is in the kernel
534 -EFAULT if the pointer is invalid
538 ioctl is useful if the in-kernel PIC is not used.
578 RISC-V:
597 --------------------
603 :Returns: -1 on error
609 -----------------
616 -1 on error
619 Reads the values of MSR-based features that are available for the VM. This
621 The list of msr-based features can be obtained using KVM_GET_MSR_FEATURE_INDEX_LIST
625 Reads model-specific registers from the vcpu. Supported msr indices can
649 -----------------
655 :Returns: number of msrs successfully set (see below), -1 on error
657 Writes model-specific registers to the vcpu. See KVM_GET_MSRS for the
671 ------------------
677 :Returns: 0 on success, -1 on error
683 - If this IOCTL fails, KVM gives no guarantees that previous valid CPUID
686 - Using KVM_SET_CPUID{,2} after KVM_RUN, i.e. changing the guest vCPU model
688 - Using heterogeneous CPUID configurations, modulo APIC IDs, topology, etc...
711 ------------------------
717 :Returns: 0 on success, -1 on error
722 their traditional behaviour) will cause KVM_RUN to return with -EINTR.
737 ----------------
743 :Returns: 0 on success, -1 on error
766 ----------------
772 :Returns: 0 on success, -1 on error
795 -----------------------
801 :Returns: 0 on success, -1 on error
805 future vcpus to have a local APIC. IRQ routing for GSIs 0-15 is set to both
806 PIC and IOAPIC; GSI 16-23 only go to the IOAPIC.
817 -----------------
823 :Returns: 0 on success, -1 on error
827 been previously created with KVM_CREATE_IRQCHIP. Note that edge-triggered
830 On real hardware, interrupt pins can be active-low or active-high. This
835 (active-low/active-high) for level-triggered interrupts, and KVM used
837 active-low interrupts, the above convention is now valid on x86 too.
839 should not present interrupts to the guest as active-low unless this
840 capability is present (or unless it is not using the in-kernel irqchip,
845 in-kernel irqchip (GIC), and for in-kernel irqchip can tell the GIC to
854 - irq_type[0]:
855 out-of-kernel GIC: irq_id 0 is IRQ, irq_id 1 is FIQ
856 - irq_type[1]:
857 in-kernel GIC: SPI, irq_id between 32 and 1019 (incl.)
859 - irq_type[2]:
860 in-kernel GIC: PPI, irq_id between 16 and 31 (incl.)
871 injection of interrupts for the in-kernel irqchip. KVM_IRQ_LINE can always
886 --------------------
892 :Returns: 0 on success, -1 on error
911 --------------------
917 :Returns: 0 on success, -1 on error
936 -----------------------
942 :Returns: 0 on success, -1 on error
947 page of a blob (32- or 64-bit, depending on the vcpu mode) to guest
982 ------------------
988 :Returns: 0 on success, -1 on error
1032 ------------------
1038 :Returns: 0 on success, -1 on error
1067 ------------------------
1074 :Returns: 0 on success, -1 on error
1119 - KVM_VCPUEVENT_VALID_SHADOW may be set to signal that
1122 - KVM_VCPUEVENT_VALID_SMM may be set to signal that smi contains a
1125 - KVM_VCPUEVENT_VALID_PAYLOAD may be set to signal that the
1130 - KVM_VCPUEVENT_VALID_TRIPLE_FAULT may be set to signal that the
1149 guest-visible registers. It is not possible to 'cancel' an SError that has been
1152 A device being emulated in user-space may also wish to generate an SError. To do
1153 this the events structure can be populated by user-space. The current state
1162 always have a non-zero value when read, and the agent making an SError pending
1164 the system supports KVM_CAP_ARM_INJECT_SERROR_ESR, but user-space sets the events
1168 -EINVAL. Setting anything other than the lower 24bits of exception.serror_esr
1169 will return -EINVAL.
1190 ------------------------
1197 :Returns: 0 on success, -1 on error
1210 suppress overwriting the current in-kernel state. The bits are:
1215 KVM_VCPUEVENT_VALID_SMM transfer the smi sub-struct.
1257 ----------------------
1263 :Returns: 0 on success, -1 on error
1279 ----------------------
1285 :Returns: 0 on success, -1 on error
1294 -------------------------------
1300 :Returns: 0 on success, -1 on error
1317 memory slot. Bits 0-15 of "slot" specify the slot id and this value
1322 If KVM_CAP_MULTI_ADDRESS_SPACE is available, bits 16-31 of "slot"
1349 to make a new slot read-only. In this case, writes to this memory will be
1357 Note: On arm64, a write generated by the page-table walker (to update
1361 page-table walker, making it impossible to emulate the access.
1362 Instead, an abort (data abort if the cause of the page-table update
1367 ---------------------
1373 :Returns: 0 on success, -1 on error
1375 This ioctl defines the physical address of a three-page region in the guest
1381 This ioctl is required on Intel-based hosts. This is needed on Intel hardware
1387 -------------------
1393 :Returns: 0 on success; -1 on error
1399 :Returns: 0 on success; -1 on error
1438 The vcpu ioctl should be used for vcpu-specific capabilities, the vm ioctl
1439 for vm-wide capabilities.
1442 ---------------------
1448 :Returns: 0 on success; -1 on error
1483 in-kernel irqchip, the multiprocessing state must be maintained by userspace on
1520 ---------------------
1526 :Returns: 0 on success; -1 on error
1532 in-kernel irqchip, the multiprocessing state must be maintained by userspace on
1542 ------------------------------
1548 :Returns: 0 on success, -1 on error
1550 This ioctl defines the physical address of a one-page region in the guest
1559 This ioctl is required on Intel-based hosts. This is needed on Intel hardware
1566 ------------------------
1572 :Returns: 0 on success, -1 on error
1581 ------------------
1587 :Returns: 0 on success, -1 on error
1601 ------------------
1607 :Returns: 0 on success, -1 on error
1629 -----------------
1635 :Returns: 0 on success, -1 on error
1656 -----------------
1662 :Returns: 0 on success, -1 on error
1683 ----------------------------
1689 :Returns: 0 on success, -1 on error
1722 Dynamically-enabled feature bits need to be requested with
1732 with the 'nent' field indicating the number of entries in the variable-size
1772 -----------------------
1802 ------------------------
1808 :Returns: 0 on success, -1 on error
1814 - GSI routing does not apply to KVM_IRQ_LINE but only to KVM_IRQFD.
1852 - KVM_MSI_VALID_DEVID: used along with KVM_IRQ_ROUTING_MSI routing entry
1853 type, specifies that the devid field contains a valid value. The per-VM
1857 - zero otherwise
1882 address_hi bits 31-8 provide bits 31-8 of the destination id. Bits 7-0 of
1916 --------------------
1922 :Returns: 0 on success, -1 on error
1932 --------------------
1938 :Returns: virtual tsc-khz on success, negative value on error
1941 KHz. If the host has unstable tsc this ioctl returns -EIO instead as an
1946 ------------------
1952 :Returns: 0 on success, -1 on error
1967 the APIC_ID register (bytes 32-35). xAPIC only allows an 8-bit APIC ID
1968 which is stored in bits 31-24 of the APIC register, or equivalently in
1977 ------------------
1983 :Returns: 0 on success, -1 on error
1995 The format of the APIC ID register (bytes 32-35 of struct kvm_lapic_state's
2001 ------------------
2024 For the special case of virtio-ccw devices on s390, the ioevent is matched
2038 For virtio-ccw devices, addr contains the subchannel id and datamatch the
2047 ------------------
2053 :Returns: 0 on success, -1 on error
2073 The array is little-endian: the bit 0 is the least significant bit of the
2083 -------------------------
2092 is an IOMMU for PAPR-style virtual I/O. It is used to translate
2106 which this TCE table will translate - the table will contain one 64
2116 the entries written by kernel-handled H_PUT_TCE calls, and also lets
2122 ---------------------
2131 time by the kernel. An RMA is a physically-contiguous, aligned region
2133 will be accessed by real-mode (MMU off) accesses in a KVM guest.
2158 ------------
2164 :Returns: 0 on success, -1 on error
2174 - pause the vcpu
2175 - read the local APIC's state (KVM_GET_LAPIC)
2176 - check whether changing LINT1 will queue an NMI (see the LVT entry for LINT1)
2177 - if so, issue KVM_NMI
2178 - resume the vcpu
2185 ----------------------
2207 ------------------------
2229 ------------------------
2247 --------------------
2487 ARM 32-bit CP15 registers have the following id bit patterns::
2491 ARM 64-bit CP15 registers have the following id bit patterns::
2499 ARM 32-bit VFP control registers have the following id bit patterns::
2503 ARM 64-bit FP registers have the following id bit patterns::
2507 ARM firmware pseudo-registers have the following bit pattern::
2515 arm64 core/FP-SIMD registers have the following id bit patterns. Note
2549 .. [1] These encodings are not accepted for SVE-enabled vcpus. See
2574 arm64 firmware pseudo-registers have the following bit pattern::
2583 0x6060 0000 0015 ffff KVM_REG_ARM64_SVE_VLS pseudo-register
2586 ENOENT. max_vq is the vcpu's maximum supported vector length in 128-bit
2597 KVM_REG_ARM64_SVE_VLS is a pseudo-register that allows the set of vector
2607 ((vector_lengths[(vq - KVM_ARM64_SVE_VQ_MIN) / 64] >>
2608 ((vq - KVM_ARM64_SVE_VQ_MIN) % 64)) & 1))
2630 is hardware-dependent and may not be available. Attempting to configure
2637 arm64 bitmap feature firmware pseudo-registers have the following bit pattern::
2651 a -EBUSY to userspace.
2664 patterns depending on whether they're 32-bit or 64-bit registers::
2666 0x7020 0000 0001 00 <reg:5> <sel:3> (32-bit)
2667 0x7030 0000 0001 00 <reg:5> <sel:3> (64-bit)
2692 0x7020 0000 0003 00 <0:3> <reg:5> (32-bit FPU registers)
2693 0x7030 0000 0003 00 <0:3> <reg:5> (64-bit FPU registers)
2694 0x7040 0000 0003 00 <0:3> <reg:5> (128-bit MSA vector registers)
2706 RISC-V registers are mapped using the lower 32 bits. The upper 8 bits of
2709 RISC-V config registers are meant for configuring a Guest VCPU and it has
2715 Following are the RISC-V config registers:
2727 RISC-V core registers represent the general execution state of a Guest VCPU
2733 Following are the RISC-V core registers:
2770 0x80x0 0000 0200 0020 mode Privilege mode (1 = S-mode or 0 = U-mode)
2773 RISC-V csr registers represent the supervisor mode control/status registers
2779 Following are the RISC-V csr registers:
2795 RISC-V timer registers represent the timer state of a Guest VCPU and it has
2800 Following are the RISC-V timer registers:
2805 0x8030 0000 0400 0000 frequency Time base frequency (read-only)
2811 RISC-V F-extension registers represent the single precision floating point
2816 Following are the RISC-V F-extension registers:
2827 RISC-V D-extension registers represent the double precision floating point
2831 0x8030 0000 06 <index into the __riscv_d_ext_state struct:24> (non-fcsr)
2833 Following are the RISC-V D-extension registers:
2846 --------------------
2876 ----------------------
2882 :Returns: 0 on success, -1 on error
2893 load-link/store-conditional, or equivalent must be used. There are two cases
2900 -------------------
2906 :Returns: >0 on delivery, 0 if guest blocked the MSI, and -1 on error
2908 Directly inject a MSI message. Only valid with in-kernel irqchip that handles
2923 KVM_MSI_VALID_DEVID: devid contains a valid value. The per-VM
2934 address_hi bits 31-8 provide bits 31-8 of the destination id. Bits 7-0 of
2939 --------------------
2945 :Returns: 0 on success, -1 on error
2947 Creates an in-kernel device model for the i8254 PIT. This call is only valid
2948 after enabling in-kernel irqchip support via KVM_CREATE_IRQCHIP. The following
2960 PIT timer interrupts may use a per-VM kernel thread for injection. If it
2963 kvm-pit/<owner-process-pid>
2972 -----------------
2978 :Returns: 0 on success, -1 on error
2980 Retrieves the state of the in-kernel PIT model. Only valid after
3000 -----------------
3006 :Returns: 0 on success, -1 on error
3008 Sets the state of the in-kernel PIT model. Only valid after KVM_CREATE_PIT2.
3015 --------------------------
3021 :Returns: 0 on success, -1 on error
3026 device-tree properties for the guest operating system.
3040 - KVM_PPC_PAGE_SIZES_REAL:
3045 - KVM_PPC_1T_SEGMENTS
3049 - KVM_PPC_NO_HASH
3090 --------------
3096 :Returns: 0 on success, -1 on error
3106 With KVM_CAP_IRQFD_RESAMPLE, KVM_IRQFD supports a de-assert and notify
3107 mechanism allowing emulation of level-triggered, irqfd-based
3112 as from an EOI, the gsi is de-asserted and the user is notified via
3113 kvm_irqfd.resamplefd. It is the user's responsibility to re-queue
3121 - in case no routing entry is associated to this gsi, injection fails
3122 - in case the gsi is associated to an irqchip routing entry,
3124 - in case the gsi is associated to an MSI routing entry, the MSI
3126 to GICv3 ITS in-kernel emulation).
3129 --------------------------
3135 :Returns: 0 on success, -1 on error
3147 The parameter is a pointer to a 32-bit unsigned integer variable
3154 default-sized hash table (16 MB).
3162 real-mode area (VRMA) facility, the kernel will re-create the VMRA
3166 -----------------------
3172 :Returns: 0 on success, -1 on error
3188 - sigp stop; optional flags in parm
3190 - program check; code in parm
3192 - sigp set prefix; prefix address in parm
3194 - restart
3196 - clock comparator interrupt
3198 - CPU timer interrupt
3200 - virtio external interrupt; external interrupt
3203 - sclp external interrupt; sclp parameter in parm
3205 - sigp emergency; source cpu in parm
3207 - sigp external call; source cpu in parm
3209 - compound value to indicate an
3210 I/O interrupt (ai - adapter interrupt; cssid,ssid,schid - subchannel);
3214 - machine check interrupt; cr 14 bits in parm, machine check interrupt
3221 ------------------------
3227 :Returns: file descriptor number (>= 0) on success, -1 on error
3276 ----------------------
3282 :Returns: 0 on success, -1 on error
3315 --------------------------------------------
3323 :Returns: 0 on success, -1 on error
3331 (e.g. read-only attribute, or attribute that only makes
3338 semantics are device-specific. See individual device documentation in
3346 __u32 group; /* device-defined */
3347 __u64 attr; /* group-defined */
3352 ------------------------
3359 :Returns: 0 on success, -1 on error
3374 ----------------------
3380 :Returns: 0 on success; -1 on error
3395 - Processor state:
3400 - General Purpose registers, including PC and SP: set to 0
3401 - FPSIMD/NEON registers: set to 0
3402 - SVE registers: set to 0
3403 - System registers: Reset to their architecturally defined
3416 - KVM_ARM_VCPU_POWER_OFF: Starts the CPU in a power-off state.
3419 - KVM_ARM_VCPU_EL1_32BIT: Starts the CPU in a 32bit mode.
3421 - KVM_ARM_VCPU_PSCI_0_2: Emulate PSCI v0.2 (or a future revision
3424 - KVM_ARM_VCPU_PMU_V3: Emulate PMUv3 for the CPU.
3427 - KVM_ARM_VCPU_PTRAUTH_ADDRESS: Enables Address Pointer authentication
3435 - KVM_ARM_VCPU_PTRAUTH_GENERIC: Enables Generic Pointer authentication
3443 - KVM_ARM_VCPU_SVE: Enables SVE for the CPU (arm64 only).
3449 - KVM_REG_ARM64_SVE_VLS may be read using KVM_GET_ONE_REG: the
3450 initial value of this pseudo-register indicates the best set of
3455 - KVM_RUN and KVM_GET_REG_LIST are not available;
3457 - KVM_GET_ONE_REG and KVM_SET_ONE_REG cannot be used to access
3462 - KVM_REG_ARM64_SVE_VLS may optionally be written using
3468 - the KVM_REG_ARM64_SVE_VLS pseudo-register is immutable, and can
3472 -----------------------------
3478 :Returns: 0 on success; -1 on error
3491 kvm_vcpu_init->features bitmap returned will have feature bits set if
3501 ---------------------
3507 :Returns: 0 on success; -1 on error
3528 -----------------------------------------
3534 :Returns: 0 on success, -1 on error
3564 arm64 currently only require this when using the in-kernel GIC
3570 base addresses will return -EEXIST.
3577 ------------------------------
3583 :Returns: 0 on success, -1 on error
3588 of a service that has a kernel-side implementation. If the token
3589 value is non-zero, it will be associated with that service, and
3597 ------------------------
3603 :Returns: 0 on success; -1 on error
3618 - KVM_GUESTDBG_ENABLE: guest debugging is enabled
3619 - KVM_GUESTDBG_SINGLESTEP: the next run should single-step
3624 - KVM_GUESTDBG_USE_SW_BP: using software breakpoints [x86, arm64]
3625 - KVM_GUESTDBG_USE_HW_BP: using hardware breakpoints [x86, s390]
3626 - KVM_GUESTDBG_USE_HW: using hardware debug events [arm64]
3627 - KVM_GUESTDBG_INJECT_DB: inject DB type exception [x86]
3628 - KVM_GUESTDBG_INJECT_BP: inject BP type exception [x86]
3629 - KVM_GUESTDBG_EXIT_PENDING: trigger an immediate guest exit [s390]
3630 - KVM_GUESTDBG_BLOCKIRQ: avoid injecting interrupts/NMI/SMI [x86]
3648 the single-step debug event (KVM_GUESTDBG_SINGLESTEP) is supported.
3658 ---------------------------
3664 :Returns: 0 on success, -1 on error
3699 the variable-size array 'entries'. If the number of entries is too low
3733 --------------------
3740 < 0 on generic error (e.g. -EFAULT or -ENOMEM),
3798 Logical accesses are permitted for non-protected guests only.
3816 translation-exception identifier (TEID) indicates suppression.
3839 Absolute accesses are permitted for non-protected guests only.
3878 -----------------------
3904 will cause the ioctl to return -EINVAL.
3910 -----------------------
3928 will cause the ioctl to return -EINVAL.
3935 the ioctl will return -EINVAL.
3938 -----------------
3944 :Returns: 0 on success, -1 on error
3985 - KVM_S390_SIGP_STOP - sigp stop; parameter in .stop
3986 - KVM_S390_PROGRAM_INT - program check; parameters in .pgm
3987 - KVM_S390_SIGP_SET_PREFIX - sigp set prefix; parameters in .prefix
3988 - KVM_S390_RESTART - restart; no parameters
3989 - KVM_S390_INT_CLOCK_COMP - clock comparator interrupt; no parameters
3990 - KVM_S390_INT_CPU_TIMER - CPU timer interrupt; no parameters
3991 - KVM_S390_INT_EMERGENCY - sigp emergency; parameters in .emerg
3992 - KVM_S390_INT_EXTERNAL_CALL - sigp external call; parameters in .extcall
3993 - KVM_S390_MCHK - machine check interrupt; parameters in .mchk
3998 ---------------------------
4005 -EINVAL if buffer size is 0,
4006 -ENOBUFS if buffer size is too small to fit all pending interrupts,
4007 -EFAULT if the buffer address was invalid
4025 the kernel never checked for flags == 0 and QEMU never pre-zeroed flags and
4029 If -ENOBUFS is returned the buffer provided was too small and userspace
4033 ---------------------------
4040 -EFAULT if the buffer address was invalid,
4041 -EINVAL for an invalid buffer length (see below),
4042 -EBUSY if there were already interrupts pending,
4046 This ioctl allows userspace to set the complete state of all cpu-local
4068 which is the maximum number of possibly pending cpu-local interrupts.
4071 ------------
4077 :Returns: 0 on success, -1 on error
4082 ----------------------------
4162 MSR accesses as part of nested VM-Enter/VM-Exit are not filtered.
4180 ----------------------------
4213 -------------------------
4220 -EFAULT if struct kvm_reinject_control cannot be read,
4221 -ENXIO if KVM_CREATE_PIT or KVM_CREATE_PIT2 didn't succeed earlier.
4240 ------------------------------
4247 -EFAULT if struct kvm_ppc_mmuv3_cfg cannot be read,
4248 -EINVAL if the configuration is invalid
4274 ---------------------------
4281 -EFAULT if struct kvm_ppc_rmmu_info cannot be written,
4282 -EINVAL if no useful information can be returned
4311 --------------------------------
4320 -EFAULT if struct kvm_reinject_control cannot be read,
4321 -EINVAL if the supplied shift or flags are invalid,
4322 -ENOMEM if unable to allocate the new HPT,
4355 returns 0 (i.e. cancels any in-progress preparation).
4358 flags will result in an -EINVAL.
4365 -------------------------------
4372 -EFAULT if struct kvm_reinject_control cannot be read,
4373 -EINVAL if the supplied shift or flags are invalid,
4374 -ENXIO is there is no pending HPT, or the pending HPT doesn't
4376 -EBUSY if the pending HPT is not fully prepared,
4377 -ENOSPC if there was a hash collision when moving existing
4379 -EIO on other error conditions
4396 KVM_PPC_RESIZE_HPT_COMMIT will return an error (usually -ENXIO or
4397 -EBUSY, though others may be possible if the preparation was started,
4410 -----------------------------------
4416 :Returns: 0 on success, -1 on error
4423 -----------------------
4430 -EFAULT if u64 mcg_cap cannot be read,
4431 -EINVAL if the requested number of banks is invalid,
4432 -EINVAL if requested MCE capability is not supported.
4437 supported number of error-reporting banks can be retrieved when
4442 ---------------------
4449 -EFAULT if struct kvm_x86_mce cannot be read,
4450 -EINVAL if the bank number is invalid,
4451 -EINVAL if VAL bit is not set in status field.
4476 ----------------------------
4499 - During live migration to save the CMMA values. Live migration needs
4501 - To non-destructively peek at the CMMA values, with the flag
4532 KVM_S390_SKEYS_MAX. KVM_S390_SKEYS_MAX is re-used for consistency with
4577 ----------------------------
4616 This ioctl can fail with -ENOMEM if not enough memory can be allocated to
4617 complete the task, with -ENXIO if CMMA is not enabled, with -EINVAL if
4619 if the flags field was not 0, with -EFAULT if the userspace address is
4625 --------------------------
4632 -EFAULT if struct kvm_ppc_cpu_char cannot be written
4637 CVE-2017-5715, CVE-2017-5753 and CVE-2017-5754). The information is
4654 with preventing inadvertent information disclosure - specifically,
4655 whether there is an instruction to flash-invalidate the L1 data cache
4672 ---------------------------
4678 :Returns: 0 on success; -1 on error
4681 for issuing platform-specific memory encryption commands to manage those
4686 Documentation/virt/kvm/x86/amd-memory-encryption.rst.
4689 -----------------------------------
4695 :Returns: 0 on success; -1 on error
4700 It is used in the SEV-enabled guest. When encryption is enabled, a guest
4713 -------------------------------------
4719 :Returns: 0 on success; -1 on error
4725 ------------------------
4733 the specified Hyper-V connection id through the SIGNAL_EVENT hypercall, without
4734 causing a user exit. SIGNAL_EVENT hypercall with non-zero event flag number
4735 (bits 24-31) still triggers a KVM_EXIT_HYPERV_HCALL user exit.
4755 -EINVAL if conn_id or flags is outside the allowed range,
4756 -ENOENT on deassign if the conn_id isn't registered,
4757 -EEXIST on assign if the conn_id is already registered
4760 --------------------------
4766 :Returns: 0 on success, -1 on error
4834 --------------------------
4840 :Returns: 0 on success, -1 on error
4846 -------------------------------------
4875 ------------------------------------
4881 :Returns: 0 on success, -1 on error
4903 in KVM's dirty bitmap, and dirty tracking is re-enabled for that page
4904 (for example via write-protection, or by clearing the dirty bit in
4907 If KVM_CAP_MULTI_ADDRESS_SPACE is available, bits 16-31 of slot field specifies
4917 --------------------------------
4923 :Returns: 0 on success, -1 on error
4944 This ioctl returns x86 cpuid features leaves related to Hyper-V emulation in
4946 cpuid information presented to guests consuming Hyper-V enlightenments (e.g.
4947 Windows or Hyper-V guests).
4949 CPUID feature leaves returned by this ioctl are defined by Hyper-V Top Level
4956 - HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS
4957 - HYPERV_CPUID_INTERFACE
4958 - HYPERV_CPUID_VERSION
4959 - HYPERV_CPUID_FEATURES
4960 - HYPERV_CPUID_ENLIGHTMENT_INFO
4961 - HYPERV_CPUID_IMPLEMENT_LIMITS
4962 - HYPERV_CPUID_NESTED_FEATURES
4963 - HYPERV_CPUID_SYNDBG_VENDOR_AND_MAX_FUNCTIONS
4964 - HYPERV_CPUID_SYNDBG_INTERFACE
4965 - HYPERV_CPUID_SYNDBG_PLATFORM_CAPABILITIES
4968 with the 'nent' field indicating the number of entries in the variable-size
4969 array 'entries'. If the number of entries is too low to describe all Hyper-V
4971 to the number of Hyper-V feature leaves, the 'nent' field is adjusted to the
4981 - HYPERV_CPUID_NESTED_FEATURES leaf and HV_X64_ENLIGHTENED_VMCS_RECOMMENDED
4984 - HV_STIMER_DIRECT_MODE_AVAILABLE bit is only exposed with in-kernel LAPIC.
4988 ---------------------------
4993 :Returns: 0 on success, -1 on error
5019 that should be performaned and how to do it are feature-dependent.
5023 -EPERM unless the feature has already been finalized by means of a
5030 ------------------------------
5036 :Returns: 0 on success, -1 on error
5089 ---- -----------
5118 When setting a new pmu event filter, -EINVAL will be returned if any of the
5128 ---------------------
5152 ---------------------------
5164 ----------------------------
5177 --------------------------
5191 -------------------------
5236 All registered VCPUs are converted back to non-protected ones. If a
5337 not succeed all other subcommands will fail with -EINVAL. This
5338 subcommand will return -EINVAL if a dump process has not yet been
5369 resume execution immediately as non-protected. There can be at most
5394 --------------------------
5439 Sets the ABI mode of the VM to 32-bit or 64-bit (long mode). This
5466 This is the HVM-wide vector injected directly by the hypervisor
5474 an outbound port number for interception of EVTCHNOP_send requests
5482 outbound event channels. The values of the flags field are mutually
5488 the 32-bit version code returned to the guest when it invokes the
5503 --------------------------
5516 ---------------------------
5586 other four times. The state field must be set to -1, or to a valid
5594 vCPU ID of the given vCPU, to allow timer-related VCPU operations to
5607 per-vCPU local APIC upcall vector, configured by a Xen guest with
5609 used by Windows guests, and is distinct from the HVM-wide upcall
5615 ---------------------------
5630 ---------------------------
5636 :Returns: number of bytes copied, < 0 on error (-EINVAL for incorrect
5637 arguments, -EFAULT if memory cannot be accessed).
5651 ``length`` must not be bigger than 2^31 - PAGE_SIZE bytes. The ``addr``
5668 --------------------
5674 :Returns: 0 on success, -1 on error
5701 --------------------
5707 :Returns: 0 on success, -1 on error
5714 ----------------------
5733 +-------------+
5735 +-------------+
5737 +-------------+
5739 +-------------+
5741 +-------------+
5831 Bits 0-3 of ``flags`` encode the type:
5853 is [``hist_param``*(N-1), ``hist_param``*N), while the range of the last
5854 bucket is [``hist_param``*(``size``-1), +INF). (+INF means positive infinity
5859 [0, 1), while the range of the last bucket is [pow(2, ``size``-2), +INF).
5861 [pow(2, N-2), pow(2, N-1)).
5863 Bits 4-7 of ``flags`` encode the unit:
5886 Bits 8-11 of ``flags``, together with ``exponent``, encode the scale of the
5891 CPU clock cycles. For example, an exponent of -9 can be used with
5907 bucket in the unit expressed by bits 4-11 of ``flags`` together with ``exponent``.
5913 The Stats Data block contains an array of 64-bit values in the same order
5917 --------------------
5923 :Returns: 0 on success, -1 on error
5944 -----------------------------
5964 -----------------------------
5973 for vcpus. It re-uses the kvm_s390_pv_dmp struct and hence also shares
5989 ----------------------
5997 Used to manage hardware-assisted virtualization features for zPCI devices.
6036 --------------------------------
6044 This capability indicates that userspace is able to apply a single VM-wide
6065 (-EINVAL) being returned. This ioctl can also return -EBUSY if any vcpu
6095 This field is polled once when KVM_RUN starts; if non-zero, KVM_RUN
6096 exits immediately, returning -EINTR. In the common scenario where a
6100 a signal handler that sets run->immediate_exit to a non-zero value.
6126 The value of the current interrupt flag. Only valid if in-kernel
6133 More architecture-specific flags detailing state of the VCPU that may
6148 The value of the cr8 register. Only valid if in-kernel local APIC is
6155 The value of the APIC BASE msr. Only valid if in-kernel local
6167 reasons. Further architecture-specific information is available in
6179 to unknown reasons. Further architecture-specific information is
6232 executed a memory-mapped I/O instruction which could not be satisfied
6245 has re-entered the kernel with KVM_RUN. The kernel side will first finish
6250 completed before performing a live migration. Userspace can re-enter the
6273 ----------
6284 - ``KVM_HYPERCALL_EXIT_SMC``: Indicates that the guest used the SMC
6288 - ``KVM_HYPERCALL_EXIT_16BIT``: Indicates that the guest used a 16bit
6357 Deprecated - was used for 440 KVM.
6383 This is used on 64-bit PowerPC when emulating a pSeries partition,
6387 the arguments (from the guest R4 - R12). Userspace should put the
6448 a system-level event using some architecture specific mechanism (hypercall
6452 The 'type' field describes the system-level event type.
6455 - KVM_SYSTEM_EVENT_SHUTDOWN -- the guest has requested a shutdown of the
6459 - KVM_SYSTEM_EVENT_RESET -- the guest has requested a reset of the VM.
6462 - KVM_SYSTEM_EVENT_CRASH -- the guest crash occurred and the guest
6466 - KVM_SYSTEM_EVENT_SEV_TERM -- an AMD SEV guest requested termination.
6468 - KVM_SYSTEM_EVENT_WAKEUP -- the exiting vCPU is in a suspended state and
6471 - KVM_SYSTEM_EVENT_SUSPEND -- the guest has requested a suspension of
6475 architecture specific information for the system-level event. Only
6478 - for arm64, data[0] is set to KVM_SYSTEM_EVENT_RESET_FLAG_PSCI_RESET2 if
6482 - for RISC-V, data[0] is set to the value of the second argument of the
6490 --------------
6500 the call parameters are left in-place in the vCPU registers.
6505 - Honor the guest request to suspend the VM. Userspace can request
6506 in-kernel emulation of suspension by setting the calling vCPU's
6512 - Deny the guest request to suspend the VM. See ARM DEN0022D.b 5.19.2
6522 Indicates that the VCPU's in-kernel local APIC received an EOI for a
6523 level-triggered IOAPIC interrupt. This exit only triggers when the
6565 related to Hyper-V emulation.
6569 - KVM_EXIT_HYPERV_SYNIC -- synchronously notify user-space about
6571 Hyper-V SynIC state change. Notification is used to remap SynIC
6575 - KVM_EXIT_HYPERV_SYNDBG -- synchronously notify user-space about
6577 Hyper-V Synthetic debugger state change. Notification is used to either update
6596 the VM. KVM assumed that if the guest accessed non-memslot memory, it was
6619 __u8 error; /* user -> kernel */
6621 __u32 reason; /* kernel -> user */
6622 __u32 index; /* kernel -> user */
6623 __u64 data; /* kernel <-> user */
6681 - KVM_EXIT_XEN_HCALL -- synchronously notify user-space about Xen hypercall.
6696 done a SBI call which is not handled by KVM RISC-V kernel module. The details
6702 values of SBI call before resuming the VCPU. For more details on RISC-V SBI
6703 spec refer, https://github.com/riscv/riscv-sbi-doc.
6714 enabled, a VM exit generated if no event window occurs in VM non-root mode
6722 - KVM_NOTIFY_CONTEXT_INVALID -- the VM context is corrupted and not valid
6773 whether this is a per-vcpu or per-vm capability.
6784 -------------------
6789 :Returns: 0 on success; -1 on error
6793 were invented by Mac-on-Linux to have a standardized communication mechanism
6800 --------------------
6805 :Returns: 0 on success; -1 on error
6821 ------------------
6826 :Returns: 0 on success; -1 on error
6839 addresses of mmu-type-specific data structures. The "array_len" field is an
6855 - The "params" field is of type "struct kvm_book3e_206_tlb_params".
6856 - The "array" field points to an array of type "struct
6858 - The array consists of all entries in the first TLB, followed by all
6860 - Within a TLB, entries are ordered first by increasing set number. Within a
6862 - The hash for determining set number in TLB0 is: (MAS2 >> 12) & (num_sets - 1)
6864 - The tsize field of mas1 shall be set to 4K on TLB0, even though the
6868 ----------------------------
6873 :Returns: 0 on success; -1 on error
6878 handled in-kernel, while the other I/O instructions are passed to userspace.
6883 Note that even though this capability is enabled per-vcpu, the complete
6887 -------------------
6892 :Returns: 0 on success; -1 on error
6906 --------------------
6912 This capability connects the vcpu to an in-kernel MPIC device.
6915 --------------------
6922 This capability connects the vcpu to an in-kernel XICS device.
6925 ------------------------
6931 This capability enables the in-kernel irqchip for s390. Please refer to
6935 --------------------
6949 ---------------------
6962 ----------------------
6967 :Returns: x86: KVM_CHECK_EXTENSION returns a bit-array indicating which register
6983 - the register sets to be copied out to kvm_run are selectable
6985 - vcpu_events are available in addition to regs and sregs.
6988 function as an input bit-array field set by userspace to indicate the
7008 -------------------------
7015 This capability connects the vcpu to an in-kernel XIVE device.
7040 ----------------------------
7044 args[1] is 0 to disable, 1 to enable in-kernel handling
7047 get handled by the kernel or not. Enabling or disabling in-kernel
7049 initial set of hcalls are enabled for in-kernel handling, which
7050 consists of those hcalls for which in-kernel handlers were implemented
7057 If the hcall number specified is not one that has an in-kernel
7062 --------------------------
7071 - SENSE
7072 - SENSE RUNNING
7073 - EXTERNAL CALL
7074 - EMERGENCY SIGNAL
7075 - CONDITIONAL EMERGENCY SIGNAL
7084 ---------------------------------
7092 return -EINVAL if the machine does not support vectors.
7095 --------------------------
7100 This capability allows post-handlers for the STSI instruction. After
7105 vcpu->run::
7116 @addr - guest address of STSI SYSIB
7117 @fc - function code
7118 @sel1 - selector 1
7119 @sel2 - selector 2
7120 @ar - access register number
7122 KVM handlers should exit to userspace with rc = -EREMOTE.
7125 -------------------------
7128 :Parameters: args[0] - number of routes reserved for userspace IOAPICs
7129 :Returns: 0 on success, -1 on error
7146 -------------------
7151 Allows use of runtime-instrumentation introduced with zEC12 processor.
7152 Will return -EINVAL if the machine does not support runtime-instrumentation.
7153 Will return -EBUSY if a VCPU has already been created.
7156 ----------------------
7159 :Parameters: args[0] - features that should be enabled
7160 :Returns: 0 on success, -EINVAL when args[0] contains invalid features
7169 allowing the use of 32-bit APIC IDs. See KVM_CAP_X2APIC_API in their
7176 where 0xff represents CPUs 0-7 in cluster 0.
7179 ----------------------------
7186 mechanism e.g. to realize 2-byte software breakpoints. The kernel will
7194 -------------------
7198 :Returns: 0 on success; -EINVAL if the machine does not support
7199 guarded storage; -EBUSY if a VCPU has already been created.
7204 ---------------------
7209 Allow use of adapter-interruption suppression.
7210 :Returns: 0 on success; -EBUSY if a VCPU has already been created.
7213 --------------------
7231 ----------------------
7243 ------------------------------
7247 :Returns: 0 on success, -EINVAL when args[0] contains invalid exits
7266 --------------------------
7270 :Returns: 0 on success, -EINVAL if hpage module parameter was not set
7278 hpage module parameter is not set to 1, -EINVAL is returned.
7284 ------------------------------
7294 --------------------------
7298 :Returns: 0 on success, -EINVAL when the implementation doesn't support
7299 nested-HV virtualization.
7301 HV-KVM on POWER9 and later systems allows for "nested-HV"
7303 can run using the CPU's supervisor mode (privileged non-hypervisor
7306 kvm-hv module parameter.
7309 ------------------------------
7315 emulated VM-exit when L1 intercepts a #PF exception that occurs in
7316 L2. Similarly, for kvm-intel only, DR6 will not be modified prior to
7317 the emulated VM-exit when L1 intercepts a #DB exception that occurs in
7323 exception.has_payload and to put the faulting address - or the new DR6
7324 bits\ [#]_ - in the exception_payload field.
7335 --------------------------------------
7346 automatically clear and write-protect all pages that are returned as dirty.
7352 KVM_CLEAR_DIRTY_LOG ioctl can operate on a 64-page granularity rather
7377 ------------------------------
7394 ----------------------
7399 :Returns: 0 on success; -1 on error
7402 maximum halt-polling time for all vCPUs in the target VM. This capability can
7404 maximum halt-polling time.
7406 See Documentation/virt/kvm/halt-polling.rst for more information on halt
7410 -------------------------------
7415 :Returns: 0 on success; -1 on error
7442 -------------------------------
7447 :Returns: 0 on success, -EINVAL when args[0] contains invalid bits
7473 KVM_RUN_BUS_LOCK flag in vcpu-run->flags field and exit to userspace. Concerning
7479 ----------------------
7483 :Returns: 0 on success, -EINVAL when CPU doesn't support 2nd DAWR
7490 -------------------------------------
7500 This is intended to support in-guest workloads scheduled by the host. This
7501 allows the in-guest workload to maintain its own NPTs and keeps the two vms
7506 --------------------------
7511 :Returns: 0 on success, -EINVAL if the file handle is invalid or if a requested
7529 -------------------------------
7540 IBM pSeries (sPAPR) guest starts using it if "hcall-rpt-invalidate" is
7541 present in the "ibm,hypertas-functions" device-tree property.
7547 --------------------------------------
7565 --------------------
7582 ``MAP_ANONYMOUS`` or with a RAM-based file mapping (``tmpfs``, ``memfd``),
7584 -EINVAL return.
7590 -------------------------------------
7600 This is intended to support intra-host migration of VMs between userspace VMMs,
7604 -------------------------------
7614 This capability allows a guest kernel to use a better-performance mode for
7618 ----------------------------
7621 :Parameters: args[0] - set of KVM quirks to disable
7653 KVM_X86_QUIRK_OUT_7E_INC_RIP By default, KVM pre-increments %rip before
7656 KVM does not pre-increment %rip before
7690 ------------------------
7694 :Parameters: args[0] - maximum APIC ID value set for current VM
7695 :Returns: 0 on success, -EINVAL if args[0] is beyond KVM_MAX_VCPU_IDS
7711 ------------------------------
7716 :Returns: 0 on success, -EINVAL if args[0] contains invalid flags or notify
7726 in per-VM scope during VM creation. Notify VM exit is disabled by default.
7729 a VM exit if no event window occurs in VM non-root mode for a specified of
7746 ---------------------
7752 H_RANDOM hypercall backed by a hardware random-number generator.
7757 ------------------------
7763 Hyper-V Synthetic interrupt controller(SynIC). Hyper-V SynIC is
7764 used to support Windows Hyper-V based guest paravirt drivers(VMBus).
7769 by the CPU, as it's incompatible with SynIC auto-EOI behavior.
7772 -------------------------
7782 ---------------------------
7789 the POWER9 processor), including in-memory segment tables.
7792 -------------------
7822 -------------------
7836 ----------------------
7850 Both registers and addresses are 32-bits wide.
7851 It will only be possible to run 32-bit guest code.
7853 1 MIPS64 or microMIPS64 with access only to 32-bit compatibility segments.
7854 Registers are 64-bits wide, but addresses are 32-bits wide.
7855 64-bit guest code may run but cannot access MIPS64 memory segments.
7856 It will also be possible to run 32-bit guest code.
7859 Both registers and addresses are 64-bits wide.
7860 It will be possible to run 64-bit or 32-bit guest code.
7864 ------------------------
7869 that if userspace creates a VM without an in-kernel interrupt controller, it
7870 will be notified of changes to the output level of in-kernel emulated devices,
7873 updates the vcpu's run->s.regs.device_irq_level field to represent the actual
7879 userspace can always sample the device output level and re-compute the state of
7881 of run->s.regs.device_irq_level on every kvm exit.
7882 The value in run->s.regs.device_irq_level can represent both level and edge
7884 signals will exit to userspace with the bit in run->s.regs.device_irq_level
7887 The field run->s.regs.device_irq_level is available independent of
7888 run->kvm_valid_regs or run->kvm_dirty_regs bits.
7892 and thereby which bits in run->s.regs.device_irq_level can signal values.
7898 KVM_ARM_DEV_EL1_VTIMER - EL1 virtual timer
7899 KVM_ARM_DEV_EL1_PTIMER - EL1 physical timer
7900 KVM_ARM_DEV_PMU - ARM PMU overflow interrupt signal
7907 -----------------------------
7917 --------------------------
7921 This capability enables a newer version of Hyper-V Synthetic interrupt
7927 ----------------------------
7937 -------------------------------
7947 ---------------------
7954 ----------------------
7963 ---------------------
7968 use copy-on-write semantics as well as dirty pages tracking via read-only page
7972 ---------------------
7981 ----------------------------
7985 This capability indicates that KVM supports paravirtualized Hyper-V TLB Flush
7991 ----------------------------------
8006 ----------------------------
8010 This capability indicates that KVM supports paravirtualized Hyper-V IPI send
8015 -----------------------------------
8019 This capability indicates that KVM running on top of Hyper-V hypervisor
8021 hypercalls are handled by Level 0 hypervisor (Hyper-V) bypassing KVM.
8022 Due to the different ABI for hypercall parameters between Hyper-V and
8025 flush hypercalls by Hyper-V) so userspace should disable KVM identification
8026 in CPUID and only exposes Hyper-V identification. In this case, guest
8027 thinks it's running on Hyper-V and only use Hyper-V hypercalls.
8030 -----------------------------
8038 ---------------------------
8049 -----------------------
8055 architecture-specific interfaces. This capability and the architecture-
8062 -------------------------
8072 an 8-byte value consisting of a one-byte Control Program Name Code (CPNC) and
8073 a 7-byte Control Program Version Code (CPVC). The CPNC determines what
8082 -------------------------------
8093 ---------------------------
8107 -------------------------------------
8117 ----------------------------------------------------------
8120 :Parameters: args[0] - size of the dirty log ring
8150 all user memory regions for which the KVM_MEM_LOG_DIRTY_PAGES flag was
8160 00 -----------> 01 -------------> 1X -------+
8163 +------------------------------------------+
8177 using load-acquire/store-release accessors when available, or any
8205 Architecture with TSO-like ordering (such as x86) are allowed to
8211 ring structures can be backed by per-slot bitmaps. With this capability
8221 context. Otherwise, the stand-alone per-slot bitmap mechanism needs to
8234 KVM device "kvm-arm-vgic-its". (2) restore vgic/its tables through
8236 "kvm-arm-vgic-its". VGICv3 LPI pending status is restored. (3) save
8238 command on KVM device "kvm-arm-vgic-v3".
8241 --------------------
8270 The KVM_XEN_HVM_CONFIG_RUNSTATE flag indicates that the runstate-related
8299 -------------------------
8314 IBM pSeries (sPAPR) guest starts using them if "hcall-multi-tce" is
8315 present in the "ibm,hypertas-functions" device-tree property.
8325 --------------------
8334 ---------------------------------
8338 When enabled, KVM will disable emulated Hyper-V features provided to the
8339 guest according to the bits Hyper-V CPUID feature leaves. Otherwise, all
8340 currently implemented Hyper-V features are provided unconditionally when
8341 Hyper-V identification is set in the HYPERV_CPUID_INTERFACE (0x40000001)
8345 ---------------------------
8364 ---------------------------
8370 :Returns: 0 on success, -EINVAL when arg[0] contains invalid bits
8386 -------------------------------
8396 --------------------------------
8409 -------------------------------------
8415 :Returns: 0 on success, -EPERM if the userspace process does not
8416 have CAP_SYS_BOOT, -EINVAL if args[0] is not 0 or any vCPUs have been
8426 ------------------------------
8447 When getting the Modified Change Topology Report value, the attr->addr
8451 ---------------------------------------
8457 :Returns: 0 on success, -EINVAL if any memslot was already created.
8461 Eager Page Splitting improves the performance of dirty-logging (used
8462 in live migrations) when guest memory is backed by huge-pages. It
8463 avoids splitting huge-pages (into PAGE_SIZE pages) on fault, by doing
8474 64-bit bitmap (each bit describing a block size). The default value is
8488 --------
8502 ``KVM_ENABLE_CAP(KVM_CAP_IRQCHIP_SPLIT)`` are used to enable in-kernel emulation of
8509 has enabled in-kernel emulation of the local APIC.