Skip to content

KVM_RUN call returns zero

docs.kernel.org • November 6, 2026

The kvm API is centered around different kinds of file descriptors and ioctls that can be issued to these file descriptors. An initial open(“/dev/kvm”) obtains a handle to the kvm subsystem; this handle can be used to issue system ioctls. A KVM_CREATE_VM ioctl on this handle will create a VM file descriptor which can be used to issue VM ioctls. A KVM_CREATE_VCPU or KVM_CREATE_DEVICE ioctl on a VM fd will create a virtual cpu or device and return a file descriptor pointing to the new resource.

In other words, the kvm API is a set of ioctls that are issued to different kinds of file descriptor in order to control various aspects of a virtual machine. Depending on the file descriptor that accepts them, ioctls belong to the following classes:

System ioctls: These query and set global attributes which affect the whole kvm subsystem. In addition a system ioctl is used to create virtual machines. VM ioctls: These query and set attributes that affect an entire virtual machine, for example memory layout. In addition a VM ioctl is used to create virtual cpus (vcpus) and devices. VM ioctls must be issued from the same process (address space) that was used to create the VM. vcpu ioctls: These query and set attributes that control the operation of a single virtual cpu. vcpu ioctls should be issued from the same thread that was used to create the vcpu, except for asynchronous vcpu ioctl that are marked as such in the documentation. Otherwise, the first ioctl after switching threads could see a performance impact. device ioctls: These query and set attributes that control the operation of a single device. device ioctls must be issued from the same process (address space) that was used to create the VM.

System ioctls: These query and set global attributes which affect the whole kvm subsystem. In addition a system ioctl is used to create virtual machines.

System ioctls: These query and set global attributes which affect the whole kvm subsystem. In addition a system ioctl is used to create virtual machines.

VM ioctls: These query and set attributes that affect an entire virtual machine, for example memory layout. In addition a VM ioctl is used to create virtual cpus (vcpus) and devices. VM ioctls must be issued from the same process (address space) that was used to create the VM.

VM ioctls: These query and set attributes that affect an entire virtual machine, for example memory layout. In addition a VM ioctl is used to create virtual cpus (vcpus) and devices.

VM ioctls must be issued from the same process (address space) that was used to create the VM.

vcpu ioctls: These query and set attributes that control the operation of a single virtual cpu. vcpu ioctls should be issued from the same thread that was used to create the vcpu, except for asynchronous vcpu ioctl that are marked as such in the documentation. Otherwise, the first ioctl after switching threads could see a performance impact.

vcpu ioctls: These query and set attributes that control the operation of a single virtual cpu.

vcpu ioctls should be issued from the same thread that was used to create the vcpu, except for asynchronous vcpu ioctl that are marked as such in the documentation. Otherwise, the first ioctl after switching threads could see a performance impact.

device ioctls: These query and set attributes that control the operation of a single device. device ioctls must be issued from the same process (address space) that was used to create the VM.

device ioctls: These query and set attributes that control the operation of a single device.

device ioctls must be issued from the same process (address space) that was used to create the VM.

While most ioctls are specific to one kind of file descriptor, in some cases the same ioctl can belong to more than one class.

The KVM API grew over time. For this reason, KVM defines many constants of the form KVM_CAP_* , each corresponding to a set of functionality provided by one or more ioctls. Availability of these “capabilities” can be checked with KVM_CHECK_EXTENSION . Some capabilities also need to be enabled for VMs or VCPUs where their functionality is desired (see 6. Capabilities that can be enabled on vCPUs and 7. Capabilities that can be enabled on VMs ).

In general file descriptors can be migrated among processes by means of fork() and the SCM_RIGHTS facility of unix domain socket. These kinds of tricks are explicitly not supported by kvm. While they will not cause harm to the host, their actual behavior is not guaranteed by the API. See “General description” for details on the ioctl usage model that is supported by KVM.

It is important to note that although VM ioctls may only be issued from the process that created the VM, a VM’s lifecycle is associated with its file descriptor, not its creator (process). In other words, the VM and its resources, including the associated address space , are not freed until the last reference to the VM’s file descriptor has been released. For example, if fork() is issued after ioctl(KVM_CREATE_VM), the VM will not be freed until both the parent (original) process and its child have put their references to the VM’s file descriptor.

Because a VM’s resources are not freed until the last reference to its file descriptor is released, creating additional references to a VM via fork(), dup() , etc... without careful consideration is strongly discouraged and may have unwanted side effects, e.g. memory allocated by and on behalf of the VM’s process may not be freed/unaccounted when the VM is shut down.

As of Linux 2.6.22, the KVM ABI has been stabilized: no backward incompatible change are allowed. However, there is an extension facility that allows backward-compatible extensions to the API to be queried and used.

The extension mechanism is not based on the Linux version number. Instead, kvm defines extension identifiers and a facility to query whether a particular extension identifier is available. If it is, a set of ioctls is available for application use.

This section describes ioctls that can be used to control kvm guests. For each ioctl, the following information is provided along with a description:

Capability: which KVM extension provides this ioctl. Can be ‘basic’, which means that is will be provided by any kernel that supports API version 12 (see KVM_GET_API_VERSION ), or a KVM_CAP_xyz constant that can be checked with KVM_CHECK_EXTENSION . Architectures: which instruction set architectures provide this ioctl. x86 includes both i386 and x86_64. Type: system, vm, vcpu or guest_memfd. Parameters: what parameters are accepted by the ioctl. Returns: the return value. General error numbers (EBADF, ENOMEM, EINVAL) are not detailed, but errors with specific meanings are.

which KVM extension provides this ioctl. Can be ‘basic’, which means that is will be provided by any kernel that supports API version 12 (see KVM_GET_API_VERSION ), or a KVM_CAP_xyz constant that can be checked with KVM_CHECK_EXTENSION .

which instruction set architectures provide this ioctl. x86 includes both i386 and x86_64.

system, vm, vcpu or guest_memfd.

what parameters are accepted by the ioctl.

the return value. General error numbers (EBADF, ENOMEM, EINVAL) are not detailed, but errors with specific meanings are.

4.1 KVM_GET_API_VERSION ¶

the constant KVM_API_VERSION (=12)

This identifies the API version as the stable kvm API. It is not expected that this number will change. However, Linux 2.6.20 and 2.6.21 report earlier versions; these are not documented and not supported. Applications should refuse to run if KVM_GET_API_VERSION returns a value other than 12. If this check passes, all ioctls described as ‘basic’ will be available.

machine type identifier (KVM_VM_*)

a VM fd that can be used to control the new virtual machine.

The new VM has no virtual cpus and no memory. You probably want to use 0 as machine type.

Supported X86 VM types can be queried via KVM_CAP_VM_TYPES.

In order to create user controlled virtual machines on S390, check KVM_CAP_S390_UCONTROL and use the flag KVM_VM_S390_UCONTROL as privileged user (CAP_SYS_ADMIN).

To use hardware assisted virtualization on MIPS (VZ ASE) rather than the default trap & emulate implementation (which changes the virtual memory layout to fit in user mode), check KVM_CAP_MIPS_VZ and use the flag KVM_VM_MIPS_VZ.

On arm64, the physical address size for a VM (IPA Size limit) is limited to 40bits by default. The limit can be configured if the host supports the extension KVM_CAP_ARM_VM_IPA_SIZE. When supported, use KVM_VM_TYPE_ARM_IPA_SIZE(IPA_Bits) to set the size in the machine type identifier, where IPA_Bits is the maximum width of any physical address used by the VM. The IPA_Bits is encoded in bits[7-0] of the machine type identifier.

e.g, to configure a guest to use 48bit physical address size:

The requested size (IPA_Bits) must be:

0 Implies default size, 40bits (for backward compatibility) N Implies N bits, where N is a positive integer such that, 32 = 128 * max_vq will fail with ENOENT. max_vq is the vcpu’s maximum supported vector length in 128-bit quadwords: see [ 2 ] below.

These registers are only accessible on vcpus for which SVE is enabled. See KVM_ARM_VCPU_INIT for details.

In addition, except for KVM_REG_ARM64_SVE_VLS, these registers are not accessible until the vcpu’s SVE configuration has been finalized using KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE). See KVM_ARM_VCPU_INIT and KVM_ARM_VCPU_FINALIZE for more information this procedure.

KVM_REG_ARM64_SVE_VLS is a pseudo-register that allows the set of vector lengths supported by the vcpu to be discovered and configured by userspace. When transferred to or from user memory via KVM_GET_ONE_REG or KVM_SET_ONE_REG, the value of this register is of type __u64[KVM_ARM64_SVE_VLS_WORDS], and encodes the set of vector lengths as follows:

(See Scalable Vector Extension support for AArch64 Linux for an explanation of the “vq” nomenclature.)

KVM_REG_ARM64_SVE_VLS is only accessible after KVM_ARM_VCPU_INIT. KVM_ARM_VCPU_INIT initialises it to the best set of vector lengths that the host supports.

Userspace may subsequently modify it if desired until the vcpu’s SVE configuration is finalized using KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE).

Apart from simply removing all vector lengths from the host set that exceed some value, support for arbitrarily chosen sets of vector lengths is hardware-dependent and may not be available. Attempting to configure an invalid set of vector lengths via KVM_SET_ONE_REG will fail with EINVAL.

After the vcpu’s SVE configuration is finalized, further attempts to write this register will fail with EPERM.

arm64 bitmap feature firmware pseudo-registers have the following bit pattern:

The bitmap feature firmware registers exposes the hypercall services that are available for userspace to configure. The set bits corresponds to the services that are available for the guests to access. By default, KVM sets all the supported bits during VM initialization. The userspace can discover the available services via KVM_GET_ONE_REG, and write back the bitmap corresponding to the features that it wishes guests to see via KVM_SET_ONE_REG.

Note: These registers are immutable once any of the vCPUs of the VM has run at least once. A KVM_SET_ONE_REG in such a scenario will return a -EBUSY to userspace.

(See KVM/arm64-specific hypercalls exposed to guests for more details.)

MIPS registers are mapped using the lower 32 bits. The upper 16 of that is the register group type:

MIPS core registers (see above) have the following id bit patterns:

MIPS CP0 registers (see KVM_REG_MIPS_CP0_* above) have the following id bit patterns depending on whether they’re 32-bit or 64-bit registers:

Note: KVM_REG_MIPS_CP0_ENTRYLO0 and KVM_REG_MIPS_CP0_ENTRYLO1 are the MIPS64 versions of the EntryLo registers regardless of the word size of the host hardware, host kernel, guest, and whether XPA is present in the guest, i.e. with the RI and XI bits (if they exist) in bits 63 and 62 respectively, and the PFNX field starting at bit 30.

MIPS MAARs (see KVM_REG_MIPS_CP0_MAAR(*) above) have the following id bit patterns:

MIPS KVM control registers (see above) have the following id bit patterns:

MIPS FPU registers (see KVM_REG_MIPS_FPR_{32,64}() above) have the following id bit patterns depending on the size of the register being accessed. They are always accessed according to the current guest FPU mode (Status.FR and Config5.FRE), i.e. as the guest would see them, and they become unpredictable if the guest FPU mode is changed. MIPS SIMD Architecture (MSA) vector registers (see KVM_REG_MIPS_VEC_128() above) have similar patterns as they overlap the FPU registers:

MIPS FPU control registers (see KVM_REG_MIPS_FCR_{IR,CSR} above) have the following id bit patterns:

MIPS MSA control registers (see KVM_REG_MIPS_MSA_{IR,CSR} above) have the following id bit patterns:

RISC-V registers are mapped using the lower 32 bits. The upper 8 bits of that is the register group type.

RISC-V config registers are meant for configuring a Guest VCPU and it has the following id bit patterns:

Following are the RISC-V config registers:

0x80x0 0000 0100 0000

ISA feature bitmap of Guest VCPU

The isa config register can be read anytime but can only be written before a Guest VCPU runs. It will have ISA feature bits matching underlying host set by default.

RISC-V core registers represent the general execution state of a Guest VCPU and it has the following id bit patterns:

Following are the RISC-V core registers:

0x80x0 0000 0200 0000

0x80x0 0000 0200 0001

0x80x0 0000 0200 0002

0x80x0 0000 0200 0003

0x80x0 0000 0200 0004

0x80x0 0000 0200 0005

Caller saved register 0

0x80x0 0000 0200 0006

Caller saved register 1

0x80x0 0000 0200 0007

Caller saved register 2

0x80x0 0000 0200 0008

Callee saved register 0

0x80x0 0000 0200 0009

Callee saved register 1

0x80x0 0000 0200 000a

Function argument (or return value) 0

0x80x0 0000 0200 000b

Function argument (or return value) 1

0x80x0 0000 0200 000c

0x80x0 0000 0200 000d

0x80x0 0000 0200 000e

0x80x0 0000 0200 000f

0x80x0 0000 0200 0010

0x80x0 0000 0200 0011

0x80x0 0000 0200 0012

Callee saved register 2

0x80x0 0000 0200 0013

Callee saved register 3

0x80x0 0000 0200 0014

Callee saved register 4

0x80x0 0000 0200 0015

Callee saved register 5

0x80x0 0000 0200 0016

Callee saved register 6

0x80x0 0000 0200 0017

Callee saved register 7

0x80x0 0000 0200 0018

Callee saved register 8

0x80x0 0000 0200 0019

Callee saved register 9

0x80x0 0000 0200 001a

Callee saved register 10

0x80x0 0000 0200 001b

Callee saved register 11

0x80x0 0000 0200 001c

Caller saved register 3

0x80x0 0000 0200 001d

Caller saved register 4

0x80x0 0000 0200 001e

Caller saved register 5

0x80x0 0000 0200 001f

Caller saved register 6

0x80x0 0000 0200 0020

Privilege mode (1 = S-mode or 0 = U-mode)

RISC-V csr registers represent the supervisor mode control/status registers of a Guest VCPU and it has the following id bit patterns:

Following are the RISC-V csr registers:

0x80x0 0000 0300 0000

0x80x0 0000 0300 0001

Supervisor interrupt enable

0x80x0 0000 0300 0002

Supervisor trap vector base

0x80x0 0000 0300 0003

Supervisor scratch register

0x80x0 0000 0300 0004

Supervisor exception program counter

0x80x0 0000 0300 0005

Supervisor trap cause

0x80x0 0000 0300 0006

Supervisor bad address or instruction

0x80x0 0000 0300 0007

Supervisor interrupt pending

0x80x0 0000 0300 0008

Supervisor address translation and protection

RISC-V timer registers represent the timer state of a Guest VCPU and it has the following id bit patterns:

Following are the RISC-V timer registers:

0x8030 0000 0400 0000

Time base frequency (read-only)

0x8030 0000 0400 0001

Time value visible to Guest

0x8030 0000 0400 0002

Time compare programmed by Guest

0x8030 0000 0400 0003

Time compare state (1 = ON or 0 = OFF)

RISC-V F-extension registers represent the single precision floating point state of a Guest VCPU and it has the following id bit patterns:

Following are the RISC-V F-extension registers:

0x8020 0000 0500 0000

Floating point register 0

0x8020 0000 0500 001f

Floating point register 31

0x8020 0000 0500 0020

Floating point control and status register

RISC-V D-extension registers represent the double precision floating point state of a Guest VCPU and it has the following id bit patterns:

Following are the RISC-V D-extension registers:

0x8030 0000 0600 0000

Floating point register 0

0x8030 0000 0600 001f

Floating point register 31

0x8020 0000 0600 0020

Floating point control and status register

LoongArch registers are mapped using the lower 32 bits. The upper 16 bits of that is the register group type.

LoongArch csr registers are used to control guest cpu or get status of guest cpu, and they have the following id bit patterns:

LoongArch KVM control registers are used to implement some new defined functions such as set vcpu counter or reset vcpu, and they have the following id bit patterns:

0x2030 0002

Following are the KVM-defined registers for x86:

0x2030 0003 0000 0000

4.69 KVM_GET_ONE_REG ¶

struct kvm_one_reg (in and out)

0 on success, negative value on failure

ENOENT no such register EINVAL invalid register ID, or no such register or used with VMs in protected virtualization mode on s390 EPERM (arm64) register access not allowed before vcpu finalization, or after a protected VM’s vcpu has run

invalid register ID, or no such register or used with VMs in protected virtualization mode on s390

(arm64) register access not allowed before vcpu finalization, or after a protected VM’s vcpu has run

(These error codes are indicative only: do not rely on a specific error code being returned in a specific situation.)

This ioctl allows to receive the value of a single register implemented in a vcpu. The register to read is indicated by the “id” field of the kvm_one_reg struct passed in. On success, the register value can be found at the memory location pointed to by “addr”.

The list of registers accessible using this interface is identical to the list in 4.68.

4.70 KVM_KVMCLOCK_CTRL ¶

KVM_CAP_KVMCLOCK_CTRL

Any that implement pvclocks (currently x86 only)

0 on success, -1 on error

This ioctl sets a flag accessible to the guest indicating that the specified vCPU has been paused by the host userspace.

The host will set a flag in the pvclock structure that is checked from the soft lockup watchdog. The flag is part of the pvclock structure that is shared between guest and host, specifically the second bit of the flags field of the pvclock_vcpu_time_info structure. It will be set exclusively by the host and read/cleared exclusively by the guest. The guest operation of checking and clearing the flag must be an atomic operation so load-link/store-conditional, or equivalent must be used. There are two cases where the guest will clear the flag: when the soft lockup watchdog timer resets itself or when a soft lockup is detected. This ioctl can be called any time after pausing the vcpu, but before it is resumed.

4.71 KVM_SIGNAL_MSI ¶

>0 on delivery, 0 if guest blocked the MSI, and -1 on error

Directly inject a MSI message. Only valid with in-kernel irqchip that handles MSI messages.

KVM_MSI_VALID_DEVID: devid contains a valid value. The per-VM KVM_CAP_MSI_DEVID capability advertises the requirement to provide the device ID. If this capability is not available, userspace should never set the KVM_MSI_VALID_DEVID flag as the ioctl might fail.

If KVM_MSI_VALID_DEVID is set, devid contains a unique device identifier for the device that wrote the MSI message. For PCI, this is usually a BDF identifier in the lower 16 bits.

On x86, address_hi is ignored unless the KVM_X2APIC_API_USE_32BIT_IDS feature of KVM_CAP_X2APIC_API capability is enabled. If it is enabled, address_hi bits 31-8 provide bits 31-8 of the destination id. Bits 7-0 of address_hi must be zero.

4.71 KVM_CREATE_PIT2 ¶

struct kvm_pit_config (in)

0 on success, -1 on error

Creates an in-kernel device model for the i8254 PIT. This call is only valid after enabling in-kernel irqchip support via KVM_CREATE_IRQCHIP. The following parameters have to be passed:

PIT timer interrupts may use a per-VM kernel thread for injection. If it exists, this thread will have a name of the following pattern:

When running a guest with elevated priorities, the scheduling parameters of this thread may have to be adjusted accordingly.

This IOCTL replaces the obsolete KVM_CREATE_PIT.

struct kvm_pit_state2 (out)

0 on success, -1 on error

Retrieves the state of the in-kernel PIT model. Only valid after KVM_CREATE_PIT2. The state is returned in the following structure:

This IOCTL replaces the obsolete KVM_GET_PIT.

struct kvm_pit_state2 (in)

0 on success, -1 on error

Sets the state of the in-kernel PIT model. Only valid after KVM_CREATE_PIT2. See KVM_GET_PIT2 for details on struct kvm_pit_state2 .

KVM_SET_PIT2 strictly adheres to the spec of Intel 8254 PIT. For example, a count value of 0 in struct kvm_pit_channel_state is interpreted as 65536, which is the maximum count value. Refer to Intel 8254 programmable interval timer .

This IOCTL replaces the obsolete KVM_SET_PIT.

4.74 KVM_PPC_GET_SMMU_INFO ¶

KVM_CAP_PPC_GET_SMMU_INFO

0 on success, -1 on error

This populates and returns a structure describing the features of the “Server” class MMU emulation supported by KVM. This can in turn be used by userspace to generate the appropriate device-tree properties for the guest operating system.

The structure contains some global information, followed by an array of supported segment page sizes:

The supported flags are:

KVM_PPC_PAGE_SIZES_REAL: When that flag is set, guest page sizes must “fit” the backing store page sizes. When not set, any page size in the list can be used regardless of how they are backed by userspace. KVM_PPC_1T_SEGMENTS The emulated MMU supports 1T segments in addition to the standard 256M ones. KVM_PPC_NO_HASH This flag indicates that HPT guests are not supported by KVM, thus all guests must use radix MMU mode.

KVM_PPC_PAGE_SIZES_REAL: When that flag is set, guest page sizes must “fit” the backing store page sizes. When not set, any page size in the list can be used regardless of how they are backed by userspace.

When that flag is set, guest page sizes must “fit” the backing store page sizes. When not set, any page size in the list can be used regardless of how they are backed by userspace.

KVM_PPC_1T_SEGMENTS The emulated MMU supports 1T segments in addition to the standard 256M ones.

The emulated MMU supports 1T segments in addition to the standard 256M ones.

KVM_PPC_NO_HASH This flag indicates that HPT guests are not supported by KVM, thus all guests must use radix MMU mode.

This flag indicates that HPT guests are not supported by KVM, thus all guests must use radix MMU mode.

The “slb_size” field indicates how many SLB entries are supported

The “sps” array contains 8 entries indicating the supported base page sizes for a segment in increasing order. Each entry is defined as follow:

An entry with a “page_shift” of 0 is unused. Because the array is organized in increasing order, a lookup can stop when encountering such an entry.

The “slb_enc” field provides the encoding to use in the SLB for the page size. The bits are in positions such as the value can directly be OR’ed into the “vsid” argument of the slbmte instruction.

The “enc” array is a list which for each of those segment base page size provides the list of supported actual page sizes (which can be only larger or equal to the base page size), along with the corresponding encoding in the hash PTE. Similarly, the array is 8 entries sorted by increasing sizes and an entry with a “0” shift is an empty entry and a terminator:

The “pte_enc” field provides a value that can OR’ed into the hash PTE’s RPN field (ie, it needs to be shifted left by 12 to OR it into the hash PTE second double word).

struct kvm_irqfd (in)

0 on success, -1 on error

Allows setting an eventfd to directly trigger a guest interrupt. kvm_irqfd.fd specifies the file descriptor to use as the eventfd and kvm_irqfd.gsi specifies the irqchip pin toggled by this event. When an event is triggered on the eventfd, an interrupt is injected into the guest using the specified gsi pin. The irqfd is removed using the KVM_IRQFD_FLAG_DEASSIGN flag, specifying both kvm_irqfd.fd and kvm_irqfd.gsi.

With KVM_CAP_IRQFD_RESAMPLE, KVM_IRQFD supports a de-assert and notify mechanism allowing emulation of level-triggered, irqfd-based interrupts. When KVM_IRQFD_FLAG_RESAMPLE is set the user must pass an additional eventfd in the kvm_irqfd.resamplefd field. When operating in resample mode, posting of an interrupt through kvm_irq.fd asserts the specified gsi in the irqchip. When the irqchip is resampled, such as from an EOI, the gsi is de-asserted and the user is notified via kvm_irqfd.resamplefd. It is the user’s responsibility to re-queue the interrupt if the device making use of it still requires service. Note that closing the resamplefd is not sufficient to disable the irqfd. The KVM_IRQFD_FLAG_RESAMPLE is only necessary on assignment and need not be specified with KVM_IRQFD_FLAG_DEASSIGN.

On arm64, gsi routing being supported, the following can happen:

in case no routing entry is associated to this gsi, injection fails

in case no routing entry is associated to this gsi, injection fails

in case the gsi is associated to an irqchip routing entry, irqchip.pin + 32 corresponds to the injected SPI ID.

in case the gsi is associated to an irqchip routing entry, irqchip.pin + 32 corresponds to the injected SPI ID.

in case the gsi is associated to an MSI routing entry, the MSI message and device ID are translated into an LPI (support restricted to GICv3 ITS in-kernel emulation).

in case the gsi is associated to an MSI routing entry, the MSI message and device ID are translated into an LPI (support restricted to GICv3 ITS in-kernel emulation).

4.76 KVM_PPC_ALLOCATE_HTAB ¶

KVM_CAP_PPC_ALLOC_HTAB

Pointer to u32 containing hash table order (in/out)

0 on success, -1 on error

This requests the host kernel to allocate an MMU hash table for a guest using the PAPR paravirtualization interface. This only does anything if the kernel is configured to use the Book 3S HV style of virtualization. Otherwise the capability doesn’t exist and the ioctl returns an ENOTTY error. The rest of this description assumes Book 3S HV.

There must be no vcpus running when this ioctl is called; if there are, it will do nothing and return an EBUSY error.

The parameter is a pointer to a 32-bit unsigned integer variable containing the order (log base 2) of the desired size of the hash table, which must be between 18 and 46. On successful return from the ioctl, the value will not be changed by the kernel.

If no hash table has been allocated when any vcpu is asked to run (with the KVM_RUN ioctl), the host kernel will allocate a default-sized hash table (16 MB).

If this ioctl is called when a hash table has already been allocated, with a different order from the existing hash table, the existing hash table will be freed and a new one allocated. If this is ioctl is called when a hash table has already been allocated of the same order as specified, the kernel will clear out the existing hash table (zero all HPTEs). In either case, if the guest is using the virtualized real-mode area (VRMA) facility, the kernel will re-create the VMRA HPTEs on the KVM_RUN of any vcpu.

4.77 KVM_S390_INTERRUPT ¶

struct kvm_s390_interrupt (in)

0 on success, -1 on error

Allows to inject an interrupt to the guest. Interrupts can be floating (vm ioctl) or per cpu (vcpu ioctl), depending on the interrupt type.

Interrupt parameters are passed via kvm_s390_interrupt:

type can be one of the following:

sigp stop; optional flags in parm

sigp stop; optional flags in parm

program check; code in parm

program check; code in parm

sigp set prefix; prefix address in parm

sigp set prefix; prefix address in parm

clock comparator interrupt

clock comparator interrupt

virtio external interrupt; external interrupt parameters in parm and parm64

virtio external interrupt; external interrupt parameters in parm and parm64

sclp external interrupt; sclp parameter in parm

sclp external interrupt; sclp parameter in parm

sigp emergency; source cpu in parm

sigp emergency; source cpu in parm

sigp external call; source cpu in parm

sigp external call; source cpu in parm

compound value to indicate an I/O interrupt (ai - adapter interrupt; cssid,ssid,schid - subchannel); I/O interruption parameters in parm (subchannel) and parm64 (intparm, interruption subclass)

compound value to indicate an I/O interrupt (ai - adapter interrupt; cssid,ssid,schid - subchannel); I/O interruption parameters in parm (subchannel) and parm64 (intparm, interruption subclass)

machine check interrupt; cr 14 bits in parm, machine check interrupt code in parm64 (note that machine checks needing further payload are not supported by this ioctl)

machine check interrupt; cr 14 bits in parm, machine check interrupt code in parm64 (note that machine checks needing further payload are not supported by this ioctl)

This is an asynchronous vcpu ioctl and can be invoked from any thread.

4.78 KVM_PPC_GET_HTAB_FD ¶

Pointer to struct kvm_get_htab_fd (in)

file descriptor number (>= 0) on success, -1 on error

This returns a file descriptor that can be used either to read out the entries in the guest’s hashed page table (HPT), or to write entries to initialize the HPT. The returned fd can only be written to if the KVM_GET_HTAB_WRITE bit is set in the flags field of the argument, and can only be read if that bit is clear. The argument struct looks like this:

The ‘start_index’ field gives the index in the HPT of the entry at which to start reading. It is ignored when writing.

Reads on the fd will initially supply information all “interesting” HPT entries. Interesting entries are those with the bolted bit set, if the KVM_GET_HTAB_BOLTED_ONLY bit is set, otherwise all entries. When the end of the HPT is reached, the read() will return. If read() is called again on the fd, it will start again from the beginning of the HPT, but will only return HPT entries that have changed since they were last read.

Data read or written is structured as a header (8 bytes) followed by a series of valid HPT entries (16 bytes) each. The header indicates how many valid HPT entries there are and how many invalid entries follow the valid entries. The invalid entries are not represented explicitly in the stream. The header format is:

Writes to the fd create HPT entries starting at the index given in the header; first ‘n_valid’ valid entries with contents from the data written, then ‘n_invalid’ invalid entries, invalidating any previously valid entries found.

4.79 KVM_CREATE_DEVICE ¶

struct kvm_create_device (in/out)

0 on success, -1 on error

ENODEV The device type is unknown or unsupported EEXIST Device already created, and this type of device may not be instantiated multiple times Other error conditions may be defined by individual device types or have their standard meanings.

The device type is unknown or unsupported

Device already created, and this type of device may not be instantiated multiple times

Other error conditions may be defined by individual device types or have their standard meanings.

Creates an emulated device in the kernel. The file descriptor returned in fd can be used with KVM_SET/GET/HAS_DEVICE_ATTR.

If the KVM_CREATE_DEVICE_TEST flag is set, only test whether the device type is supported (not necessarily whether it can be created in the current vm).

Individual devices should not define flags. Attributes should be used for specifying any behavior that is not implied by the device type number.

4.80 KVM_SET_DEVICE_ATTR/KVM_GET_DEVICE_ATTR ¶

KVM_CAP_DEVICE_CTRL, KVM_CAP_VM_ATTRIBUTES for vm device, KVM_CAP_VCPU_ATTRIBUTES for vcpu device KVM_CAP_SYS_ATTRIBUTES for system (/dev/kvm) device (no set)

device ioctl, vm ioctl, vcpu ioctl

struct kvm_device_attr

0 on success, -1 on error

ENXIO The group or attribute is unknown/unsupported for this device or hardware support is missing. EPERM The attribute cannot (currently) be accessed this way (e.g. read-only attribute, or attribute that only makes sense when the device is in a different state) Other error conditions may be defined by individual device types.

The group or attribute is unknown/unsupported for this device or hardware support is missing.

The attribute cannot (currently) be accessed this way (e.g. read-only attribute, or attribute that only makes sense when the device is in a different state)

Other error conditions may be defined by individual device types.

Gets/sets a specified piece of device configuration and/or state. The semantics are device-specific. See individual device documentation in the “devices” directory. As with ONE_REG, the size of the data transferred is defined by the particular attribute.

4.81 KVM_HAS_DEVICE_ATTR ¶

KVM_CAP_DEVICE_CTRL, KVM_CAP_VM_ATTRIBUTES for vm device, KVM_CAP_VCPU_ATTRIBUTES for vcpu device KVM_CAP_SYS_ATTRIBUTES for system (/dev/kvm) device

device ioctl, vm ioctl, vcpu ioctl

struct kvm_device_attr

0 on success, -1 on error

ENXIO The group or attribute is unknown/unsupported for this device or hardware support is missing.

The group or attribute is unknown/unsupported for this device or hardware support is missing.

Tests whether a device supports a particular attribute. A successful return indicates the attribute is implemented. It does not necessarily indicate that the attribute can be read or written in the device’s current state. “addr” is ignored.

4.82 KVM_ARM_VCPU_INIT ¶

struct kvm_vcpu_init (in)

0 on success; -1 on error

EINVAL the target is unknown, or the combination of features is invalid. ENOENT a features bit specified is unknown. EPERM the vcpu belongs to a protected VM and has already run.

the target is unknown, or the combination of features is invalid.

a features bit specified is unknown.

the vcpu belongs to a protected VM and has already run.

This tells KVM what type of CPU to present to the guest, and what optional features it should have. This will cause a reset of the cpu registers to their initial values. If this is not called, KVM_RUN will return ENOEXEC for that vcpu.

Processor state: AArch64: EL1h, D, A, I and F bits set. All other bits are cleared. AArch32: SVC, A, I and F bits set. All other bits are cleared.

AArch64: EL1h, D, A, I and F bits set. All other bits are cleared.

AArch64: EL1h, D, A, I and F bits set. All other bits are cleared.

AArch32: SVC, A, I and F bits set. All other bits are cleared.

AArch32: SVC, A, I and F bits set. All other bits are cleared.

General Purpose registers, including PC and SP: set to 0

General Purpose registers, including PC and SP: set to 0

FPSIMD/NEON registers: set to 0

FPSIMD/NEON registers: set to 0

SVE registers: set to 0

SVE registers: set to 0

System registers: Reset to their architecturally defined values as for a warm reset to EL1 (resp. SVC) or EL2 (in the case of EL2 being enabled).

System registers: Reset to their architecturally defined values as for a warm reset to EL1 (resp. SVC) or EL2 (in the case of EL2 being enabled).

Note that because some registers reflect machine topology, all vcpus should be created before this ioctl is invoked.

Userspace can call this function multiple times for a given vcpu, including after the vcpu has been run. This will reset the vcpu to its initial state. All calls to this function after the initial call must use the same target and same set of feature flags, otherwise EINVAL will be returned.

For a protected VM this ioctl returns EPERM once the vcpu has run, and the features it accepts are restricted: KVM_ARM_VCPU_PSCI_0_2 is required. See Protected KVM (pKVM) .

KVM_ARM_VCPU_POWER_OFF: Starts the CPU in a power-off state. Depends on KVM_CAP_ARM_PSCI. If not set, the CPU will be powered on and execute guest code when KVM_RUN is called. KVM_ARM_VCPU_EL1_32BIT: Starts the CPU in a 32bit mode. Depends on KVM_CAP_ARM_EL1_32BIT (arm64 only). KVM_ARM_VCPU_PSCI_0_2: Emulate PSCI v0.2 (or a future revision backward compatible with v0.2) for the CPU. Depends on KVM_CAP_ARM_PSCI_0_2. KVM_ARM_VCPU_PMU_V3: Emulate PMUv3 for the CPU. Depends on KVM_CAP_ARM_PMU_V3. KVM_ARM_VCPU_PMU_V3_STRICT: Enable strict PMUv3 UAPI. Requires KVM_ARM_VCPU_PMU_V3. Depends on KVM_CAP_ARM_PMU_V3_STRICT. When enabled: Userspace must explicitly select a PMU implementation before initializing the PMU or configuring a PMU event filter If the PMU implements FEAT_PMUv3p4, PMMIR_EL1.SLOTS provides the hardware value of the underlying implementation Writes to PMCR_EL0.N via KVM_SET_ONE_REG are ignored KVM_ARM_VCPU_PTRAUTH_ADDRESS: Enables Address Pointer authentication for arm64 only. Depends on KVM_CAP_ARM_PTRAUTH_ADDRESS. If KVM_CAP_ARM_PTRAUTH_ADDRESS and KVM_CAP_ARM_PTRAUTH_GENERIC are both present, then both KVM_ARM_VCPU_PTRAUTH_ADDRESS and KVM_ARM_VCPU_PTRAUTH_GENERIC must be requested or neither must be requested. KVM_ARM_VCPU_PTRAUTH_GENERIC: Enables Generic Pointer authentication for arm64 only. Depends on KVM_CAP_ARM_PTRAUTH_GENERIC. If KVM_CAP_ARM_PTRAUTH_ADDRESS and KVM_CAP_ARM_PTRAUTH_GENERIC are both present, then both KVM_ARM_VCPU_PTRAUTH_ADDRESS and KVM_ARM_VCPU_PTRAUTH_GENERIC must be requested or neither must be requested. KVM_ARM_VCPU_SVE: Enables SVE for the CPU (arm64 only). Depends on KVM_CAP_ARM_SVE. Requires KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE): After KVM_ARM_VCPU_INIT: KVM_REG_ARM64_SVE_VLS may be read using KVM_GET_ONE_REG: the initial value of this pseudo-register indicates the best set of vector lengths possible for a vcpu on this host. Before KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE): KVM_RUN and KVM_GET_REG_LIST are not available; KVM_GET_ONE_REG and KVM_SET_ONE_REG cannot be used to access the scalable architectural SVE registers KVM_REG_ARM64_SVE_ZREG() , KVM_REG_ARM64_SVE_PREG() or KVM_REG_ARM64_SVE_FFR; KVM_REG_ARM64_SVE_VLS may optionally be written using KVM_SET_ONE_REG, to modify the set of vector lengths available for the vcpu. After KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE): the KVM_REG_ARM64_SVE_VLS pseudo-register is immutable, and can no longer be written using KVM_SET_ONE_REG. KVM_ARM_VCPU_HAS_EL2: Enable Nested Virtualisation support, booting the guest from EL2 instead of EL1. Depends on KVM_CAP_ARM_EL2. The VM is running with HCR_EL2.E2H being RES1 (VHE) unless KVM_ARM_VCPU_HAS_EL2_E2H0 is also set. KVM_ARM_VCPU_HAS_EL2_E2H0: Restrict Nested Virtualisation support to HCR_EL2.E2H being RES0 (non-VHE). Depends on KVM_CAP_ARM_EL2_E2H0. KVM_ARM_VCPU_HAS_EL2 must also be set.

KVM_ARM_VCPU_POWER_OFF: Starts the CPU in a power-off state. Depends on KVM_CAP_ARM_PSCI. If not set, the CPU will be powered on and execute guest code when KVM_RUN is called.

KVM_ARM_VCPU_POWER_OFF: Starts the CPU in a power-off state. Depends on KVM_CAP_ARM_PSCI. If not set, the CPU will be powered on and execute guest code when KVM_RUN is called.

KVM_ARM_VCPU_EL1_32BIT: Starts the CPU in a 32bit mode. Depends on KVM_CAP_ARM_EL1_32BIT (arm64 only).

KVM_ARM_VCPU_EL1_32BIT: Starts the CPU in a 32bit mode. Depends on KVM_CAP_ARM_EL1_32BIT (arm64 only).

KVM_ARM_VCPU_PSCI_0_2: Emulate PSCI v0.2 (or a future revision backward compatible with v0.2) for the CPU. Depends on KVM_CAP_ARM_PSCI_0_2.

KVM_ARM_VCPU_PSCI_0_2: Emulate PSCI v0.2 (or a future revision backward compatible with v0.2) for the CPU. Depends on KVM_CAP_ARM_PSCI_0_2.

KVM_ARM_VCPU_PMU_V3: Emulate PMUv3 for the CPU. Depends on KVM_CAP_ARM_PMU_V3.

KVM_ARM_VCPU_PMU_V3: Emulate PMUv3 for the CPU. Depends on KVM_CAP_ARM_PMU_V3.

KVM_ARM_VCPU_PMU_V3_STRICT: Enable strict PMUv3 UAPI. Requires KVM_ARM_VCPU_PMU_V3. Depends on KVM_CAP_ARM_PMU_V3_STRICT. When enabled: Userspace must explicitly select a PMU implementation before initializing the PMU or configuring a PMU event filter If the PMU implements FEAT_PMUv3p4, PMMIR_EL1.SLOTS provides the hardware value of the underlying implementation Writes to PMCR_EL0.N via KVM_SET_ONE_REG are ignored

KVM_ARM_VCPU_PMU_V3_STRICT: Enable strict PMUv3 UAPI. Requires KVM_ARM_VCPU_PMU_V3. Depends on KVM_CAP_ARM_PMU_V3_STRICT. When enabled:

Userspace must explicitly select a PMU implementation before initializing the PMU or configuring a PMU event filter If the PMU implements FEAT_PMUv3p4, PMMIR_EL1.SLOTS provides the hardware value of the underlying implementation Writes to PMCR_EL0.N via KVM_SET_ONE_REG are ignored

Userspace must explicitly select a PMU implementation before initializing the PMU or configuring a PMU event filter

Userspace must explicitly select a PMU implementation before initializing the PMU or configuring a PMU event filter

If the PMU implements FEAT_PMUv3p4, PMMIR_EL1.SLOTS provides the hardware value of the underlying implementation

If the PMU implements FEAT_PMUv3p4, PMMIR_EL1.SLOTS provides the hardware value of the underlying implementation

Writes to PMCR_EL0.N via KVM_SET_ONE_REG are ignored

Writes to PMCR_EL0.N via KVM_SET_ONE_REG are ignored

KVM_ARM_VCPU_PTRAUTH_ADDRESS: Enables Address Pointer authentication for arm64 only. Depends on KVM_CAP_ARM_PTRAUTH_ADDRESS. If KVM_CAP_ARM_PTRAUTH_ADDRESS and KVM_CAP_ARM_PTRAUTH_GENERIC are both present, then both KVM_ARM_VCPU_PTRAUTH_ADDRESS and KVM_ARM_VCPU_PTRAUTH_GENERIC must be requested or neither must be requested.

KVM_ARM_VCPU_PTRAUTH_ADDRESS: Enables Address Pointer authentication for arm64 only. Depends on KVM_CAP_ARM_PTRAUTH_ADDRESS. If KVM_CAP_ARM_PTRAUTH_ADDRESS and KVM_CAP_ARM_PTRAUTH_GENERIC are both present, then both KVM_ARM_VCPU_PTRAUTH_ADDRESS and KVM_ARM_VCPU_PTRAUTH_GENERIC must be requested or neither must be requested.

KVM_ARM_VCPU_PTRAUTH_GENERIC: Enables Generic Pointer authentication for arm64 only. Depends on KVM_CAP_ARM_PTRAUTH_GENERIC. If KVM_CAP_ARM_PTRAUTH_ADDRESS and KVM_CAP_ARM_PTRAUTH_GENERIC are both present, then both KVM_ARM_VCPU_PTRAUTH_ADDRESS and KVM_ARM_VCPU_PTRAUTH_GENERIC must be requested or neither must be requested.

KVM_ARM_VCPU_PTRAUTH_GENERIC: Enables Generic Pointer authentication for arm64 only. Depends on KVM_CAP_ARM_PTRAUTH_GENERIC. If KVM_CAP_ARM_PTRAUTH_ADDRESS and KVM_CAP_ARM_PTRAUTH_GENERIC are both present, then both KVM_ARM_VCPU_PTRAUTH_ADDRESS and KVM_ARM_VCPU_PTRAUTH_GENERIC must be requested or neither must be requested.

KVM_ARM_VCPU_SVE: Enables SVE for the CPU (arm64 only). Depends on KVM_CAP_ARM_SVE. Requires KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE): After KVM_ARM_VCPU_INIT: KVM_REG_ARM64_SVE_VLS may be read using KVM_GET_ONE_REG: the initial value of this pseudo-register indicates the best set of vector lengths possible for a vcpu on this host. Before KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE): KVM_RUN and KVM_GET_REG_LIST are not available; KVM_GET_ONE_REG and KVM_SET_ONE_REG cannot be used to access the scalable architectural SVE registers KVM_REG_ARM64_SVE_ZREG() , KVM_REG_ARM64_SVE_PREG() or KVM_REG_ARM64_SVE_FFR; KVM_REG_ARM64_SVE_VLS may optionally be written using KVM_SET_ONE_REG, to modify the set of vector lengths available for the vcpu. After KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE): the KVM_REG_ARM64_SVE_VLS pseudo-register is immutable, and can no longer be written using KVM_SET_ONE_REG.

KVM_ARM_VCPU_SVE: Enables SVE for the CPU (arm64 only). Depends on KVM_CAP_ARM_SVE. Requires KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE):

After KVM_ARM_VCPU_INIT: KVM_REG_ARM64_SVE_VLS may be read using KVM_GET_ONE_REG: the initial value of this pseudo-register indicates the best set of vector lengths possible for a vcpu on this host. Before KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE): KVM_RUN and KVM_GET_REG_LIST are not available; KVM_GET_ONE_REG and KVM_SET_ONE_REG cannot be used to access the scalable architectural SVE registers KVM_REG_ARM64_SVE_ZREG() , KVM_REG_ARM64_SVE_PREG() or KVM_REG_ARM64_SVE_FFR; KVM_REG_ARM64_SVE_VLS may optionally be written using KVM_SET_ONE_REG, to modify the set of vector lengths available for the vcpu. After KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE): the KVM_REG_ARM64_SVE_VLS pseudo-register is immutable, and can no longer be written using KVM_SET_ONE_REG.

After KVM_ARM_VCPU_INIT: KVM_REG_ARM64_SVE_VLS may be read using KVM_GET_ONE_REG: the initial value of this pseudo-register indicates the best set of vector lengths possible for a vcpu on this host.

After KVM_ARM_VCPU_INIT:

KVM_REG_ARM64_SVE_VLS may be read using KVM_GET_ONE_REG: the initial value of this pseudo-register indicates the best set of vector lengths possible for a vcpu on this host.

KVM_REG_ARM64_SVE_VLS may be read using KVM_GET_ONE_REG: the initial value of this pseudo-register indicates the best set of vector lengths possible for a vcpu on this host.

KVM_REG_ARM64_SVE_VLS may be read using KVM_GET_ONE_REG: the initial value of this pseudo-register indicates the best set of vector lengths possible for a vcpu on this host.

Before KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE): KVM_RUN and KVM_GET_REG_LIST are not available; KVM_GET_ONE_REG and KVM_SET_ONE_REG cannot be used to access the scalable architectural SVE registers KVM_REG_ARM64_SVE_ZREG() , KVM_REG_ARM64_SVE_PREG() or KVM_REG_ARM64_SVE_FFR; KVM_REG_ARM64_SVE_VLS may optionally be written using KVM_SET_ONE_REG, to modify the set of vector lengths available for the vcpu.

Before KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE):

KVM_RUN and KVM_GET_REG_LIST are not available; KVM_GET_ONE_REG and KVM_SET_ONE_REG cannot be used to access the scalable architectural SVE registers KVM_REG_ARM64_SVE_ZREG() , KVM_REG_ARM64_SVE_PREG() or KVM_REG_ARM64_SVE_FFR; KVM_REG_ARM64_SVE_VLS may optionally be written using KVM_SET_ONE_REG, to modify the set of vector lengths available for the vcpu.

KVM_RUN and KVM_GET_REG_LIST are not available;

KVM_RUN and KVM_GET_REG_LIST are not available;

KVM_GET_ONE_REG and KVM_SET_ONE_REG cannot be used to access the scalable architectural SVE registers KVM_REG_ARM64_SVE_ZREG() , KVM_REG_ARM64_SVE_PREG() or KVM_REG_ARM64_SVE_FFR;

KVM_GET_ONE_REG and KVM_SET_ONE_REG cannot be used to access the scalable architectural SVE registers KVM_REG_ARM64_SVE_ZREG() , KVM_REG_ARM64_SVE_PREG() or KVM_REG_ARM64_SVE_FFR;

KVM_REG_ARM64_SVE_VLS may optionally be written using KVM_SET_ONE_REG, to modify the set of vector lengths available for the vcpu.

KVM_REG_ARM64_SVE_VLS may optionally be written using KVM_SET_ONE_REG, to modify the set of vector lengths available for the vcpu.

After KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE): the KVM_REG_ARM64_SVE_VLS pseudo-register is immutable, and can no longer be written using KVM_SET_ONE_REG.

After KVM_ARM_VCPU_FINALIZE(KVM_ARM_VCPU_SVE):

the KVM_REG_ARM64_SVE_VLS pseudo-register is immutable, and can no longer be written using KVM_SET_ONE_REG.

the KVM_REG_ARM64_SVE_VLS pseudo-register is immutable, and can no longer be written using KVM_SET_ONE_REG.

the KVM_REG_ARM64_SVE_VLS pseudo-register is immutable, and can no longer be written using KVM_SET_ONE_REG.

KVM_ARM_VCPU_HAS_EL2: Enable Nested Virtualisation support, booting the guest from EL2 instead of EL1. Depends on KVM_CAP_ARM_EL2. The VM is running with HCR_EL2.E2H being RES1 (VHE) unless KVM_ARM_VCPU_HAS_EL2_E2H0 is also set.

KVM_ARM_VCPU_HAS_EL2: Enable Nested Virtualisation support, booting the guest from EL2 instead of EL1. Depends on KVM_CAP_ARM_EL2. The VM is running with HCR_EL2.E2H being RES1 (VHE) unless KVM_ARM_VCPU_HAS_EL2_E2H0 is also set.

KVM_ARM_VCPU_HAS_EL2_E2H0: Restrict Nested Virtualisation support to HCR_EL2.E2H being RES0 (non-VHE). Depends on KVM_CAP_ARM_EL2_E2H0. KVM_ARM_VCPU_HAS_EL2 must also be set.

KVM_ARM_VCPU_HAS_EL2_E2H0: Restrict Nested Virtualisation support to HCR_EL2.E2H being RES0 (non-VHE). Depends on KVM_CAP_ARM_EL2_E2H0. KVM_ARM_VCPU_HAS_EL2 must also be set.

4.83 KVM_ARM_PREFERRED_TARGET ¶

struct kvm_vcpu_init (out)

0 on success; -1 on error

This queries KVM for preferred CPU target type which can be emulated by KVM on underlying host.

The ioctl returns a struct kvm_vcpu_init instance containing the preferred CPU target type. The kvm_vcpu_init->features bitmap is returned empty: userspace selects the vCPU features itself, and their availability is reported by the capabilities listed under KVM_ARM_VCPU_INIT.

The information returned by this ioctl can be used to prepare an instance of struct kvm_vcpu_init for KVM_ARM_VCPU_INIT ioctl which will result in VCPU matching underlying host.

4.84 KVM_GET_REG_LIST ¶

arm64, mips, riscv, x86 (if KVM_CAP_ONE_REG)

struct kvm_reg_list (in/out)

0 on success; -1 on error

E2BIG the reg index list is too big to fit in the array specified by the user (the number required will be written into n).

the reg index list is too big to fit in the array specified by the user (the number required will be written into n).

This ioctl returns the guest registers that are supported for the KVM_GET_ONE_REG/KVM_SET_ONE_REG calls.

Note that s390 does not support KVM_GET_REG_LIST for historical reasons (read: nobody cared). The set of registers in kernels 4.x and newer is:

KVM_REG_S390_EPOCHDIFF

KVM_REG_S390_EPOCHDIFF

KVM_REG_S390_CPU_TIMER

KVM_REG_S390_CPU_TIMER

KVM_REG_S390_CLOCK_COMP

KVM_REG_S390_CLOCK_COMP

KVM_REG_S390_PFCOMPARE

KVM_REG_S390_PFCOMPARE

KVM_REG_S390_PFSELECT

KVM_REG_S390_PFSELECT

Note, for x86, all MSRs enumerated by KVM_GET_MSR_INDEX_LIST are supported as type KVM_X86_REG_TYPE_MSR, but are NOT enumerated via KVM_GET_REG_LIST.

4.85 KVM_ARM_SET_DEVICE_ADDR (deprecated) ¶

KVM_CAP_ARM_SET_DEVICE_ADDR

struct kvm_arm_device_addr (in)

0 on success, -1 on error

ENODEV The device id is unknown ENXIO Device not supported on current system EEXIST Address already set E2BIG Address outside guest physical address spac...

Extracted Entities

Platforms (2)