Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose fields for KVM_EXIT_HYPERCALL #267

Merged
merged 5 commits into from
Jun 27, 2024
Merged

Conversation

Freax13
Copy link
Contributor

@Freax13 Freax13 commented Jun 26, 2024

This is a breaking change.

Summary of the PR

This is needed for userspace to handle the KVM_HC_MAP_GPA_RANGE hypercall.

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.

This is needed for userspace to handle the `KVM_HC_MAP_GPA_RANGE`
hypercall.

Signed-off-by: Tom Dohrmann <[email protected]>
Signed-off-by: Tom Dohrmann <[email protected]>
@Freax13 Freax13 marked this pull request as ready for review June 26, 2024 11:04
@@ -167,4 +167,5 @@ pub enum Cap {
ArmPtrAuthGeneric = KVM_CAP_ARM_PTRAUTH_GENERIC,
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
X86UserSpaceMsr = KVM_CAP_X86_USER_SPACE_MSR,
ExitHypercall = KVM_CAP_EXIT_HYPERCALL,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is only defined for x86_64 and arm64. From kvm-bindings:

$ git grep KVM_CAP_EXIT_HYPERCALL
src/arm64/bindings.rs:pub const KVM_CAP_EXIT_HYPERCALL: u32 = 201;
src/x86_64/bindings.rs:pub const KVM_CAP_EXIT_HYPERCALL: u32 = 201;

Copy link
Contributor

Choose a reason for hiding this comment

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

Interestingly, the docs say this is only available for x86(-64):
https://docs.kernel.org/virt/kvm/api.html#kvm-cap-exit-hypercall

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't that because kvm-bindings only supports x86_64 and arm64? I can't find definitions for any KVM_CAP_* outside of those two files.

AFAICT KVM_CAP_EXIT_HYPERCALL is defined in a non-architecture-specific header.

That said KVM currently only implements KVM_CAP_EXIT_HYPERCALL on x86_64, so I'd also be fine with restricting it to that platform.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interestingly, the docs say this is only available for x86(-64): https://docs.kernel.org/virt/kvm/api.html#kvm-cap-exit-hypercall

If that's what to official docs say, that seems like a good reason to restrict it to x86_64 :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't that because kvm-bindings only supports x86_64 and arm64? I can't find definitions for any KVM_CAP_* outside of those two files.

Ah yes, that could be it.

According to the official docs, this capability is only supported on
x86.

Signed-off-by: Tom Dohrmann <[email protected]>
@roypat roypat merged commit 9b85aef into rust-vmm:main Jun 27, 2024
19 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.

4 participants