vmm: Support device passthrough with vfio cdev and iommufd

When `--platform iommufd=on` is set, use the vfio cdev interface backed
by iommufd instead of the legacy vfio container/group interface for
device passthrough.

The cdev path opens '/dev/iommu' via IommuFd, allocates an IOAS, and
binds VFIO devices through VfioIommufd. The legacy container/group path
remains the default and is used when iommufd is not enabled.

Add iommufd-ioctls as a workspace dependency and enable the "vfio_cdev"
feature on vfio-ioctls for KVM builds.

Fixes: #6892

Signed-off-by: Bo Chen <bchen@crusoe.ai>
This commit is contained in:
Bo Chen
2026-04-09 04:50:54 +00:00
parent 13972a0edf
commit fe5f991c37
4 changed files with 62 additions and 3 deletions

20
Cargo.lock generated
View File

@@ -1097,6 +1097,23 @@ dependencies = [
"libc",
]
[[package]]
name = "iommufd-bindings"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd7de3a04f6fd55f171a6682852f7aa360bb848a85e0c610513349e006b3c139"
[[package]]
name = "iommufd-ioctls"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eabd3414d9c4e716c9a198fbfac484625f088c075605372daf037edfe336e18"
dependencies = [
"iommufd-bindings",
"thiserror",
"vmm-sys-util",
]
[[package]]
name = "ipnetwork"
version = "0.20.0"
@@ -2291,6 +2308,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4b1d98dff7f0d219278e406323e7eda4d426447bd203c7828189baf0d8c07b7"
dependencies = [
"byteorder",
"iommufd-bindings",
"iommufd-ioctls",
"kvm-bindings",
"kvm-ioctls",
"libc",
@@ -2521,6 +2540,7 @@ dependencies = [
"hypervisor",
"igvm",
"igvm_defs",
"iommufd-ioctls",
"landlock",
"libc",
"linux-loader",