kvm-ioctls
Safe wrappers over KVM ioctls
0.25.0
4.8M downloads/mo
#4601 most downloaded on crates.io
rust-vmm/kvm
What this package is like to depend on
Last release 2 months ago
15 Jun 2026
Release timing varies
gaps range from 4 weeks to 8 months
Most releases are documented
notes for 26 of 30 stable releases
Nothing withdrawn
no release was ever pulled
7 years old
30 releases · first in 2019
3 releases in the last 12 months
see the full history below
Release timeline
30 releases · Feb 2019 to Jun 2026Releases
latest 30-
0.25.015 Jun 2026Release notes
Open source →Added
- Plumb through
KVM_CAP_COUNTER_OFFSETasCap::CounterOffset. - Plumb through
KVM_CAP_DIRTY_LOG_RINGasCap::DirtyLogRing. - [#359] Add support for
KVM_SET_MSR_FILTERvm ioctl on x86_64.
Changed
- Upgrade
kvm-bindingstov0.14.1.
Release notes
Open source →Added
- Plumb through
KVM_CAP_COUNTER_OFFSETasCap::CounterOffset. - Plumb through
KVM_CAP_DIRTY_LOG_RINGasCap::DirtyLogRing. - [#359] Add support for
KVM_SET_MSR_FILTERvm ioctl on x86_64.
Changed
- Upgrade
kvm-bindingstov0.14.1.
- Plumb through
-
0.24.015 Aug 2025Release notes
Open source →Changelog
v0.24.0
Added
- Plumb through KVM_CAP_X2APIC_API as X2ApicApi cap.
- [#334] Added support for
KVM_HAS_DEVICE_ATTRandKVM_SET_DEVICE_ATTRvm ioctl on aarch64.
Changed
- Update to Rust edition 2024
- Update to kvm-bindings 0.14.0
Release notes
Open source →Added
- Plumb through KVM_CAP_X2APIC_API as X2ApicApi cap.
- [#334] Added support for
KVM_HAS_DEVICE_ATTRandKVM_SET_DEVICE_ATTRvm ioctl on aarch64.
-
0.23.023 Jun 2025Release notes
Open source →Changelog
v0.23.0
Added
- [#322] Added
VcpuFd::nested_state()andVcpuFd::set_nested_state()to work with nested KVM state. Only works onx86. The helper typeKvmNestedStateBuffermakes these new functions easily usable.
Changed
- Upgrade
kvm-bindingstov0.13.0
Release notes
Open source →Added
- [#322] Added
VcpuFd::nested_state()andVcpuFd::set_nested_state()to work with nested KVM state. Only works onx86. The helper typeKvmNestedStateBuffermakes these new functions easily usable.
Changed
- Upgrade
kvm-bindingstov0.13.0
- [#322] Added
-
0.22.125 Sep 2025Nothing published for this version
-
0.22.029 May 2025Release notes
Open source → -
0.21.007 Mar 2025Release notes
Open source →Changelog
v0.21.0
Added
- [#310]: Added support for
KVM_CAP_XSAVE2and theKVM_GET_XSAVE2ioctl.
Changed
- [#310]: Changed
set_xsave()unsafebecause the Ckvm_xsavestruct was extended to have a flexible array member (FAM) in the end in Linux 5.16 andKVM_SET_XSAVEmay copy data beyond the traditional size (i.e. 4096 bytes). If any features are enabled dynamically on Linux 5.16+, it is recommended to useset_xsave2()instead.
Release notes
Open source →Added
- [#310]: Added support for
KVM_CAP_XSAVE2and theKVM_GET_XSAVE2ioctl.
Changed
- [#310]: Changed
set_xsave()unsafebecause the Ckvm_xsavestruct was extended to have a flexible array member (FAM) in the end in Linux 5.16 andKVM_SET_XSAVEmay copy data beyond the traditional size (i.e. 4096 bytes). If any features are enabled dynamically on Linux 5.16+, it is recommended to useset_xsave2()instead. - [#325]]: Changed
set_gsi_routing()to use the newly createdKvmIrqRoutingtype which is aFamStructwrapper overkvm_irq_routing. This way we can safely call theioctlwithout relying on the caller making sure the memory layout ofkvm_irq_routingis sane.
- [#310]: Added support for
-
0.20.017 Jan 2025Release notes
Open source →Added
- [#288]: Introduce
Cap::GuestMemfd,Cap::MemoryAttributesandCap::UserMemory2capabilities enum variants for use withVmFd::check_extension. - [#288]: Introduce
VmFd::check_extension_rawandVmFd::check_extension_intto allowKVM_CHECK_EXTENSIONto return integer.
Changed
- [#305]: Updated kvm-bindings to 0.11.0.
Fixed
- [#298]: Fixed incorrect usage of
ioctl_wit_refin thecreate_devicemethod. Replace it withioctl_wit_mut_refas the passed parameter may be mutated by the ioctl.
- [#288]: Introduce
-
0.19.110 Dec 2024Nothing published for this version
-
0.19.023 Oct 2024Release notes
Open source →Added
- [#275]: Introduce
riscv64ioctls.
Removed
- [#289]: Drop
x8632-bit andarm32-bit support.
Changed
- [#275]: Introduce
-
0.18.002 Aug 2024 -
0.17.023 Apr 2024 -
0.16.003 Jan 2024Release notes
Open source →Added
- [#242] x86: add support
for SMI injection via
Vcpu::smi()(KVM_SMIioctl). - [#241] Add support for userspace MSR handling.
- [#246] Add support for
userspace NMI injection (
KVM_NMIioctl). - [#244] add support for
coalesced MMIO (
KVM_CAP_COALESCED_MMIO/KVM_CAP_COALESCED_PIO)
Changed
- [#242] x86: add support
for SMI injection via
-
0.15.008 Aug 2023 -
0.14.029 May 2023Release notes
Open source →Added
- [#219] Support for
KVM_GET_MSR_FEATURE_INDEX_LISTandKVM_GET_MSRSsystem ioctls. - [#221] Add
Cap::ArmPmuV3.
Changed
- [#223] aarch64:
Updated
get/set_one_regto support different registers sizes through byte slices.
- [#219] Support for
-
0.13.031 Jan 2023Release notes
Open source →Added
- [#213] Add
Kvm::new_with_path()andKvm::open_with_cloexec_at()to allow using kvm device files other than/dev/kvm.
- [#213] Add
-
0.12.129 Oct 2025Release notes
Open source →Changelog
v0.12.1
Fixed
- [#298]: Fixed incorrect
usage ofioctl_with_refin thecreate_devicemethod. Replace it
withioctl_with_mut_refas the passed parameter may be mutated by
the ioctl.
- [#298]: Fixed incorrect
-
0.12.011 Nov 2022Release notes
Open source →Added
- [#187] Support for
KVM_SET_IDENTITY_MAP_ADDR - Derive Debug for all exported structs and enums
- [#189] Expose
KVM_SET_andKVM_HAS_DEVICE_ATTRfor vcpu - [#191] Add
KVM_TRANSLATEsupport and thetranslate_gvafunction that translates guest virtual address to the physical address - [#190] Enable usage of
sync_regsto allow bulk getting and setting of general purpose registers, reducing the number of ioctls needed. - [#198] Return details about
KVM_EXIT_FAIL_ENTRYin vCPU run - [#199] Add
register_irqfd_with_resampleso thatirqfd+resaplefdcan be registered throughKVM_IRQFD - [#202] Add
KVM_CAP_GUEST_DEBUG_HVM_DPS/WPS - [#202] Added
check_extension_intwhich allows checking the capabilities that return numbers instead of booleans
Changed
- Updated vmm-sys-util to 0.11.0
- Updated kvm-bindings to 0.6.0
- Upgraded to rust 2021 edition
- Switched to specifying dependencies using caret requirements instead of comparision requirements
- [#195] Do not panic on unsupported
KVM_EXITreason - [#196] Expose a mutable reference
to the
kvm_runstructure to allow proper handling of unsupported exit reasons - [#200] Fix wrong
target_archgate preventingset_guest_debugfrom being exported on ARM - [#206] use
u128inget/set_on_reg
- [#187] Support for
-
0.11.018 Nov 2021 -
0.10.024 Aug 2021Release notes
Open source →Changed
- Now depends on kvm-bindings >=0.5.0 which replaced the v4.20 KVM bindings with the v5.13 ones.
- Updated
VcpuExit::Debugto return architecture specific information for the debug event.
-
0.9.014 May 2021Release notes
Open source →Added
- Support for accessing and controlling the Time Stamp Counter on x86 platforms
through the
get_tsc_khzandset_tsc_khzfunctions.
Changed
- Updated
create_vmonaarch64to create a VM fd from the KVM fd using the host's maximum IPA size.
- Support for accessing and controlling the Time Stamp Counter on x86 platforms
through the
-
0.8.008 Mar 2021Release notes
Open source →Added
- Support for specifying VM type (an opaque platform and architecture specific
constant) when creating a VM (
KVM_CREATE_VMioctl) via theKvm::create_vm_with_typefunction.
Changed
- Now depends on kvm-bindings >=0.4.0 to support use of a newer vmm-sys-utils dependency.
- Support for specifying VM type (an opaque platform and architecture specific
constant) when creating a VM (
-
0.7.025 Feb 2021Release notes
Open source →Added
- Support for the system API that returns the maximum allowed vCPU ID
(
KVM_CAP_MAX_VCPU_ID). - Support for
KVM_MEMORY_ENCRYPT_OP.
Fixed
- [#119]: Disallow invalid
number of cpuid entries to be passed to
get_supported_cpuidandget_emulated_cpuid.
Changed
- [#123]: Updated
create_vcputo useu64as the parameter for the number of vCPUs.
- Support for the system API that returns the maximum allowed vCPU ID
(
-
0.6.104 Mar 2021Nothing published for this version
-
0.6.003 Dec 2020Release notes
Open source →Added
- Support for the vcpu ioctls:
KVM_SET_GUEST_DEBUG,KVM_KVMCLOCK_CTRL, andKVM_GET_REG_LIST. - Support for the vm ioctl
KVM_GET_DEVICE_ATTR. - Support for the device ioctl
KVM_HAS_DEVICE_ATTR. - Support for
VcpuExit::Debug. - Support for enabling vcpu capabilities using
Vcpu::enable_cap. - Support for checking Hyper-V (
HypervSynicandHypervSynic2), MSI (MsiDevid), and IPA Size (ArmVmIPASize) capabilities. usingkvm.check_extension. - Support for checking the VM capabilities via
Vm::check_extension. - Create a VM with flexible IPA size using
Kvm::create_vm_with_ipa_size.
Removed
- Removed
Kvm::new_with_fd_number. The same functionality is offered by theKvmFromRawFd trait implementation.
Changed
- The VM ioctl
unregister_ioeventnow correctly unregisters the events that correspond to the data match passed as a parameter. - The
SystemEventVcpu Exit now also contains the relevant type and flags. - Updated
get_dirty_logsuch that it does not assume the page size is 4K, but instead reads it usinglibc::sysconf.
- Support for the vcpu ioctls:
-
0.5.029 Jan 2020Release notes
Open source →Added
- Support for the vcpu ioctls
KVM_GET/SET_VCPU_EVENTSandKVM_GET_DIRTY_LOGonaarch64. - Support for the vcpu ioctl
KVM_IRQ_LINE.
- Support for the vcpu ioctls
-
0.4.028 Nov 2019Release notes
Open source →Added
- Support for unregistering ioeventfds through
KVM_IOEVENTFD.
Changed
- Functions working with event FDs now require vmm_sys_util::eventfd::EventFd in their interface instead of RawFd.
- Functions working with FAM structs kvm_msr_list and kvm_msrs, were changed to work with their respective safe counterparts MsrList and respectively Msrs.
- Now exporting kvm_ioctls::Error type definition so that users of this crate can create their own wrapping errors without having to know the Error type used internally by this crate.
- No longer exporting kvm_ioctls::Result. Users of this crate should not have to use kvm_ioctls::Result outside the crate.
- kvm_ioctls::Error now works with errno::Error instead of io::Error.
Removed
- CpuId safe wrapper over FAM struct kvm_cpuid2. The safe wrapper is now provided by the kvm_bindings crate starting with v0.2.0.
- KVM_MAX_MSR_ENTRIES and MAX_KVM_CPUID_ENTRIES. Equivalent constants are provided by the kvm_bindings crate starting with v0.2.0.
- Support for unregistering ioeventfds through
-
0.3.028 Oct 2019Release notes
Open source →Added
- Support for setting vcpu
kvm_immediate_exitflag - Support for the vcpu ioctl
KVM_GET_CPUID2 - Support for the vcpu ioctl
KVM_GET_MP_STATE - Support for the vcpu ioctl
KVM_SET_MP_STATE - Support for the vcpu ioctl
KVM_GET_VCPU_EVENTS - Support for the vcpu ioctl
KVM_SET_VCPU_EVENTS - Support for the vcpu ioctl
KVM_GET_DEBUGREGS - Support for the vcpu ioctl
KVM_SET_DEBUGREGS - Support for the vcpu ioctl
KVM_GET_XSAVE - Support for the vcpu ioctl
KVM_SET_XSAVE - Support for the vcpu ioctl
KVM_GET_XCRS - Support for the vcpu ioctl
KVM_SET_XCRS - Support for the vm ioctl
KVM_GET_IRQCHIP - Support for the vm ioctl
KVM_SET_IRQCHIP - Support for the vm ioctl
KVM_GET_CLOCK - Support for the vm ioctl
KVM_SET_CLOCK - Support for the vm ioctl
KVM_GET_PIT2 - Support for the vm ioctl
KVM_SET_PIT2 - Support for the vcpu ioctl
KVM_GET_ONE_REG
Changed
- Function offering support for
KVM_SET_MSRSalso returns the number of MSR entries successfully written.
- Support for setting vcpu
-
0.2.025 Jun 2019Release notes
Open source →Added
- Add support for
KVM_ENABLE_CAP. - Add support for
KVM_SIGNAL_MSI.
Fixed
- Fix bug in KvmRunWrapper. The memory for kvm_run struct was not unmapped after the KvmRunWrapper object got out of scope.
- Return proper value when receiving the EOI KVM exit.
- Mark set_user_memory_region as unsafe.
- Add support for
-
0.1.017 Apr 2019Release notes
Open source →First release of the kvm-ioctls crate.
The kvm-ioctls crate provides safe wrappers over the KVM API, a set of ioctls used for creating and configuring Virtual Machines (VMs) on Linux. The ioctls are accessible through four structures:
- Kvm - wrappers over system ioctls
- VmFd - wrappers over VM ioctls
- VcpuFd - wrappers over vCPU ioctls
- DeviceFd - wrappers over device ioctls
The kvm-ioctls can be used on x86_64 and aarch64. Right now the aarch64 support is considered experimental.
-
0.0.128 Feb 2019Nothing published for this version