forked from rust-vmm/vhost
-
Notifications
You must be signed in to change notification settings - Fork 0
Gpu socket final #5
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
Draft
mtjhrc
wants to merge
27
commits into
upstream
Choose a base branch
from
gpu-socket-final
base: upstream
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
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
6563882 to
7cc0c02
Compare
This release changes the dependency for virtio-queue to 0.12.0. Signed-off-by: Matias Ezequiel Vara Larsen <mvaralar@redhat.com>
d4703f6 to
427321e
Compare
6c85c1e to
eea0e6d
Compare
6a8c374 to
9c50abb
Compare
FS_* vhost-user backend request messages in BackendReq enum did not make it into the standard yet. Actually, currently there are already SHARED_OBJECT_* messages that use the message type IDs for FS_* types. To fix this and avoid the issue for future message IDs, let's move FS_* types further away and prevent collision to occur. This way we only need to change it once. Signed-off-by: Albert Esteve <aesteve@redhat.com>
Assertion fails on the frontend thread in tests can go unnoticed. To avoid that the main thread finishes before and solve this issue, let's `join()` the thread at the end of the test. Signed-off-by: Albert Esteve <aesteve@redhat.com>
Add SHARED_OBJECT_* vhost-user request IDs to align with standard. Implement backend functions to send these requests. Add SHARED_OBJECT protocol feature. Add GET_SHARED_OBJECT to the frontend requests (not implemented, this is just to have the placeholder and align with current standard). Signed-off-by: Albert Esteve <aesteve@redhat.com>
Check for VHOST_USER_PROTOCOL_F_SHARED_OBJECT flag before allowing the backend to send SHARED_OBJECT_* requests. If it does have negotiated the protocol feature, avoid sending the message and return error code (i.e., !=0). Signed-off-by: Albert Esteve <aesteve@redhat.com>
Signed-off-by: Albert Esteve <aesteve@redhat.com>
Updates the requirements on [nix](https://github.com/nix-rust/nix) to permit the latest version. Updates `nix` to 0.29.0 - [Changelog](https://github.com/nix-rust/nix/blob/master/CHANGELOG.md) - [Commits](nix-rust/nix@v0.28.0...v0.29.0) --- updated-dependencies: - dependency-name: nix dependency-type: direct:production dependency-group: vhost ... Signed-off-by: dependabot[bot] <support@github.com>
Since these non-standard backend request
message types are confirmed not to be used
anymore, let's just remove them.
```
pub enum BackendReq {
...
/// Virtio-fs draft: map file content into the window.
FS_MAP = 100,
/// Virtio-fs draft: unmap file content from the window.
FS_UNMAP = 1001,
/// Virtio-fs draft: sync file content.
FS_SYNC = 1002,
/// Virtio-fs draft: perform a read/write from an fd directly to GPA.
FS_IO = 1003,
...
}
```
Closes: rust-vmm#213
Signed-off-by: Albert Esteve <aesteve@redhat.com>
Signed-off-by: Albert Esteve <aesteve@redhat.com>
virtiofsd 1.11.0 added support for VHOST_USER_PROTOCOL_F_DEVICE_STATE. Upgrading virtiofsd meant that the latest released version of Cloud Hypervisor (39.0) was no longer able to communicate with it, because rather than just ignoring the unsupported feature, it got an unrecoverable "invalid message" error. This demonstrates that it's better for frontends to just ignore offers of unsupported features. If the backend requires some feature, it'll get a chance to know that when we send VHOST_USER_SET_PROTOCOL_FEATURES anyway. Signed-off-by: Alyssa Ross <hi@alyssa.is>
The Endpoint was previusly generic only over the Request. This commit allows Endpoint to be used with a protocol with a slightly different header such as the QEMU GPU protocol on the socket from VHOST_USER_GPU_SET_SOCKET. https://www.qemu.org/docs/master/interop/vhost-user-gpu.html Signed-off-by: Matej Hrica <mhrica@redhat.com>
Move the enum_value macro into vhost_user module and make it public within this module. This will be used in the next commit for defining gpu message enum. Signed-off-by: Matej Hrica <mhrica@redhat.com>
This commit adds the basic definitions of GPU commands on the socket obtained from VHOST_USER_GPU_SET_SOCKET. This also introduces a new feature flag `gpu-socket` in the vhost crate. Signed-off-by: Matej Hrica <mhrica@redhat.com>
The VHOST_USER_GPU_SET_SOCKET is only handled when the feature gpu-socket is enabled. This also introduces a GpuBackend for handling comunication over the socket. Signed-off-by: Matej Hrica <mhrica@redhat.com>
Introduce another constant MAX_MSG_SIZE that is part of the MsgHeader trait. For now this is only used for sending messages. Consider using the more specific trait constant everywhere. The VHOST_USER_GPU_UPDATE and VHOST_USER_GPU_CURSOR_UPDATE contain image data and are larger than the existing MAX_MSG_SIZE. The existing MAX_MSG_SIZE wasn't really a limitation of the protocol, just an implementation detail limitation in this crate. Signed-off-by: Matej Hrica <mhrica@redhat.com>
Add a get_display_info() method and the related reply structs to send VHOST_USER_GPU_GET_DISPLAY_INFO and receive the reply. Signed-off-by: Dorinda Bassey <dbassey@redhat.com> Signed-off-by: Matej Hrica <mhrica@redhat.com>
Add a method and related structs to send VHOST_USER_GPU_GET_EDID and receive the reply. Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
Add a method set_scanout() that sends VHOST_USER_GPU_SCANOUT and doesn't wait for a reply. Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
Add a method and related struct to send VHOST_USER_GPU_UPDATE. The data part of the message is not part of the struct like sugested by the spec but a separate argument to update_scanout. This is necessary because of limitations of having an unsized array inside of struct in Rust. But this aproach seems preferable anyway, because it allows the consumer of the crate to store the array in a diferent location than the struct. Signed-off-by: Dorinda Bassey <dbassey@redhat.com> Signed-off-by: Matej Hrica <mhrica@redhat.com>
Add methods and related structs to send the VHOST_USER_GPU_DMABUF_SCANOUT and VHOST_USER_GPU_DMABUF_UPDATE update messages. Signed-off-by: Matej Hrica <mhrica@redhat.com>
Add get_protocol_features method to send VHOST_USER_GPU_GET_PROTOCOL_FEATURES and receive the reply. Also add a method to send SET_PROTOCOL_FEATURES. Introduce VhostUserGpuProtocolFeatures bitmap that defines possible feature flags. Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
Add methods to send cursor related messages: VHOST_USER_GPU_CURSOR_POS, VHOST_USER_GPU_CURSOR_POS_HIDE and VHOST_USER_GPU_CURSOR_UPDATE. VhostUserGpuCursorUpdate's `data` field is passed as a separate argument into cursor_update method. The type is also an u8 array instead of u32 array like in the spec. Having the type be u8 array makes it easier to work with the data without unsafe code for the consumer of this crate. Having it be a separate argument is useful, because the user of the method doesn't have to copy the array into a struct. Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
Add a method and related struct to send the VHOST_USER_GPU_DMABUF_SCANOUT2 message. Signed-off-by: Matej Hrica <mhrica@redhat.com>
Adds links to PR in CHANGELOG.md for both vhost and vhost-user-backend. Signed-off-by: Matej Hrica <mhrica@redhat.com>
Compile and test with `gpu-socket` feature enabled. Signed-off-by: Matej Hrica <mhrica@redhat.com>
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.
Important changes:
Changed many doc comments
methods now take
&selfinstead of&mut self(like I explained on Slack why)Modified a lot doc comments, made all of them start with uppercase (some were lowercase some uppercase)
set_dmabuf_scanoutneeds to accept file descriptor inside anOptionto be able to fulfill the requirement from spec:(The file descriptor is passed in normal case when enabling a scanout, so it needs to be inside an
Option.update_dmabuf_scanoutshouldn't accept the argumentdata: &[u8]according to specrenamed
cursor_pos_update->cursor_update(It also updates the cursor image not just the position and it is more in line with the name in the spec)
get_protocol_featuresshouldn't accept VhostUserU64 but only return it, spec says:impl<T: Req> VhostUserMsgValidator for VhostUserGpuMsgHeader<T>also checks the if header flags are valid now.Added constant defintions for use with
get_/set_protocol_featurescall