Use cross-platform capability in enable_cap example - #384
Open
rogersnm wants to merge 1 commit into
Open
Conversation
Use KVM_CAP_HALT_POLL in the VmFd::enable_cap documentation example. It is available on all architectures and targets the VM fd. Check for support before enabling it so the doctest also works on older kernels. This follows the review discussion in rust-vmm#382. Signed-off-by: Nick Rogers <1903140+rogersnm@users.noreply.github.com>
rogersnm
requested review from
ShadowCurse,
acatangiu,
andreeaflorescu,
lauralt,
roypat and
sameo
as code owners
August 24, 2026 16:10
andreeaflorescu
approved these changes
Aug 25, 2026
rbradford
approved these changes
Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the PR
Replace the x86-specific
KVM_CAP_SPLIT_IRQCHIPcapability in theVmFd::enable_capdocumentation example withKVM_CAP_HALT_POLL.KVM_CAP_HALT_POLLis documented as supporting all architectures and is enabled through the VM fd, so the example no longer needs an architecture-specificcfg.Check support with
check_extension_rawbefore enabling the capability. This keeps the example compatible with older kernels that may not supportKVM_CAP_HALT_POLL.This follows @andreeaflorescu’s suggestion during the review of #382.
Testing
RUSTDOCFLAGS="-D warnings" cargo doc -p kvm-ioctls --no-deps.KVM_CAP_HALT_POLLas supported and enabled it successfully.cargo fmt --all --check.git diff --check.Requirements
unsafecode is added.