Skip to content

Conversation

@likebreath
Copy link
Collaborator

@likebreath likebreath commented Dec 16, 2025

Summary of the PR

This patch introduces pub struct VfioIommufd, a safe wrapper for VFIO
devices backed by the cdev interface and iommufd. This struct implements
the VfioOps trait to provide APIs for userspace drivers (e.g., a VMM).

Additionally, this patch extends the VfioDevice constructor to support
creating instances using the new VfioIommufd backend.

Of course, new vfio ioctls are introduced to support for the cdev interface.

All changes are put behind the feature flag vfio_cdev.

Fixes: #92

Signed-off-by: Bo Chen bchen@crusoe.ai

Requirements

Before submitting your PR, please make sure you addressed the following
requirements:

  • All commits in this PR have Signed-Off-By trailers (with
    git commit -s), and the commit message has max 60 characters for the
    summary and max 75 characters for each description line.
  • All added/changed functionality has a corresponding unit/integration
    test.
  • All added/changed public-facing functionality has entries in the "Upcoming
    Release" section of CHANGELOG.md (if no such section exists, please create one).
  • Any newly added unsafe code is properly documented.

@likebreath likebreath force-pushed the 1215/vfio_cdev_iommufd branch 3 times, most recently from 425f6a2 to 72b4842 Compare December 16, 2025 23:26
@likebreath likebreath marked this pull request as ready for review December 16, 2025 23:28
@likebreath
Copy link
Collaborator Author

@up2wing You might be interested. Please take a look. Thank you.

@up2wing
Copy link

up2wing commented Dec 17, 2025

@up2wing You might be interested. Please take a look. Thank you.

Cool, thx for the notify. I'll see this ASAP.

@likebreath likebreath force-pushed the 1215/vfio_cdev_iommufd branch from 72b4842 to f3f6f7b Compare December 17, 2025 22:50
@likebreath likebreath force-pushed the 1215/vfio_cdev_iommufd branch from f3f6f7b to a4d6608 Compare December 29, 2025 22:00
@likebreath
Copy link
Collaborator Author

@up2wing Thank you for the thorough review. All comments are addressed. Please take another look.

Also, inspired by one of your comments, I fixed a similar ioctl mutability issue from cloud-hypervisor/iommufd#2.

@likebreath likebreath force-pushed the 1215/vfio_cdev_iommufd branch from a4d6608 to 7f4a7ab Compare December 29, 2025 22:07
The new ioctls are also put behind a feature flag `vfio_cdev`.

Signed-off-by: Bo Chen <bchen@crusoe.ai>
@likebreath likebreath force-pushed the 1215/vfio_cdev_iommufd branch from 7f4a7ab to 63a1f92 Compare December 29, 2025 23:09
Copy link

@up2wing up2wing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is only one spelling issue left, the code LGTM.

This patch introduces `pub struct VfioIommufd`, a safe wrapper for VFIO
devices backed by the cdev interface and iommufd. This struct implements
the `VfioOps` trait to provide APIs for userspace drivers (e.g., a VMM).

Additionally, this patch extends the `VfioDevice` constructor to support
creating instances using the new VfioIommufd backend.

Fixes: rust-vmm#92

Signed-off-by: Bo Chen <bchen@crusoe.ai>
@likebreath likebreath force-pushed the 1215/vfio_cdev_iommufd branch from 63a1f92 to d058300 Compare January 2, 2026 18:34
@likebreath
Copy link
Collaborator Author

@liuw @rbradford Can you please take a look? Thank you.

@likebreath
Copy link
Collaborator Author

The only failure on cargo-audit-x86_64 is irrelevant and should be fixed via rust-vmm-ci version bump (#129).

@likebreath likebreath merged commit fe45d04 into rust-vmm:main Jan 13, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support VFIO device cdev with iommufd

4 participants