[PATCH RFC v4 0/3] virtio-gpu: Add user pointer and ROCm support enhancements

Honglei Huang posted 3 patches 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260107075030.3453924-1-honghuan@amd.com
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>, Dmitry Osipenko <dmitry.osipenko@collabora.com>, "Michael S. Tsirkin" <mst@redhat.com>, Cornelia Huck <cohuck@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
hw/display/virtio-gpu-base.c                |  3 +++
hw/display/virtio-gpu-gl.c                  |  2 ++
hw/display/virtio-gpu-virgl.c               | 12 ++++++++++++
hw/display/virtio-gpu.c                     |  9 ++-------
include/hw/virtio/virtio-gpu.h              |  6 ++++++
include/standard-headers/linux/virtio_gpu.h |  4 ++++
6 files changed, 29 insertions(+), 7 deletions(-)
[PATCH RFC v4 0/3] virtio-gpu: Add user pointer and ROCm support enhancements
Posted by Honglei Huang 1 month ago
This patch series introduces enhancements to virtio-gpu to improve
memory management and GPU virtualization capabilities for ROCm workloads.

The series includes:

1. VIRTIO_GPU_BLOB_FLAG_USE_USERPTR support: Enables user pointer mapping
   for blob resources, allowing guest applications to use user-allocated
   memory for GPU resources more efficiently.

2. VIRTIO_GPU_F_RESOURCE_USERPTR feature support: Introduces a new virtio-gpu
   feature flag with configurable "userptr=on" device property to enable
   user pointer resources for enhanced memory management.

3. ROCm capability support: Adds native support for AMD's ROCm (Radeon Open
   Compute) platform through a new "rocm=on" device property and
   VIRTIO_GPU_CAPSET_ROCM capability. This enables GPU compute
   workloads using the ROCm stack through virtio-gpu.

Changes in v4:
- Change this series to RFC
- Renamed HSAKMT-related functionality to ROCm for better clarity and
  alignment with the ROCm ecosystem terminology
- Changed device property from "hsakmt=on" to "rocm=on"
- Changed flag from VIRTIO_GPU_FLAG_HSAKMT_ENABLED to
  VIRTIO_GPU_FLAG_ROCM_ENABLED
- Changed renderer flag from VIRGL_RENDER_USE_HSAKMT to
  VIRGL_RENDERER_USE_ROCM
- Updated capset handling to use VIRTIO_GPU_CAPSET_ROCM (8) instead of
  VIRTIO_GPU_CAPSET_HSAKMT (8)
- Removed the error handling fix from patch 1 (virtio-gpu-virgl.c) into
  another thread

These patches work together to provide more flexible and efficient memory
management between guest and host in GPU virtualization scenarios, with
enhanced support for AMD ROCm compute workloads. The changes are backward
compatible and controlled by new device properties.

Usage examples:
  -device virtio-gpu-gl,rocm=on,userptr=on

The series has been tested with ROCm GPU compute workloads requiring
advanced memory management capabilities.

TODO:
- Unify and simplify the handling path for userptr resources.
  This improvement requires coordinated changes across multiple components
  (virglrenderer and virtio-gpu driver), and will be implemented once the
  approach is finalized with other component maintainers.

Related patches in other components:
- Linux kernel virtio-gpu support:
  https://lore.kernel.org/lkml/20251112072910.3716944-1-honglei1.huang@amd.com/
- Virglrenderer support:
  https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1568
- ROCm Runtime support (merged):
  https://github.com/ROCm/ROCR-Runtime/commit/48d3719dba6ca91f597a8179d8b341387ce155e8

Honglei Huang (3):
  virtio-gpu: Add support for VIRTIO_GPU_BLOB_FLAG_USE_USERPTR flag
  virtio-gpu: Add VIRTIO_GPU_F_RESOURCE_USERPTR feature support
  virtio-gpu: Add ROCm capability support

 hw/display/virtio-gpu-base.c                |  3 +++
 hw/display/virtio-gpu-gl.c                  |  2 ++
 hw/display/virtio-gpu-virgl.c               | 12 ++++++++++++
 hw/display/virtio-gpu.c                     |  9 ++-------
 include/hw/virtio/virtio-gpu.h              |  6 ++++++
 include/standard-headers/linux/virtio_gpu.h |  4 ++++
 6 files changed, 29 insertions(+), 7 deletions(-)

-- 
2.34.1