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(-)
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 v3: - 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
On 2026/01/07 16:18, Honglei Huang wrote: > 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 v3: > - 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. Apparently this series still does not explain the utility of VIRTIO_GPU_BLOB_FLAG_USE_USERPTR, which I have a doubt about: https://lore.kernel.org/qemu-devel/35a8add7-da49-4833-9e69-d213f52c771a@amd.com/ I suspect this TODO points to that or maybe something else, but either way I think this should have a RFC tag for now. After all, the corresponding change of virglrenderer has not merged and there is no explicit agreement on the QEMU-facing interface yet. Regards, Akihiko Odaki
On 2026/1/7 15:36, Akihiko Odaki wrote: > On 2026/01/07 16:18, Honglei Huang wrote: >> 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 v3: >> - 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. > > Apparently this series still does not explain the utility of > VIRTIO_GPU_BLOB_FLAG_USE_USERPTR, which I have a doubt about: > https://lore.kernel.org/qemu-devel/35a8add7-da49-4833-9e69- > d213f52c771a@amd.com/ > > I suspect this TODO points to that or maybe something else, but either > way I think this should have a RFC tag for now. After all, the > corresponding change of virglrenderer has not merged and there is no > explicit agreement on the QEMU-facing interface yet. > > Regards, > Akihiko Odaki Hi Akihiko, Thank you for the feedback. I agree with your points: The utility of VIRTIO_GPU_BLOB_FLAG_USE_USERPTR needs better explanation, you're right that this series should be marked as RFC. I'll resend this as RFC v4 with. Thanks for the review! Regards, Honglei
© 2016 - 2026 Red Hat, Inc.