Skip to content

vhost-user: add GpuFrontend API for GPU socket communication - #369

Open
dorindabassey wants to merge 2 commits into
rust-vmm:mainfrom
dorindabassey:gpu_frontend
Open

dorindabassey wants to merge 2 commits into
rust-vmm:mainfrom
dorindabassey:gpu_frontend

Conversation

@dorindabassey

@dorindabassey dorindabassey commented Jul 13, 2026

Copy link
Copy Markdown

Summary of the PR

Add frontend-side API for the vhost-user-gpu protocol socket:

  • VhostUserFrontend::set_gpu_socket() sends GPU_SET_SOCKET message
  • GpuFrontend reads requests and sends typed responses
  • Mirrors existing GpuBackend pattern

Eliminates need for frontends to manually construct GPU protocol headers.

update:
Added recv_payload_exact() to handle partial read - the original recv_into_buf() would truncate large payloads (like gfxstream framebuffers) because recv() could return fewer bytes than requested.
Also added send_header() for some messages like DMABUF_UPDATE that need header-only ACK responses.

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.

Comment thread vhost/src/vhost_user/gpu_frontend_req.rs Outdated
Comment thread vhost/src/vhost_user/frontend.rs
Comment thread vhost/src/vhost_user/gpu_frontend_req.rs Outdated
Comment thread vhost/src/vhost_user/gpu_frontend_req.rs Outdated
Comment thread vhost/src/vhost_user/mod.rs Outdated
@dorindabassey
dorindabassey force-pushed the gpu_frontend branch 2 times, most recently from 9866098 to eae693b Compare July 30, 2026 11:12
@dorindabassey

Copy link
Copy Markdown
Author

Hi @germag I have addressed the comments and rebased the PR. ready for review whenever you have the chance Thanks!

checks buf_size against MAX_MSG_SIZE in recv_into_buf()

Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
@dorindabassey
dorindabassey force-pushed the gpu_frontend branch 2 times, most recently from 457c0e6 to dc44179 Compare September 14, 2026 18:04
Add frontend-side API for the vhost-user-gpu protocol socket:
- VhostUserFrontend::set_gpu_socket() sends GPU_SET_SOCKET message
- GpuFrontend reads requests and sends typed responses
- Mirrors existing GpuBackend pattern

Eliminates need for frontends to manually construct GPU protocol
headers.

Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
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.

2 participants