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

feat(aarch64): generic get/set_one_reg #223

Merged
merged 2 commits into from
May 22, 2023

Conversation

ShadowCurse
Copy link
Collaborator

@ShadowCurse ShadowCurse commented May 15, 2023

Summary of the PR

Linux kernel defines arm registers up to 2048 bits wide. To support all different sized the PR changes get/set_one_reg methods to accept a byte slice that either contains register data or will have register data be written to.

Requirements

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

  • All commits in this PR are signed (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.

src/ioctls/vcpu.rs Outdated Show resolved Hide resolved
src/ioctls/vcpu.rs Outdated Show resolved Hide resolved
roypat
roypat previously approved these changes May 18, 2023
Copy link
Collaborator

@roypat roypat left a comment

Choose a reason for hiding this comment

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

To me this looks future proof and safe, meaning we won't run into weird issues with too-wide ARM registers again.

It should definitely get a CHANGELOG entry, since its a breaking change, though. Also, I'm not 100% sure the to_le_bytes in the tests work for big endian architectures that rust-vmm formally supports. Someone with more experience there should give that a look over.

Copy link

@JonathanWoollett-Light JonathanWoollett-Light left a comment

Choose a reason for hiding this comment

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

Lgtm

Copy link
Member

@andreeaflorescu andreeaflorescu left a comment

Choose a reason for hiding this comment

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

LGTM, but needs more testing.

src/ioctls/vcpu.rs Outdated Show resolved Hide resolved
src/ioctls/vcpu.rs Show resolved Hide resolved
Linux kernel defines arm registers up to 2048 bits wide.
To support all different sized registers we change get/set_one_reg methods
to accept a byte slice.
For `set_one_reg` slice contains register data to be written to vcpu.
For `get_one_reg` slice will have register data read from vcpu.

Signed-off-by: Egor Lazarchuk <[email protected]>
CHANGELOG.md Outdated Show resolved Hide resolved
Signed-off-by: Egor Lazarchuk <[email protected]>
@alxiord alxiord merged commit b0a2586 into rust-vmm:main May 22, 2023
@ShadowCurse ShadowCurse deleted the generic_arm branch May 22, 2023 19:57
likebreath added a commit to likebreath/cloud-hypervisor that referenced this pull request Jan 24, 2024
This patch bumps the following crates, including `[email protected]`*,
`[email protected]`**, `[email protected]`, `[email protected]`,
`[email protected]`***, `[email protected]`,
`[email protected]`, `[email protected]`, `[email protected]`,
`[email protected]`, and the latest of `vfio-bindings`, `vfio-ioctls`,
`mshv-bindings`,`mshv-ioctls`, and `vfio-user`.

* A fork of the `kvm-bindings` crate is being used to support
serialization of various structs for migration [1]. Also, code changes
are made to accommodate the updated `struct xsave` from the Linux
kernel. Note: these changes related to `struct xsave` break
live-upgrade.

** The new `kvm-ioctls` crate introduced breaking changes for
the `get/set_one_reg` API on `aarch64` [2], so code changes are made to
the new APIs.

*** A fork of the `versionize_derive` crate is being used to support
versionize on packed structs [3].

[1] https://github.com/cloud-hypervisor/kvm-bindings/tree/ch-v0.7.0
[2] rust-vmm/kvm#223
[3] https://github.com/cloud-hypervisor/versionize_derive/tree/ch-0.1.6

Fixes: cloud-hypervisor#6072

Signed-off-by: Bo Chen <[email protected]>
rbradford pushed a commit to cloud-hypervisor/cloud-hypervisor that referenced this pull request Jan 25, 2024
This patch bumps the following crates, including `[email protected]`*,
`[email protected]`**, `[email protected]`, `[email protected]`,
`[email protected]`***, `[email protected]`,
`[email protected]`, `[email protected]`, `[email protected]`,
`[email protected]`, and the latest of `vfio-bindings`, `vfio-ioctls`,
`mshv-bindings`,`mshv-ioctls`, and `vfio-user`.

* A fork of the `kvm-bindings` crate is being used to support
serialization of various structs for migration [1]. Also, code changes
are made to accommodate the updated `struct xsave` from the Linux
kernel. Note: these changes related to `struct xsave` break
live-upgrade.

** The new `kvm-ioctls` crate introduced breaking changes for
the `get/set_one_reg` API on `aarch64` [2], so code changes are made to
the new APIs.

*** A fork of the `versionize_derive` crate is being used to support
versionize on packed structs [3].

[1] https://github.com/cloud-hypervisor/kvm-bindings/tree/ch-v0.7.0
[2] rust-vmm/kvm#223
[3] https://github.com/cloud-hypervisor/versionize_derive/tree/ch-0.1.6

Fixes: #6072

Signed-off-by: Bo Chen <[email protected]>
likebreath added a commit to likebreath/cloud-hypervisor that referenced this pull request Mar 5, 2024
This patch bumps the following crates, including `[email protected]`*,
`[email protected]`**, `[email protected]`, `[email protected]`,
`[email protected]`***, `[email protected]`,
`[email protected]`, `[email protected]`, `[email protected]`,
`[email protected]`, and the latest of `vfio-bindings`, `vfio-ioctls`,
`mshv-bindings`,`mshv-ioctls`, and `vfio-user`.

* A fork of the `kvm-bindings` crate is being used to support
serialization of various structs for migration [1]. Also, code changes
are made to accommodate the updated `struct xsave` from the Linux
kernel. Note: these changes related to `struct xsave` break
live-upgrade.

** The new `kvm-ioctls` crate introduced breaking changes for
the `get/set_one_reg` API on `aarch64` [2], so code changes are made to
the new APIs.

*** A fork of the `versionize_derive` crate is being used to support
versionize on packed structs [3].

[1] https://github.com/cloud-hypervisor/kvm-bindings/tree/ch-v0.7.0
[2] rust-vmm/kvm#223
[3] https://github.com/cloud-hypervisor/versionize_derive/tree/ch-0.1.6

Fixes: cloud-hypervisor#6072

Signed-off-by: Bo Chen <[email protected]>
(cherry picked from commit 3ce0fef)
github-merge-queue bot pushed a commit to cloud-hypervisor/cloud-hypervisor that referenced this pull request Mar 14, 2024
This patch bumps the following crates, including `[email protected]`*,
`[email protected]`**, `[email protected]`, `[email protected]`,
`[email protected]`***, `[email protected]`,
`[email protected]`, `[email protected]`, `[email protected]`,
`[email protected]`, and the latest of `vfio-bindings`, `vfio-ioctls`,
`mshv-bindings`,`mshv-ioctls`, and `vfio-user`.

* A fork of the `kvm-bindings` crate is being used to support
serialization of various structs for migration [1]. Also, code changes
are made to accommodate the updated `struct xsave` from the Linux
kernel. Note: these changes related to `struct xsave` break
live-upgrade.

** The new `kvm-ioctls` crate introduced breaking changes for
the `get/set_one_reg` API on `aarch64` [2], so code changes are made to
the new APIs.

*** A fork of the `versionize_derive` crate is being used to support
versionize on packed structs [3].

[1] https://github.com/cloud-hypervisor/kvm-bindings/tree/ch-v0.7.0
[2] rust-vmm/kvm#223
[3] https://github.com/cloud-hypervisor/versionize_derive/tree/ch-0.1.6

Fixes: #6072

Signed-off-by: Bo Chen <[email protected]>
(cherry picked from commit 3ce0fef)
github-merge-queue bot pushed a commit to cloud-hypervisor/cloud-hypervisor that referenced this pull request Mar 14, 2024
This patch bumps the following crates, including `[email protected]`*,
`[email protected]`**, `[email protected]`, `[email protected]`,
`[email protected]`***, `[email protected]`,
`[email protected]`, `[email protected]`, `[email protected]`,
`[email protected]`, and the latest of `vfio-bindings`, `vfio-ioctls`,
`mshv-bindings`,`mshv-ioctls`, and `vfio-user`.

* A fork of the `kvm-bindings` crate is being used to support
serialization of various structs for migration [1]. Also, code changes
are made to accommodate the updated `struct xsave` from the Linux
kernel. Note: these changes related to `struct xsave` break
live-upgrade.

** The new `kvm-ioctls` crate introduced breaking changes for
the `get/set_one_reg` API on `aarch64` [2], so code changes are made to
the new APIs.

*** A fork of the `versionize_derive` crate is being used to support
versionize on packed structs [3].

[1] https://github.com/cloud-hypervisor/kvm-bindings/tree/ch-v0.7.0
[2] rust-vmm/kvm#223
[3] https://github.com/cloud-hypervisor/versionize_derive/tree/ch-0.1.6

Fixes: #6072

Signed-off-by: Bo Chen <[email protected]>
(cherry picked from commit 3ce0fef)
github-merge-queue bot pushed a commit to cloud-hypervisor/cloud-hypervisor that referenced this pull request Mar 14, 2024
This patch bumps the following crates, including `[email protected]`*,
`[email protected]`**, `[email protected]`, `[email protected]`,
`[email protected]`***, `[email protected]`,
`[email protected]`, `[email protected]`, `[email protected]`,
`[email protected]`, and the latest of `vfio-bindings`, `vfio-ioctls`,
`mshv-bindings`,`mshv-ioctls`, and `vfio-user`.

* A fork of the `kvm-bindings` crate is being used to support
serialization of various structs for migration [1]. Also, code changes
are made to accommodate the updated `struct xsave` from the Linux
kernel. Note: these changes related to `struct xsave` break
live-upgrade.

** The new `kvm-ioctls` crate introduced breaking changes for
the `get/set_one_reg` API on `aarch64` [2], so code changes are made to
the new APIs.

*** A fork of the `versionize_derive` crate is being used to support
versionize on packed structs [3].

[1] https://github.com/cloud-hypervisor/kvm-bindings/tree/ch-v0.7.0
[2] rust-vmm/kvm#223
[3] https://github.com/cloud-hypervisor/versionize_derive/tree/ch-0.1.6

Fixes: #6072

Signed-off-by: Bo Chen <[email protected]>
(cherry picked from commit 3ce0fef)
likebreath added a commit to cloud-hypervisor/cloud-hypervisor that referenced this pull request Mar 15, 2024
This patch bumps the following crates, including `[email protected]`*,
`[email protected]`**, `[email protected]`, `[email protected]`,
`[email protected]`***, `[email protected]`,
`[email protected]`, `[email protected]`, `[email protected]`,
`[email protected]`, and the latest of `vfio-bindings`, `vfio-ioctls`,
`mshv-bindings`,`mshv-ioctls`, and `vfio-user`.

* A fork of the `kvm-bindings` crate is being used to support
serialization of various structs for migration [1]. Also, code changes
are made to accommodate the updated `struct xsave` from the Linux
kernel. Note: these changes related to `struct xsave` break
live-upgrade.

** The new `kvm-ioctls` crate introduced breaking changes for
the `get/set_one_reg` API on `aarch64` [2], so code changes are made to
the new APIs.

*** A fork of the `versionize_derive` crate is being used to support
versionize on packed structs [3].

[1] https://github.com/cloud-hypervisor/kvm-bindings/tree/ch-v0.7.0
[2] rust-vmm/kvm#223
[3] https://github.com/cloud-hypervisor/versionize_derive/tree/ch-0.1.6

Fixes: #6072

Signed-off-by: Bo Chen <[email protected]>
(cherry picked from commit 3ce0fef)
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.

5 participants