1 The Definitive KVM (Kernel-based Virtual Machine) API Documentation
2 ===================================================================
6 The kvm API is a set of ioctls that are issued to control various aspects
7 of a virtual machine. The ioctls belong to three classes
9 - System ioctls: These query and set global attributes which affect the
10 whole kvm subsystem. In addition a system ioctl is used to create
13 - VM ioctls: These query and set attributes that affect an entire virtual
14 machine, for example memory layout. In addition a VM ioctl is used to
15 create virtual cpus (vcpus).
17 Only run VM ioctls from the same process (address space) that was used
20 - vcpu ioctls: These query and set attributes that control the operation
21 of a single virtual cpu.
23 Only run vcpu ioctls from the same thread that was used to create the
28 The kvm API is centered around file descriptors. An initial
29 open("/dev/kvm") obtains a handle to the kvm subsystem; this handle
30 can be used to issue system ioctls. A KVM_CREATE_VM ioctl on this
31 handle will create a VM file descriptor which can be used to issue VM
32 ioctls. A KVM_CREATE_VCPU ioctl on a VM fd will create a virtual cpu
33 and return a file descriptor pointing to it. Finally, ioctls on a vcpu
34 fd can be used to control the vcpu, including the important task of
35 actually running guest code.
37 In general file descriptors can be migrated among processes by means
38 of fork() and the SCM_RIGHTS facility of unix domain socket. These
39 kinds of tricks are explicitly not supported by kvm. While they will
40 not cause harm to the host, their actual behavior is not guaranteed by
41 the API. The only supported use is one virtual machine per process,
42 and one vcpu per thread.
46 As of Linux 2.6.22, the KVM ABI has been stabilized: no backward
47 incompatible change are allowed. However, there is an extension
48 facility that allows backward-compatible extensions to the API to be
51 The extension mechanism is not based on on the Linux version number.
52 Instead, kvm defines extension identifiers and a facility to query
53 whether a particular extension identifier is available. If it is, a
54 set of ioctls is available for application use.
58 This section describes ioctls that can be used to control kvm guests.
59 For each ioctl, the following information is provided along with a
62 Capability: which KVM extension provides this ioctl. Can be 'basic',
63 which means that is will be provided by any kernel that supports
64 API version 12 (see section 4.1), or a KVM_CAP_xyz constant, which
65 means availability needs to be checked with KVM_CHECK_EXTENSION
68 Architectures: which instruction set architectures provide this ioctl.
69 x86 includes both i386 and x86_64.
71 Type: system, vm, or vcpu.
73 Parameters: what parameters are accepted by the ioctl.
75 Returns: the return value. General error numbers (EBADF, ENOMEM, EINVAL)
76 are not detailed, but errors with specific meanings are.
78 4.1 KVM_GET_API_VERSION
84 Returns: the constant KVM_API_VERSION (=12)
86 This identifies the API version as the stable kvm API. It is not
87 expected that this number will change. However, Linux 2.6.20 and
88 2.6.21 report earlier versions; these are not documented and not
89 supported. Applications should refuse to run if KVM_GET_API_VERSION
90 returns a value other than 12. If this check passes, all ioctls
91 described as 'basic' will be available.
98 Parameters: machine type identifier (KVM_VM_*)
99 Returns: a VM fd that can be used to control the new virtual machine.
101 The new VM has no virtual cpus and no memory. An mmap() of a VM fd
102 will access the virtual machine's physical address space; offset zero
103 corresponds to guest physical address zero. Use of mmap() on a VM fd
104 is discouraged if userspace memory allocation (KVM_CAP_USER_MEMORY) is
106 You most certainly want to use 0 as machine type.
108 In order to create user controlled virtual machines on S390, check
109 KVM_CAP_S390_UCONTROL and use the flag KVM_VM_S390_UCONTROL as
110 privileged user (CAP_SYS_ADMIN).
112 4.3 KVM_GET_MSR_INDEX_LIST
117 Parameters: struct kvm_msr_list (in/out)
118 Returns: 0 on success; -1 on error
120 E2BIG: the msr index list is to be to fit in the array specified by
123 struct kvm_msr_list {
124 __u32 nmsrs; /* number of msrs in entries */
128 This ioctl returns the guest msrs that are supported. The list varies
129 by kvm version and host processor, but does not change otherwise. The
130 user fills in the size of the indices array in nmsrs, and in return
131 kvm adjusts nmsrs to reflect the actual number of msrs and fills in
132 the indices array with their numbers.
134 Note: if kvm indicates supports MCE (KVM_CAP_MCE), then the MCE bank MSRs are
135 not returned in the MSR list, as different vcpus can have a different number
136 of banks, as set via the KVM_X86_SETUP_MCE ioctl.
138 4.4 KVM_CHECK_EXTENSION
143 Parameters: extension identifier (KVM_CAP_*)
144 Returns: 0 if unsupported; 1 (or some other positive integer) if supported
146 The API allows the application to query about extensions to the core
147 kvm API. Userspace passes an extension identifier (an integer) and
148 receives an integer that describes the extension availability.
149 Generally 0 means no and 1 means yes, but some extensions may report
150 additional information in the integer return value.
152 4.5 KVM_GET_VCPU_MMAP_SIZE
158 Returns: size of vcpu mmap area, in bytes
160 The KVM_RUN ioctl (cf.) communicates with userspace via a shared
161 memory region. This ioctl returns the size of that region. See the
162 KVM_RUN documentation for details.
164 4.6 KVM_SET_MEMORY_REGION
169 Parameters: struct kvm_memory_region (in)
170 Returns: 0 on success, -1 on error
172 This ioctl is obsolete and has been removed.
179 Parameters: vcpu id (apic id on x86)
180 Returns: vcpu fd on success, -1 on error
182 This API adds a vcpu to a virtual machine. The vcpu id is a small integer
183 in the range [0, max_vcpus).
185 The recommended max_vcpus value can be retrieved using the KVM_CAP_NR_VCPUS of
186 the KVM_CHECK_EXTENSION ioctl() at run-time.
187 The maximum possible value for max_vcpus can be retrieved using the
188 KVM_CAP_MAX_VCPUS of the KVM_CHECK_EXTENSION ioctl() at run-time.
190 If the KVM_CAP_NR_VCPUS does not exist, you should assume that max_vcpus is 4
192 If the KVM_CAP_MAX_VCPUS does not exist, you should assume that max_vcpus is
193 same as the value returned from KVM_CAP_NR_VCPUS.
195 On powerpc using book3s_hv mode, the vcpus are mapped onto virtual
196 threads in one or more virtual CPU cores. (This is because the
197 hardware requires all the hardware threads in a CPU core to be in the
198 same partition.) The KVM_CAP_PPC_SMT capability indicates the number
199 of vcpus per virtual core (vcore). The vcore id is obtained by
200 dividing the vcpu id by the number of vcpus per vcore. The vcpus in a
201 given vcore will always be in the same physical core as each other
202 (though that might be a different physical core from time to time).
203 Userspace can control the threading (SMT) mode of the guest by its
204 allocation of vcpu ids. For example, if userspace wants
205 single-threaded guest vcpus, it should make all vcpu ids be a multiple
206 of the number of vcpus per vcore.
208 On powerpc using book3s_hv mode, the vcpus are mapped onto virtual
209 threads in one or more virtual CPU cores. (This is because the
210 hardware requires all the hardware threads in a CPU core to be in the
211 same partition.) The KVM_CAP_PPC_SMT capability indicates the number
212 of vcpus per virtual core (vcore). The vcore id is obtained by
213 dividing the vcpu id by the number of vcpus per vcore. The vcpus in a
214 given vcore will always be in the same physical core as each other
215 (though that might be a different physical core from time to time).
216 Userspace can control the threading (SMT) mode of the guest by its
217 allocation of vcpu ids. For example, if userspace wants
218 single-threaded guest vcpus, it should make all vcpu ids be a multiple
219 of the number of vcpus per vcore.
221 4.8 KVM_GET_DIRTY_LOG (vm ioctl)
226 Parameters: struct kvm_dirty_log (in/out)
227 Returns: 0 on success, -1 on error
229 /* for KVM_GET_DIRTY_LOG */
230 struct kvm_dirty_log {
234 void __user *dirty_bitmap; /* one bit per page */
239 Given a memory slot, return a bitmap containing any pages dirtied
240 since the last call to this ioctl. Bit 0 is the first page in the
241 memory slot. Ensure the entire structure is cleared to avoid padding
244 4.9 KVM_SET_MEMORY_ALIAS
249 Parameters: struct kvm_memory_alias (in)
250 Returns: 0 (success), -1 (error)
252 This ioctl is obsolete and has been removed.
260 Returns: 0 on success, -1 on error
262 EINTR: an unmasked signal is pending
264 This ioctl is used to run a guest virtual cpu. While there are no
265 explicit parameters, there is an implicit parameter block that can be
266 obtained by mmap()ing the vcpu fd at offset 0, with the size given by
267 KVM_GET_VCPU_MMAP_SIZE. The parameter block is formatted as a 'struct
268 kvm_run' (see below).
275 Parameters: struct kvm_regs (out)
276 Returns: 0 on success, -1 on error
278 Reads the general purpose registers from the vcpu.
282 /* out (KVM_GET_REGS) / in (KVM_SET_REGS) */
283 __u64 rax, rbx, rcx, rdx;
284 __u64 rsi, rdi, rsp, rbp;
285 __u64 r8, r9, r10, r11;
286 __u64 r12, r13, r14, r15;
295 Parameters: struct kvm_regs (in)
296 Returns: 0 on success, -1 on error
298 Writes the general purpose registers into the vcpu.
300 See KVM_GET_REGS for the data structure.
305 Architectures: x86, ppc
307 Parameters: struct kvm_sregs (out)
308 Returns: 0 on success, -1 on error
310 Reads special registers from the vcpu.
314 struct kvm_segment cs, ds, es, fs, gs, ss;
315 struct kvm_segment tr, ldt;
316 struct kvm_dtable gdt, idt;
317 __u64 cr0, cr2, cr3, cr4, cr8;
320 __u64 interrupt_bitmap[(KVM_NR_INTERRUPTS + 63) / 64];
323 /* ppc -- see arch/powerpc/include/asm/kvm.h */
325 interrupt_bitmap is a bitmap of pending external interrupts. At most
326 one bit may be set. This interrupt has been acknowledged by the APIC
327 but not yet injected into the cpu core.
332 Architectures: x86, ppc
334 Parameters: struct kvm_sregs (in)
335 Returns: 0 on success, -1 on error
337 Writes special registers into the vcpu. See KVM_GET_SREGS for the
345 Parameters: struct kvm_translation (in/out)
346 Returns: 0 on success, -1 on error
348 Translates a virtual address according to the vcpu's current address
351 struct kvm_translation {
353 __u64 linear_address;
356 __u64 physical_address;
366 Architectures: x86, ppc
368 Parameters: struct kvm_interrupt (in)
369 Returns: 0 on success, -1 on error
371 Queues a hardware interrupt vector to be injected. This is only
372 useful if in-kernel local APIC or equivalent is not used.
374 /* for KVM_INTERRUPT */
375 struct kvm_interrupt {
382 Note 'irq' is an interrupt vector, not an interrupt pin or line.
386 Queues an external interrupt to be injected. This ioctl is overleaded
387 with 3 different irq values:
391 This injects an edge type external interrupt into the guest once it's ready
392 to receive interrupts. When injected, the interrupt is done.
394 b) KVM_INTERRUPT_UNSET
396 This unsets any pending interrupt.
398 Only available with KVM_CAP_PPC_UNSET_IRQ.
400 c) KVM_INTERRUPT_SET_LEVEL
402 This injects a level type external interrupt into the guest context. The
403 interrupt stays pending until a specific ioctl with KVM_INTERRUPT_UNSET
406 Only available with KVM_CAP_PPC_IRQ_LEVEL.
408 Note that any value for 'irq' other than the ones stated above is invalid
409 and incurs unexpected behavior.
419 Support for this has been removed. Use KVM_SET_GUEST_DEBUG instead.
426 Parameters: struct kvm_msrs (in/out)
427 Returns: 0 on success, -1 on error
429 Reads model-specific registers from the vcpu. Supported msr indices can
430 be obtained using KVM_GET_MSR_INDEX_LIST.
433 __u32 nmsrs; /* number of msrs in entries */
436 struct kvm_msr_entry entries[0];
439 struct kvm_msr_entry {
445 Application code should set the 'nmsrs' member (which indicates the
446 size of the entries array) and the 'index' member of each array entry.
447 kvm will fill in the 'data' member.
454 Parameters: struct kvm_msrs (in)
455 Returns: 0 on success, -1 on error
457 Writes model-specific registers to the vcpu. See KVM_GET_MSRS for the
460 Application code should set the 'nmsrs' member (which indicates the
461 size of the entries array), and the 'index' and 'data' members of each
469 Parameters: struct kvm_cpuid (in)
470 Returns: 0 on success, -1 on error
472 Defines the vcpu responses to the cpuid instruction. Applications
473 should use the KVM_SET_CPUID2 ioctl if available.
476 struct kvm_cpuid_entry {
485 /* for KVM_SET_CPUID */
489 struct kvm_cpuid_entry entries[0];
492 4.21 KVM_SET_SIGNAL_MASK
497 Parameters: struct kvm_signal_mask (in)
498 Returns: 0 on success, -1 on error
500 Defines which signals are blocked during execution of KVM_RUN. This
501 signal mask temporarily overrides the threads signal mask. Any
502 unblocked signal received (except SIGKILL and SIGSTOP, which retain
503 their traditional behaviour) will cause KVM_RUN to return with -EINTR.
505 Note the signal will only be delivered if not blocked by the original
508 /* for KVM_SET_SIGNAL_MASK */
509 struct kvm_signal_mask {
519 Parameters: struct kvm_fpu (out)
520 Returns: 0 on success, -1 on error
522 Reads the floating point state from the vcpu.
524 /* for KVM_GET_FPU and KVM_SET_FPU */
529 __u8 ftwx; /* in fxsave format */
544 Parameters: struct kvm_fpu (in)
545 Returns: 0 on success, -1 on error
547 Writes the floating point state to the vcpu.
549 /* for KVM_GET_FPU and KVM_SET_FPU */
554 __u8 ftwx; /* in fxsave format */
564 4.24 KVM_CREATE_IRQCHIP
566 Capability: KVM_CAP_IRQCHIP
567 Architectures: x86, ia64
570 Returns: 0 on success, -1 on error
572 Creates an interrupt controller model in the kernel. On x86, creates a virtual
573 ioapic, a virtual PIC (two PICs, nested), and sets up future vcpus to have a
574 local APIC. IRQ routing for GSIs 0-15 is set to both PIC and IOAPIC; GSI 16-23
575 only go to the IOAPIC. On ia64, a IOSAPIC is created.
579 Capability: KVM_CAP_IRQCHIP
580 Architectures: x86, ia64
582 Parameters: struct kvm_irq_level
583 Returns: 0 on success, -1 on error
585 Sets the level of a GSI input to the interrupt controller model in the kernel.
586 Requires that an interrupt controller model has been previously created with
587 KVM_CREATE_IRQCHIP. Note that edge-triggered interrupts require the level
588 to be set to 1 and then back to 0.
590 struct kvm_irq_level {
593 __s32 status; /* not used for KVM_IRQ_LEVEL */
595 __u32 level; /* 0 or 1 */
600 Capability: KVM_CAP_IRQCHIP
601 Architectures: x86, ia64
603 Parameters: struct kvm_irqchip (in/out)
604 Returns: 0 on success, -1 on error
606 Reads the state of a kernel interrupt controller created with
607 KVM_CREATE_IRQCHIP into a buffer provided by the caller.
610 __u32 chip_id; /* 0 = PIC1, 1 = PIC2, 2 = IOAPIC */
613 char dummy[512]; /* reserving space */
614 struct kvm_pic_state pic;
615 struct kvm_ioapic_state ioapic;
621 Capability: KVM_CAP_IRQCHIP
622 Architectures: x86, ia64
624 Parameters: struct kvm_irqchip (in)
625 Returns: 0 on success, -1 on error
627 Sets the state of a kernel interrupt controller created with
628 KVM_CREATE_IRQCHIP from a buffer provided by the caller.
631 __u32 chip_id; /* 0 = PIC1, 1 = PIC2, 2 = IOAPIC */
634 char dummy[512]; /* reserving space */
635 struct kvm_pic_state pic;
636 struct kvm_ioapic_state ioapic;
640 4.28 KVM_XEN_HVM_CONFIG
642 Capability: KVM_CAP_XEN_HVM
645 Parameters: struct kvm_xen_hvm_config (in)
646 Returns: 0 on success, -1 on error
648 Sets the MSR that the Xen HVM guest uses to initialize its hypercall
649 page, and provides the starting address and size of the hypercall
650 blobs in userspace. When the guest writes the MSR, kvm copies one
651 page of a blob (32- or 64-bit, depending on the vcpu mode) to guest
654 struct kvm_xen_hvm_config {
666 Capability: KVM_CAP_ADJUST_CLOCK
669 Parameters: struct kvm_clock_data (out)
670 Returns: 0 on success, -1 on error
672 Gets the current timestamp of kvmclock as seen by the current guest. In
673 conjunction with KVM_SET_CLOCK, it is used to ensure monotonicity on scenarios
676 struct kvm_clock_data {
677 __u64 clock; /* kvmclock current value */
684 Capability: KVM_CAP_ADJUST_CLOCK
687 Parameters: struct kvm_clock_data (in)
688 Returns: 0 on success, -1 on error
690 Sets the current timestamp of kvmclock to the value specified in its parameter.
691 In conjunction with KVM_GET_CLOCK, it is used to ensure monotonicity on scenarios
694 struct kvm_clock_data {
695 __u64 clock; /* kvmclock current value */
700 4.31 KVM_GET_VCPU_EVENTS
702 Capability: KVM_CAP_VCPU_EVENTS
703 Extended by: KVM_CAP_INTR_SHADOW
706 Parameters: struct kvm_vcpu_event (out)
707 Returns: 0 on success, -1 on error
709 Gets currently pending exceptions, interrupts, and NMIs as well as related
712 struct kvm_vcpu_events {
736 KVM_VCPUEVENT_VALID_SHADOW may be set in the flags field to signal that
737 interrupt.shadow contains a valid state. Otherwise, this field is undefined.
739 4.32 KVM_SET_VCPU_EVENTS
741 Capability: KVM_CAP_VCPU_EVENTS
742 Extended by: KVM_CAP_INTR_SHADOW
745 Parameters: struct kvm_vcpu_event (in)
746 Returns: 0 on success, -1 on error
748 Set pending exceptions, interrupts, and NMIs as well as related states of the
751 See KVM_GET_VCPU_EVENTS for the data structure.
753 Fields that may be modified asynchronously by running VCPUs can be excluded
754 from the update. These fields are nmi.pending and sipi_vector. Keep the
755 corresponding bits in the flags field cleared to suppress overwriting the
756 current in-kernel state. The bits are:
758 KVM_VCPUEVENT_VALID_NMI_PENDING - transfer nmi.pending to the kernel
759 KVM_VCPUEVENT_VALID_SIPI_VECTOR - transfer sipi_vector
761 If KVM_CAP_INTR_SHADOW is available, KVM_VCPUEVENT_VALID_SHADOW can be set in
762 the flags field to signal that interrupt.shadow contains a valid state and
763 shall be written into the VCPU.
765 4.33 KVM_GET_DEBUGREGS
767 Capability: KVM_CAP_DEBUGREGS
770 Parameters: struct kvm_debugregs (out)
771 Returns: 0 on success, -1 on error
773 Reads debug registers from the vcpu.
775 struct kvm_debugregs {
783 4.34 KVM_SET_DEBUGREGS
785 Capability: KVM_CAP_DEBUGREGS
788 Parameters: struct kvm_debugregs (in)
789 Returns: 0 on success, -1 on error
791 Writes debug registers into the vcpu.
793 See KVM_GET_DEBUGREGS for the data structure. The flags field is unused
794 yet and must be cleared on entry.
796 4.35 KVM_SET_USER_MEMORY_REGION
798 Capability: KVM_CAP_USER_MEM
801 Parameters: struct kvm_userspace_memory_region (in)
802 Returns: 0 on success, -1 on error
804 struct kvm_userspace_memory_region {
807 __u64 guest_phys_addr;
808 __u64 memory_size; /* bytes */
809 __u64 userspace_addr; /* start of the userspace allocated memory */
812 /* for kvm_memory_region::flags */
813 #define KVM_MEM_LOG_DIRTY_PAGES 1UL
815 This ioctl allows the user to create or modify a guest physical memory
816 slot. When changing an existing slot, it may be moved in the guest
817 physical memory space, or its flags may be modified. It may not be
818 resized. Slots may not overlap in guest physical address space.
820 Memory for the region is taken starting at the address denoted by the
821 field userspace_addr, which must point at user addressable memory for
822 the entire memory slot size. Any object may back this memory, including
823 anonymous memory, ordinary files, and hugetlbfs.
825 It is recommended that the lower 21 bits of guest_phys_addr and userspace_addr
826 be identical. This allows large pages in the guest to be backed by large
829 The flags field supports just one flag, KVM_MEM_LOG_DIRTY_PAGES, which
830 instructs kvm to keep track of writes to memory within the slot. See
831 the KVM_GET_DIRTY_LOG ioctl.
833 When the KVM_CAP_SYNC_MMU capability, changes in the backing of the memory
834 region are automatically reflected into the guest. For example, an mmap()
835 that affects the region will be made visible immediately. Another example
836 is madvise(MADV_DROP).
838 It is recommended to use this API instead of the KVM_SET_MEMORY_REGION ioctl.
839 The KVM_SET_MEMORY_REGION does not allow fine grained control over memory
840 allocation and is deprecated.
842 4.36 KVM_SET_TSS_ADDR
844 Capability: KVM_CAP_SET_TSS_ADDR
847 Parameters: unsigned long tss_address (in)
848 Returns: 0 on success, -1 on error
850 This ioctl defines the physical address of a three-page region in the guest
851 physical address space. The region must be within the first 4GB of the
852 guest physical address space and must not conflict with any memory slot
853 or any mmio address. The guest may malfunction if it accesses this memory
856 This ioctl is required on Intel-based hosts. This is needed on Intel hardware
857 because of a quirk in the virtualization implementation (see the internals
858 documentation when it pops into existence).
862 Capability: KVM_CAP_ENABLE_CAP
865 Parameters: struct kvm_enable_cap (in)
866 Returns: 0 on success; -1 on error
868 +Not all extensions are enabled by default. Using this ioctl the application
869 can enable an extension, making it available to the guest.
871 On systems that do not support this ioctl, it always fails. On systems that
872 do support it, it only works for extensions that are supported for enablement.
874 To check if a capability can be enabled, the KVM_CHECK_EXTENSION ioctl should
877 struct kvm_enable_cap {
881 The capability that is supposed to get enabled.
885 A bitfield indicating future enhancements. Has to be 0 for now.
889 Arguments for enabling a feature. If a feature needs initial values to
890 function properly, this is the place to put them.
895 4.38 KVM_GET_MP_STATE
897 Capability: KVM_CAP_MP_STATE
898 Architectures: x86, ia64
900 Parameters: struct kvm_mp_state (out)
901 Returns: 0 on success; -1 on error
903 struct kvm_mp_state {
907 Returns the vcpu's current "multiprocessing state" (though also valid on
908 uniprocessor guests).
912 - KVM_MP_STATE_RUNNABLE: the vcpu is currently running
913 - KVM_MP_STATE_UNINITIALIZED: the vcpu is an application processor (AP)
914 which has not yet received an INIT signal
915 - KVM_MP_STATE_INIT_RECEIVED: the vcpu has received an INIT signal, and is
917 - KVM_MP_STATE_HALTED: the vcpu has executed a HLT instruction and
918 is waiting for an interrupt
919 - KVM_MP_STATE_SIPI_RECEIVED: the vcpu has just received a SIPI (vector
920 accessible via KVM_GET_VCPU_EVENTS)
922 This ioctl is only useful after KVM_CREATE_IRQCHIP. Without an in-kernel
923 irqchip, the multiprocessing state must be maintained by userspace.
925 4.39 KVM_SET_MP_STATE
927 Capability: KVM_CAP_MP_STATE
928 Architectures: x86, ia64
930 Parameters: struct kvm_mp_state (in)
931 Returns: 0 on success; -1 on error
933 Sets the vcpu's current "multiprocessing state"; see KVM_GET_MP_STATE for
936 This ioctl is only useful after KVM_CREATE_IRQCHIP. Without an in-kernel
937 irqchip, the multiprocessing state must be maintained by userspace.
939 4.40 KVM_SET_IDENTITY_MAP_ADDR
941 Capability: KVM_CAP_SET_IDENTITY_MAP_ADDR
944 Parameters: unsigned long identity (in)
945 Returns: 0 on success, -1 on error
947 This ioctl defines the physical address of a one-page region in the guest
948 physical address space. The region must be within the first 4GB of the
949 guest physical address space and must not conflict with any memory slot
950 or any mmio address. The guest may malfunction if it accesses this memory
953 This ioctl is required on Intel-based hosts. This is needed on Intel hardware
954 because of a quirk in the virtualization implementation (see the internals
955 documentation when it pops into existence).
957 4.41 KVM_SET_BOOT_CPU_ID
959 Capability: KVM_CAP_SET_BOOT_CPU_ID
960 Architectures: x86, ia64
962 Parameters: unsigned long vcpu_id
963 Returns: 0 on success, -1 on error
965 Define which vcpu is the Bootstrap Processor (BSP). Values are the same
966 as the vcpu id in KVM_CREATE_VCPU. If this ioctl is not called, the default
971 Capability: KVM_CAP_XSAVE
974 Parameters: struct kvm_xsave (out)
975 Returns: 0 on success, -1 on error
981 This ioctl would copy current vcpu's xsave struct to the userspace.
985 Capability: KVM_CAP_XSAVE
988 Parameters: struct kvm_xsave (in)
989 Returns: 0 on success, -1 on error
995 This ioctl would copy userspace's xsave struct to the kernel.
999 Capability: KVM_CAP_XCRS
1002 Parameters: struct kvm_xcrs (out)
1003 Returns: 0 on success, -1 on error
1014 struct kvm_xcr xcrs[KVM_MAX_XCRS];
1018 This ioctl would copy current vcpu's xcrs to the userspace.
1022 Capability: KVM_CAP_XCRS
1025 Parameters: struct kvm_xcrs (in)
1026 Returns: 0 on success, -1 on error
1037 struct kvm_xcr xcrs[KVM_MAX_XCRS];
1041 This ioctl would set vcpu's xcr to the value userspace specified.
1043 4.46 KVM_GET_SUPPORTED_CPUID
1045 Capability: KVM_CAP_EXT_CPUID
1048 Parameters: struct kvm_cpuid2 (in/out)
1049 Returns: 0 on success, -1 on error
1054 struct kvm_cpuid_entry2 entries[0];
1057 #define KVM_CPUID_FLAG_SIGNIFCANT_INDEX 1
1058 #define KVM_CPUID_FLAG_STATEFUL_FUNC 2
1059 #define KVM_CPUID_FLAG_STATE_READ_NEXT 4
1061 struct kvm_cpuid_entry2 {
1072 This ioctl returns x86 cpuid features which are supported by both the hardware
1073 and kvm. Userspace can use the information returned by this ioctl to
1074 construct cpuid information (for KVM_SET_CPUID2) that is consistent with
1075 hardware, kernel, and userspace capabilities, and with user requirements (for
1076 example, the user may wish to constrain cpuid to emulate older hardware,
1077 or for feature consistency across a cluster).
1079 Userspace invokes KVM_GET_SUPPORTED_CPUID by passing a kvm_cpuid2 structure
1080 with the 'nent' field indicating the number of entries in the variable-size
1081 array 'entries'. If the number of entries is too low to describe the cpu
1082 capabilities, an error (E2BIG) is returned. If the number is too high,
1083 the 'nent' field is adjusted and an error (ENOMEM) is returned. If the
1084 number is just right, the 'nent' field is adjusted to the number of valid
1085 entries in the 'entries' array, which is then filled.
1087 The entries returned are the host cpuid as returned by the cpuid instruction,
1088 with unknown or unsupported features masked out. Some features (for example,
1089 x2apic), may not be present in the host cpu, but are exposed by kvm if it can
1090 emulate them efficiently. The fields in each entry are defined as follows:
1092 function: the eax value used to obtain the entry
1093 index: the ecx value used to obtain the entry (for entries that are
1095 flags: an OR of zero or more of the following:
1096 KVM_CPUID_FLAG_SIGNIFCANT_INDEX:
1097 if the index field is valid
1098 KVM_CPUID_FLAG_STATEFUL_FUNC:
1099 if cpuid for this function returns different values for successive
1100 invocations; there will be several entries with the same function,
1101 all with this flag set
1102 KVM_CPUID_FLAG_STATE_READ_NEXT:
1103 for KVM_CPUID_FLAG_STATEFUL_FUNC entries, set if this entry is
1104 the first entry to be read by a cpu
1105 eax, ebx, ecx, edx: the values returned by the cpuid instruction for
1106 this function/index combination
1108 The TSC deadline timer feature (CPUID leaf 1, ecx[24]) is always returned
1109 as false, since the feature depends on KVM_CREATE_IRQCHIP for local APIC
1110 support. Instead it is reported via
1112 ioctl(KVM_CHECK_EXTENSION, KVM_CAP_TSC_DEADLINE_TIMER)
1114 if that returns true and you use KVM_CREATE_IRQCHIP, or if you emulate the
1115 feature in userspace, then you can enable the feature for KVM_SET_CPUID2.
1117 4.47 KVM_PPC_GET_PVINFO
1119 Capability: KVM_CAP_PPC_GET_PVINFO
1122 Parameters: struct kvm_ppc_pvinfo (out)
1123 Returns: 0 on success, !0 on error
1125 struct kvm_ppc_pvinfo {
1131 This ioctl fetches PV specific information that need to be passed to the guest
1132 using the device tree or other means from vm context.
1134 For now the only implemented piece of information distributed here is an array
1135 of 4 instructions that make up a hypercall.
1137 If any additional field gets added to this structure later on, a bit for that
1138 additional piece of information will be set in the flags bitmap.
1140 4.48 KVM_ASSIGN_PCI_DEVICE
1142 Capability: KVM_CAP_DEVICE_ASSIGNMENT
1143 Architectures: x86 ia64
1145 Parameters: struct kvm_assigned_pci_dev (in)
1146 Returns: 0 on success, -1 on error
1148 Assigns a host PCI device to the VM.
1150 struct kvm_assigned_pci_dev {
1151 __u32 assigned_dev_id;
1161 The PCI device is specified by the triple segnr, busnr, and devfn.
1162 Identification in succeeding service requests is done via assigned_dev_id. The
1163 following flags are specified:
1165 /* Depends on KVM_CAP_IOMMU */
1166 #define KVM_DEV_ASSIGN_ENABLE_IOMMU (1 << 0)
1168 The KVM_DEV_ASSIGN_ENABLE_IOMMU flag is a mandatory option to ensure
1169 isolation of the device. Usages not specifying this flag are deprecated.
1171 Only PCI header type 0 devices with PCI BAR resources are supported by
1172 device assignment. The user requesting this ioctl must have read/write
1173 access to the PCI sysfs resource files associated with the device.
1175 4.49 KVM_DEASSIGN_PCI_DEVICE
1177 Capability: KVM_CAP_DEVICE_DEASSIGNMENT
1178 Architectures: x86 ia64
1180 Parameters: struct kvm_assigned_pci_dev (in)
1181 Returns: 0 on success, -1 on error
1183 Ends PCI device assignment, releasing all associated resources.
1185 See KVM_CAP_DEVICE_ASSIGNMENT for the data structure. Only assigned_dev_id is
1186 used in kvm_assigned_pci_dev to identify the device.
1188 4.50 KVM_ASSIGN_DEV_IRQ
1190 Capability: KVM_CAP_ASSIGN_DEV_IRQ
1191 Architectures: x86 ia64
1193 Parameters: struct kvm_assigned_irq (in)
1194 Returns: 0 on success, -1 on error
1196 Assigns an IRQ to a passed-through device.
1198 struct kvm_assigned_irq {
1199 __u32 assigned_dev_id;
1200 __u32 host_irq; /* ignored (legacy field) */
1208 The following flags are defined:
1210 #define KVM_DEV_IRQ_HOST_INTX (1 << 0)
1211 #define KVM_DEV_IRQ_HOST_MSI (1 << 1)
1212 #define KVM_DEV_IRQ_HOST_MSIX (1 << 2)
1214 #define KVM_DEV_IRQ_GUEST_INTX (1 << 8)
1215 #define KVM_DEV_IRQ_GUEST_MSI (1 << 9)
1216 #define KVM_DEV_IRQ_GUEST_MSIX (1 << 10)
1218 It is not valid to specify multiple types per host or guest IRQ. However, the
1219 IRQ type of host and guest can differ or can even be null.
1221 4.51 KVM_DEASSIGN_DEV_IRQ
1223 Capability: KVM_CAP_ASSIGN_DEV_IRQ
1224 Architectures: x86 ia64
1226 Parameters: struct kvm_assigned_irq (in)
1227 Returns: 0 on success, -1 on error
1229 Ends an IRQ assignment to a passed-through device.
1231 See KVM_ASSIGN_DEV_IRQ for the data structure. The target device is specified
1232 by assigned_dev_id, flags must correspond to the IRQ type specified on
1233 KVM_ASSIGN_DEV_IRQ. Partial deassignment of host or guest IRQ is allowed.
1235 4.52 KVM_SET_GSI_ROUTING
1237 Capability: KVM_CAP_IRQ_ROUTING
1238 Architectures: x86 ia64
1240 Parameters: struct kvm_irq_routing (in)
1241 Returns: 0 on success, -1 on error
1243 Sets the GSI routing table entries, overwriting any previously set entries.
1245 struct kvm_irq_routing {
1248 struct kvm_irq_routing_entry entries[0];
1251 No flags are specified so far, the corresponding field must be set to zero.
1253 struct kvm_irq_routing_entry {
1259 struct kvm_irq_routing_irqchip irqchip;
1260 struct kvm_irq_routing_msi msi;
1265 /* gsi routing entry types */
1266 #define KVM_IRQ_ROUTING_IRQCHIP 1
1267 #define KVM_IRQ_ROUTING_MSI 2
1269 No flags are specified so far, the corresponding field must be set to zero.
1271 struct kvm_irq_routing_irqchip {
1276 struct kvm_irq_routing_msi {
1283 4.53 KVM_ASSIGN_SET_MSIX_NR
1285 Capability: KVM_CAP_DEVICE_MSIX
1286 Architectures: x86 ia64
1288 Parameters: struct kvm_assigned_msix_nr (in)
1289 Returns: 0 on success, -1 on error
1291 Set the number of MSI-X interrupts for an assigned device. The number is
1292 reset again by terminating the MSI-X assignment of the device via
1293 KVM_DEASSIGN_DEV_IRQ. Calling this service more than once at any earlier
1296 struct kvm_assigned_msix_nr {
1297 __u32 assigned_dev_id;
1302 #define KVM_MAX_MSIX_PER_DEV 256
1304 4.54 KVM_ASSIGN_SET_MSIX_ENTRY
1306 Capability: KVM_CAP_DEVICE_MSIX
1307 Architectures: x86 ia64
1309 Parameters: struct kvm_assigned_msix_entry (in)
1310 Returns: 0 on success, -1 on error
1312 Specifies the routing of an MSI-X assigned device interrupt to a GSI. Setting
1313 the GSI vector to zero means disabling the interrupt.
1315 struct kvm_assigned_msix_entry {
1316 __u32 assigned_dev_id;
1318 __u16 entry; /* The index of entry in the MSI-X table */
1322 4.54 KVM_SET_TSC_KHZ
1324 Capability: KVM_CAP_TSC_CONTROL
1327 Parameters: virtual tsc_khz
1328 Returns: 0 on success, -1 on error
1330 Specifies the tsc frequency for the virtual machine. The unit of the
1333 4.55 KVM_GET_TSC_KHZ
1335 Capability: KVM_CAP_GET_TSC_KHZ
1339 Returns: virtual tsc-khz on success, negative value on error
1341 Returns the tsc frequency of the guest. The unit of the return value is
1342 KHz. If the host has unstable tsc this ioctl returns -EIO instead as an
1347 Capability: KVM_CAP_IRQCHIP
1350 Parameters: struct kvm_lapic_state (out)
1351 Returns: 0 on success, -1 on error
1353 #define KVM_APIC_REG_SIZE 0x400
1354 struct kvm_lapic_state {
1355 char regs[KVM_APIC_REG_SIZE];
1358 Reads the Local APIC registers and copies them into the input argument. The
1359 data format and layout are the same as documented in the architecture manual.
1363 Capability: KVM_CAP_IRQCHIP
1366 Parameters: struct kvm_lapic_state (in)
1367 Returns: 0 on success, -1 on error
1369 #define KVM_APIC_REG_SIZE 0x400
1370 struct kvm_lapic_state {
1371 char regs[KVM_APIC_REG_SIZE];
1374 Copies the input argument into the the Local APIC registers. The data format
1375 and layout are the same as documented in the architecture manual.
1379 Capability: KVM_CAP_IOEVENTFD
1382 Parameters: struct kvm_ioeventfd (in)
1383 Returns: 0 on success, !0 on error
1385 This ioctl attaches or detaches an ioeventfd to a legal pio/mmio address
1386 within the guest. A guest write in the registered address will signal the
1387 provided event instead of triggering an exit.
1389 struct kvm_ioeventfd {
1391 __u64 addr; /* legal pio/mmio address */
1392 __u32 len; /* 1, 2, 4, or 8 bytes */
1398 The following flags are defined:
1400 #define KVM_IOEVENTFD_FLAG_DATAMATCH (1 << kvm_ioeventfd_flag_nr_datamatch)
1401 #define KVM_IOEVENTFD_FLAG_PIO (1 << kvm_ioeventfd_flag_nr_pio)
1402 #define KVM_IOEVENTFD_FLAG_DEASSIGN (1 << kvm_ioeventfd_flag_nr_deassign)
1404 If datamatch flag is set, the event will be signaled only if the written value
1405 to the registered address is equal to datamatch in struct kvm_ioeventfd.
1407 4.62 KVM_CREATE_SPAPR_TCE
1409 Capability: KVM_CAP_SPAPR_TCE
1410 Architectures: powerpc
1412 Parameters: struct kvm_create_spapr_tce (in)
1413 Returns: file descriptor for manipulating the created TCE table
1415 This creates a virtual TCE (translation control entry) table, which
1416 is an IOMMU for PAPR-style virtual I/O. It is used to translate
1417 logical addresses used in virtual I/O into guest physical addresses,
1418 and provides a scatter/gather capability for PAPR virtual I/O.
1420 /* for KVM_CAP_SPAPR_TCE */
1421 struct kvm_create_spapr_tce {
1426 The liobn field gives the logical IO bus number for which to create a
1427 TCE table. The window_size field specifies the size of the DMA window
1428 which this TCE table will translate - the table will contain one 64
1429 bit TCE entry for every 4kiB of the DMA window.
1431 When the guest issues an H_PUT_TCE hcall on a liobn for which a TCE
1432 table has been created using this ioctl(), the kernel will handle it
1433 in real mode, updating the TCE table. H_PUT_TCE calls for other
1434 liobns will cause a vm exit and must be handled by userspace.
1436 The return value is a file descriptor which can be passed to mmap(2)
1437 to map the created TCE table into userspace. This lets userspace read
1438 the entries written by kernel-handled H_PUT_TCE calls, and also lets
1439 userspace update the TCE table directly which is useful in some
1442 4.63 KVM_ALLOCATE_RMA
1444 Capability: KVM_CAP_PPC_RMA
1445 Architectures: powerpc
1447 Parameters: struct kvm_allocate_rma (out)
1448 Returns: file descriptor for mapping the allocated RMA
1450 This allocates a Real Mode Area (RMA) from the pool allocated at boot
1451 time by the kernel. An RMA is a physically-contiguous, aligned region
1452 of memory used on older POWER processors to provide the memory which
1453 will be accessed by real-mode (MMU off) accesses in a KVM guest.
1454 POWER processors support a set of sizes for the RMA that usually
1455 includes 64MB, 128MB, 256MB and some larger powers of two.
1457 /* for KVM_ALLOCATE_RMA */
1458 struct kvm_allocate_rma {
1462 The return value is a file descriptor which can be passed to mmap(2)
1463 to map the allocated RMA into userspace. The mapped area can then be
1464 passed to the KVM_SET_USER_MEMORY_REGION ioctl to establish it as the
1465 RMA for a virtual machine. The size of the RMA in bytes (which is
1466 fixed at host kernel boot time) is returned in the rma_size field of
1467 the argument structure.
1469 The KVM_CAP_PPC_RMA capability is 1 or 2 if the KVM_ALLOCATE_RMA ioctl
1470 is supported; 2 if the processor requires all virtual machines to have
1471 an RMA, or 1 if the processor can use an RMA but doesn't require it,
1472 because it supports the Virtual RMA (VRMA) facility.
1476 Capability: KVM_CAP_USER_NMI
1480 Returns: 0 on success, -1 on error
1482 Queues an NMI on the thread's vcpu. Note this is well defined only
1483 when KVM_CREATE_IRQCHIP has not been called, since this is an interface
1484 between the virtual cpu core and virtual local APIC. After KVM_CREATE_IRQCHIP
1485 has been called, this interface is completely emulated within the kernel.
1487 To use this to emulate the LINT1 input with KVM_CREATE_IRQCHIP, use the
1488 following algorithm:
1491 - read the local APIC's state (KVM_GET_LAPIC)
1492 - check whether changing LINT1 will queue an NMI (see the LVT entry for LINT1)
1493 - if so, issue KVM_NMI
1496 Some guests configure the LINT1 NMI input to cause a panic, aiding in
1499 4.64 KVM_S390_UCAS_MAP
1501 Capability: KVM_CAP_S390_UCONTROL
1504 Parameters: struct kvm_s390_ucas_mapping (in)
1505 Returns: 0 in case of success
1507 The parameter is defined like this:
1508 struct kvm_s390_ucas_mapping {
1514 This ioctl maps the memory at "user_addr" with the length "length" to
1515 the vcpu's address space starting at "vcpu_addr". All parameters need to
1516 be alligned by 1 megabyte.
1518 4.65 KVM_S390_UCAS_UNMAP
1520 Capability: KVM_CAP_S390_UCONTROL
1523 Parameters: struct kvm_s390_ucas_mapping (in)
1524 Returns: 0 in case of success
1526 The parameter is defined like this:
1527 struct kvm_s390_ucas_mapping {
1533 This ioctl unmaps the memory in the vcpu's address space starting at
1534 "vcpu_addr" with the length "length". The field "user_addr" is ignored.
1535 All parameters need to be alligned by 1 megabyte.
1537 5. The kvm_run structure
1539 Application code obtains a pointer to the kvm_run structure by
1540 mmap()ing a vcpu fd. From that point, application code can control
1541 execution by changing fields in kvm_run prior to calling the KVM_RUN
1542 ioctl, and obtain information about the reason KVM_RUN returned by
1543 looking up structure members.
1547 __u8 request_interrupt_window;
1549 Request that KVM_RUN return when it becomes possible to inject external
1550 interrupts into the guest. Useful in conjunction with KVM_INTERRUPT.
1557 When KVM_RUN has returned successfully (return value 0), this informs
1558 application code why KVM_RUN has returned. Allowable values for this
1559 field are detailed below.
1561 __u8 ready_for_interrupt_injection;
1563 If request_interrupt_window has been specified, this field indicates
1564 an interrupt can be injected now with KVM_INTERRUPT.
1568 The value of the current interrupt flag. Only valid if in-kernel
1569 local APIC is not used.
1573 /* in (pre_kvm_run), out (post_kvm_run) */
1576 The value of the cr8 register. Only valid if in-kernel local APIC is
1577 not used. Both input and output.
1581 The value of the APIC BASE msr. Only valid if in-kernel local
1582 APIC is not used. Both input and output.
1585 /* KVM_EXIT_UNKNOWN */
1587 __u64 hardware_exit_reason;
1590 If exit_reason is KVM_EXIT_UNKNOWN, the vcpu has exited due to unknown
1591 reasons. Further architecture-specific information is available in
1592 hardware_exit_reason.
1594 /* KVM_EXIT_FAIL_ENTRY */
1596 __u64 hardware_entry_failure_reason;
1599 If exit_reason is KVM_EXIT_FAIL_ENTRY, the vcpu could not be run due
1600 to unknown reasons. Further architecture-specific information is
1601 available in hardware_entry_failure_reason.
1603 /* KVM_EXIT_EXCEPTION */
1613 #define KVM_EXIT_IO_IN 0
1614 #define KVM_EXIT_IO_OUT 1
1616 __u8 size; /* bytes */
1619 __u64 data_offset; /* relative to kvm_run start */
1622 If exit_reason is KVM_EXIT_IO, then the vcpu has
1623 executed a port I/O instruction which could not be satisfied by kvm.
1624 data_offset describes where the data is located (KVM_EXIT_IO_OUT) or
1625 where kvm expects application code to place the data for the next
1626 KVM_RUN invocation (KVM_EXIT_IO_IN). Data format is a packed array.
1629 struct kvm_debug_exit_arch arch;
1642 If exit_reason is KVM_EXIT_MMIO, then the vcpu has
1643 executed a memory-mapped I/O instruction which could not be satisfied
1644 by kvm. The 'data' member contains the written data if 'is_write' is
1645 true, and should be filled by application code otherwise.
1647 NOTE: For KVM_EXIT_IO, KVM_EXIT_MMIO and KVM_EXIT_OSI, the corresponding
1648 operations are complete (and guest state is consistent) only after userspace
1649 has re-entered the kernel with KVM_RUN. The kernel side will first finish
1650 incomplete operations and then check for pending signals. Userspace
1651 can re-enter the guest with an unmasked signal pending to complete
1654 /* KVM_EXIT_HYPERCALL */
1663 Unused. This was once used for 'hypercall to userspace'. To implement
1664 such functionality, use KVM_EXIT_IO (x86) or KVM_EXIT_MMIO (all except s390).
1665 Note KVM_EXIT_IO is significantly faster than KVM_EXIT_MMIO.
1667 /* KVM_EXIT_TPR_ACCESS */
1674 To be documented (KVM_TPR_ACCESS_REPORTING).
1676 /* KVM_EXIT_S390_SIEIC */
1679 __u64 mask; /* psw upper half */
1680 __u64 addr; /* psw lower half */
1687 /* KVM_EXIT_S390_RESET */
1688 #define KVM_S390_RESET_POR 1
1689 #define KVM_S390_RESET_CLEAR 2
1690 #define KVM_S390_RESET_SUBSYSTEM 4
1691 #define KVM_S390_RESET_CPU_INIT 8
1692 #define KVM_S390_RESET_IPL 16
1693 __u64 s390_reset_flags;
1697 /* KVM_EXIT_S390_UCONTROL */
1699 __u64 trans_exc_code;
1703 s390 specific. A page fault has occurred for a user controlled virtual
1704 machine (KVM_VM_S390_UNCONTROL) on it's host page table that cannot be
1705 resolved by the kernel.
1706 The program code and the translation exception code that were placed
1707 in the cpu's lowcore are presented here as defined by the z Architecture
1708 Principles of Operation Book in the Chapter for Dynamic Address Translation
1725 MOL uses a special hypercall interface it calls 'OSI'. To enable it, we catch
1726 hypercalls and exit with this exit struct that contains all the guest gprs.
1728 If exit_reason is KVM_EXIT_OSI, then the vcpu has triggered such a hypercall.
1729 Userspace can now handle the hypercall and when it's done modify the gprs as
1730 necessary. Upon guest entry all guest GPRs will then be replaced by the values
1733 /* KVM_EXIT_PAPR_HCALL */
1740 This is used on 64-bit PowerPC when emulating a pSeries partition,
1741 e.g. with the 'pseries' machine type in qemu. It occurs when the
1742 guest does a hypercall using the 'sc 1' instruction. The 'nr' field
1743 contains the hypercall number (from the guest R3), and 'args' contains
1744 the arguments (from the guest R4 - R12). Userspace should put the
1745 return code in 'ret' and any extra returned values in args[].
1746 The possible hypercalls are defined in the Power Architecture Platform
1747 Requirements (PAPR) document available from www.power.org (free
1748 developer registration required to access it).
1750 /* Fix the size of the union. */
1755 6. Capabilities that can be enabled
1757 There are certain capabilities that change the behavior of the virtual CPU when
1758 enabled. To enable them, please see section 4.37. Below you can find a list of
1759 capabilities and what their effect on the vCPU is when enabling them.
1761 The following information is provided along with the description:
1763 Architectures: which instruction set architectures provide this ioctl.
1764 x86 includes both i386 and x86_64.
1766 Parameters: what parameters are accepted by the capability.
1768 Returns: the return value. General error numbers (EBADF, ENOMEM, EINVAL)
1769 are not detailed, but errors with specific meanings are.
1775 Returns: 0 on success; -1 on error
1777 This capability enables interception of OSI hypercalls that otherwise would
1778 be treated as normal system calls to be injected into the guest. OSI hypercalls
1779 were invented by Mac-on-Linux to have a standardized communication mechanism
1780 between the guest and the host.
1782 When this capability is enabled, KVM_EXIT_OSI can occur.
1784 6.2 KVM_CAP_PPC_PAPR
1788 Returns: 0 on success; -1 on error
1790 This capability enables interception of PAPR hypercalls. PAPR hypercalls are
1791 done using the hypercall instruction "sc 1".
1793 It also sets the guest privilege level to "supervisor" mode. Usually the guest
1794 runs in "hypervisor" privilege mode with a few missing features.
1796 In addition to the above, it changes the semantics of SDR1. In this mode, the
1797 HTAB address part of SDR1 contains an HVA instead of a GPA, as PAPR keeps the
1798 HTAB invisible to the guest.
1800 When this capability is enabled, KVM_EXIT_PAPR_HCALL can occur.