All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH v7 0/5] virtio-gpu: Add userptr support and ROCm capability
@ 2026-11-06  8:27 Honglei Huang
  2026-11-06  8:27 ` [RFC PATCH v7 1/5] virtio-gpu: Update Linux headers to add ROCm capability set Honglei Huang
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Honglei Huang @ 2026-11-06  8:27 UTC (permalink / raw)
  To: alex.bennee, dmitry.osipenko, odaki, Ray.Huang
  Cc: mst, cohuck, pbonzini, qemu-devel, honghuan

This patch series introduces enhancements to virtio-gpu to improve
memory management and GPU virtualization capabilities for ROCm (Radeon Open Compute) 
workloads.

Usage example:
  -device virtio-gpu-gl,rocm=on

The series includes:

1. Add ROCm capset ID 10 to the imported Linux headers.

2. Enable ROCm native contexts through the "rocm=on" device property.

3. Remove the only qemu side 16384 entry limit for blob backing entries.

4. Add VIRTIO_GPU_F_BLOB_READONLY and VIRTIO_GPU_BLOB_FLAG_USE_READONLY
  to the imported Linux headers.

5. Advertise readonly blob support for ROCm devices with blobs enabled.

See overall detail in virglrenderer pr [1].

Changes in v7:
- Replace the obsolete USE_USERPTR=0x8 / USERPTR_RDONLY=0x10 header
  definitions with negotiated BLOB_READONLY feature bit 6 and
  USE_READONLY=0x8.
- Use ROCm capset ID 10 rather than 8.
- Add readonly advertisement for the paired ROCm blob backend.

Changes in v6:
- Changed to RFC status
- Removed VIRTIO_GPU_F_RESOURCE_USERPTR feature flag from patch 1
- Added VIRTIO_GPU_BLOB_FLAG_USERPTR_RDONLY flag to patch 1

Changes in v5:
- Split userptr header updates into dedicated patch (patch 1/4)
- Extracted nr_entries limit removal into standalone commit (patch 2/4)
- Split ROCm header updates into dedicated patch (patch 3/4)
- Removed VIRTIO_GPU_F_RESOURCE_USERPTR feature detection
- Keep ROCm capability support with "rocm=on" device property (patch 4/4)
- Change corresponding commit messages, change corresponding cover letter content
- Remove RFC label

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

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

Changes in v2:
- Fixed error handling bug in virtio-gpu-virgl.c where the return
  value check was inverted (changed from "if (!ret)" to "if (ret != 0)")
- Added VIRGL_RENDER_USE_HSAKMT flag initialization in virtio_gpu_virgl_init()
  when HSAKMT support is enabled
- Simplified blob resource creation logic by removing complex conditional
  branching for userptr vs regular blob handling
- Updated commit messages to reflect bug fixes and improvements
- Added references to related patches in Linux kernel, virglrenderer, and
  ROCm Runtime components for complete feature implementation tracking

[1]: https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1708

Honglei Huang (5):
  virtio-gpu: Update Linux headers to add ROCm capability set
  virtio-gpu: Add ROCm capability support
  virtio-gpu: remove the artificial IOV mapping limit
  virtio-gpu: add readonly blob definitions to Linux headers
  virtio-gpu: advertise readonly blobs for ROCm

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


base-commit: 73294d096cc591e122fde9e63db4739de6d84f2b
-- 
2.34.1



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [RFC PATCH v7 1/5] virtio-gpu: Update Linux headers to add ROCm capability set
  2026-11-06  8:27 [RFC PATCH v7 0/5] virtio-gpu: Add userptr support and ROCm capability Honglei Huang
@ 2026-11-06  8:27 ` Honglei Huang
  2026-11-27 14:44   ` Alex Bennée
  2026-11-06  8:27 ` [RFC PATCH v7 2/5] virtio-gpu: Add ROCm capability support Honglei Huang
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Honglei Huang @ 2026-11-06  8:27 UTC (permalink / raw)
  To: alex.bennee, dmitry.osipenko, odaki, Ray.Huang
  Cc: mst, cohuck, pbonzini, qemu-devel, honghuan

Add VIRTIO_GPU_CAPSET_ROCM to the imported virtio_gpu.h so the device
can advertise the ROCm capability set to the guest.

Signed-off-by: Honglei Huang <honghuan@amd.com>
---
 include/standard-headers/linux/virtio_gpu.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/standard-headers/linux/virtio_gpu.h b/include/standard-headers/linux/virtio_gpu.h
index c67f50f56cd..976bd225875 100644
--- a/include/standard-headers/linux/virtio_gpu.h
+++ b/include/standard-headers/linux/virtio_gpu.h
@@ -321,6 +321,7 @@ struct virtio_gpu_cmd_submit {
 #define VIRTIO_GPU_CAPSET_VENUS 4
 #define VIRTIO_GPU_CAPSET_CROSS_DOMAIN 5
 #define VIRTIO_GPU_CAPSET_DRM 6
+#define VIRTIO_GPU_CAPSET_ROCM 10
 
 /* VIRTIO_GPU_CMD_GET_CAPSET_INFO */
 struct virtio_gpu_get_capset_info {
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [RFC PATCH v7 2/5] virtio-gpu: Add ROCm capability support
  2026-11-06  8:27 [RFC PATCH v7 0/5] virtio-gpu: Add userptr support and ROCm capability Honglei Huang
  2026-11-06  8:27 ` [RFC PATCH v7 1/5] virtio-gpu: Update Linux headers to add ROCm capability set Honglei Huang
@ 2026-11-06  8:27 ` Honglei Huang
  2026-11-27 14:18   ` Dmitry Osipenko
  2026-11-06  8:27 ` [RFC PATCH v7 3/5] virtio-gpu: remove the artificial IOV mapping limit Honglei Huang
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 15+ messages in thread
From: Honglei Huang @ 2026-11-06  8:27 UTC (permalink / raw)
  To: alex.bennee, dmitry.osipenko, odaki, Ray.Huang
  Cc: mst, cohuck, pbonzini, qemu-devel, honghuan

Add support for ROCm (Radeon Open Compute) capability in virtio-gpu.
This enables GPU compute workloads using AMD's ROCm platform through the
virtio-gpu interface.

Changes include:
- Add "rocm" property to virtio-gpu-gl device
- Define VIRTIO_GPU_FLAG_ROCM_ENABLED flag
- Enable VIRGL_RENDERER_USE_ROCM flag when ROCm is enabled
- Add virtio_gpu_rocm_enabled() helper macro

This allows guests to detect and utilize ROCm capabilities through the
virtio-gpu device when the feature is enabled.

Signed-off-by: Honglei Huang <honghuan@amd.com>
---
 hw/display/virtio-gpu-gl.c     |  2 ++
 hw/display/virtio-gpu-virgl.c  | 17 +++++++++++++++++
 include/hw/virtio/virtio-gpu.h |  3 +++
 3 files changed, 22 insertions(+)

diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c
index 2b7a41c4664..d1f11a5bb92 100644
--- a/hw/display/virtio-gpu-gl.c
+++ b/hw/display/virtio-gpu-gl.c
@@ -170,6 +170,8 @@ static const Property virtio_gpu_gl_properties[] = {
                     VIRTIO_GPU_FLAG_VENUS_ENABLED, false),
     DEFINE_PROP_BIT("drm_native_context", VirtIOGPU, parent_obj.conf.flags,
                     VIRTIO_GPU_FLAG_DRM_ENABLED, false),
+    DEFINE_PROP_BIT("rocm", VirtIOGPU, parent_obj.conf.flags,
+                    VIRTIO_GPU_FLAG_ROCM_ENABLED, false),
 };
 
 static void virtio_gpu_gl_device_unrealize(DeviceState *qdev)
diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
index f71f287d948..f3512337d05 100644
--- a/hw/display/virtio-gpu-virgl.c
+++ b/hw/display/virtio-gpu-virgl.c
@@ -1514,6 +1514,14 @@ static int virtio_gpu_virgl_init(VirtIOGPU *g)
             return -EINVAL;
         }
     }
+    if (virtio_gpu_rocm_enabled(g->parent_obj.conf)) {
+#ifdef VIRGL_RENDERER_USE_ROCM
+        flags |= VIRGL_RENDERER_USE_ROCM;
+#else
+        error_report("rocm requires a ROCm-enabled virglrenderer");
+        return -EINVAL;
+#endif
+    }
 #endif
 
     ret = virgl_renderer_init(g, flags, &virtio_gpu_3d_cbs);
@@ -1615,5 +1623,14 @@ GArray *virtio_gpu_virgl_get_capsets(VirtIOGPU *g)
         }
     }
 
+    if (virtio_gpu_rocm_enabled(g->parent_obj.conf)) {
+        virgl_renderer_get_cap_set(VIRTIO_GPU_CAPSET_ROCM,
+                                   &capset_max_ver,
+                                   &capset_max_size);
+        if (capset_max_size) {
+            virtio_gpu_virgl_add_capset(capset_ids, VIRTIO_GPU_CAPSET_ROCM);
+        }
+    }
+
     return capset_ids;
 }
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index 631dfc63a4d..3c5119ce0e4 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -112,6 +112,7 @@ enum virtio_gpu_base_conf_flags {
     VIRTIO_GPU_FLAG_VENUS_ENABLED,
     VIRTIO_GPU_FLAG_RESOURCE_UUID_ENABLED,
     VIRTIO_GPU_FLAG_DRM_ENABLED,
+    VIRTIO_GPU_FLAG_ROCM_ENABLED,
 };
 
 #define virtio_gpu_virgl_enabled(_cfg) \
@@ -136,6 +137,8 @@ enum virtio_gpu_base_conf_flags {
     (_cfg.flags & (1 << VIRTIO_GPU_FLAG_VENUS_ENABLED))
 #define virtio_gpu_drm_enabled(_cfg) \
     (_cfg.flags & (1 << VIRTIO_GPU_FLAG_DRM_ENABLED))
+#define virtio_gpu_rocm_enabled(_cfg) \
+    (_cfg.flags & (1 << VIRTIO_GPU_FLAG_ROCM_ENABLED))
 
 struct virtio_gpu_base_conf {
     uint32_t max_outputs;
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [RFC PATCH v7 3/5] virtio-gpu: remove the artificial IOV mapping limit
  2026-11-06  8:27 [RFC PATCH v7 0/5] virtio-gpu: Add userptr support and ROCm capability Honglei Huang
  2026-11-06  8:27 ` [RFC PATCH v7 1/5] virtio-gpu: Update Linux headers to add ROCm capability set Honglei Huang
  2026-11-06  8:27 ` [RFC PATCH v7 2/5] virtio-gpu: Add ROCm capability support Honglei Huang
@ 2026-11-06  8:27 ` Honglei Huang
  2026-11-27 14:15   ` Dmitry Osipenko
  2026-11-06  8:27 ` [RFC PATCH v7 4/5] virtio-gpu: add readonly blob definitions to Linux headers Honglei Huang
  2026-11-06  8:27 ` [RFC PATCH v7 5/5] virtio-gpu: advertise readonly blobs for ROCm Honglei Huang
  4 siblings, 1 reply; 15+ messages in thread
From: Honglei Huang @ 2026-11-06  8:27 UTC (permalink / raw)
  To: alex.bennee, dmitry.osipenko, odaki, Ray.Huang
  Cc: mst, cohuck, pbonzini, qemu-devel, honghuan

Userptr-backed blobs can require a very large number of
virtio_gpu_mem_entry elements when their pages are not contiguous. The
guest virtio-gpu frontend forwards that entry count and does not impose
the 16384-entry cap previously enforced by
virtio_gpu_create_mapping_iov().

Drop that QEMU-only limit so these larger userptr iovecs can be mapped.
Keep the existing allocation, copy-size, and DMA mapping checks.

Signed-off-by: Honglei Huang <honghuan@amd.com>
---
 hw/display/virtio-gpu.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 5d43ffb9918..3df7e3507f4 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -990,13 +990,6 @@ int virtio_gpu_create_mapping_iov(VirtIOGPU *g,
     size_t esize, s;
     int e, v;
 
-    if (nr_entries > 16384) {
-        qemu_log_mask(LOG_GUEST_ERROR,
-                      "%s: nr_entries is too big (%d > 16384)\n",
-                      __func__, nr_entries);
-        return -1;
-    }
-
     esize = sizeof(*ents) * nr_entries;
     ents = g_try_malloc(esize);
     if (!ents && esize) {
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [RFC PATCH v7 4/5] virtio-gpu: add readonly blob definitions to Linux headers
  2026-11-06  8:27 [RFC PATCH v7 0/5] virtio-gpu: Add userptr support and ROCm capability Honglei Huang
                   ` (2 preceding siblings ...)
  2026-11-06  8:27 ` [RFC PATCH v7 3/5] virtio-gpu: remove the artificial IOV mapping limit Honglei Huang
@ 2026-11-06  8:27 ` Honglei Huang
  2026-11-06  8:27 ` [RFC PATCH v7 5/5] virtio-gpu: advertise readonly blobs for ROCm Honglei Huang
  4 siblings, 0 replies; 15+ messages in thread
From: Honglei Huang @ 2026-11-06  8:27 UTC (permalink / raw)
  To: alex.bennee, dmitry.osipenko, odaki, Ray.Huang
  Cc: mst, cohuck, pbonzini, qemu-devel, honghuan

Add VIRTIO_GPU_F_BLOB_READONLY and VIRTIO_GPU_BLOB_FLAG_USE_READONLY
to the imported virtio-gpu header.

Mirror the kernel UAPI definitions needed by readonly blob support.
This is a targeted header update, not a full Linux header resync.

Signed-off-by: Honglei Huang <honghuan@amd.com>
---
 include/standard-headers/linux/virtio_gpu.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/standard-headers/linux/virtio_gpu.h b/include/standard-headers/linux/virtio_gpu.h
index 976bd225875..7a91181287e 100644
--- a/include/standard-headers/linux/virtio_gpu.h
+++ b/include/standard-headers/linux/virtio_gpu.h
@@ -72,6 +72,7 @@
  * must be aligned to that value.
  */
 #define VIRTIO_GPU_F_BLOB_ALIGNMENT      5
+#define VIRTIO_GPU_F_BLOB_READONLY       6
 
 enum virtio_gpu_ctrl_type {
 	VIRTIO_GPU_UNDEFINED = 0,
@@ -415,6 +416,7 @@ struct virtio_gpu_resource_create_blob {
 #define VIRTIO_GPU_BLOB_FLAG_USE_MAPPABLE     0x0001
 #define VIRTIO_GPU_BLOB_FLAG_USE_SHAREABLE    0x0002
 #define VIRTIO_GPU_BLOB_FLAG_USE_CROSS_DEVICE 0x0004
+#define VIRTIO_GPU_BLOB_FLAG_USE_READONLY     0x0008
 	/* zero is invalid blob mem */
 	uint32_t blob_mem;
 	uint32_t blob_flags;
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [RFC PATCH v7 5/5] virtio-gpu: advertise readonly blobs for ROCm
  2026-11-06  8:27 [RFC PATCH v7 0/5] virtio-gpu: Add userptr support and ROCm capability Honglei Huang
                   ` (3 preceding siblings ...)
  2026-11-06  8:27 ` [RFC PATCH v7 4/5] virtio-gpu: add readonly blob definitions to Linux headers Honglei Huang
@ 2026-11-06  8:27 ` Honglei Huang
  2026-11-27 14:07   ` Dmitry Osipenko
  4 siblings, 1 reply; 15+ messages in thread
From: Honglei Huang @ 2026-11-06  8:27 UTC (permalink / raw)
  To: alex.bennee, dmitry.osipenko, odaki, Ray.Huang
  Cc: mst, cohuck, pbonzini, qemu-devel, honghuan

Mark readonly blobs available when the ROCm capset is present, and
advertise the feature only for ROCm devices with blob support enabled.
Treat readonly registration support as part of the paired ROCm backend.

Signed-off-by: Honglei Huang <honghuan@amd.com>
---
 hw/display/virtio-gpu-base.c   | 4 ++++
 hw/display/virtio-gpu-virgl.c  | 3 +++
 include/hw/virtio/virtio-gpu.h | 3 +++
 3 files changed, 10 insertions(+)

diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c
index 270fbaae102..b6333e67c0f 100644
--- a/hw/display/virtio-gpu-base.c
+++ b/hw/display/virtio-gpu-base.c
@@ -269,6 +269,10 @@ virtio_gpu_base_get_features(VirtIODevice *vdev, uint64_t features,
     }
     if (virtio_gpu_blob_enabled(g->conf)) {
         features |= (1 << VIRTIO_GPU_F_RESOURCE_BLOB);
+        if (virtio_gpu_rocm_enabled(g->conf) &&
+            virtio_gpu_blob_readonly_enabled(g->conf)) {
+            features |= (1 << VIRTIO_GPU_F_BLOB_READONLY);
+        }
     }
     if (virtio_gpu_context_init_enabled(g->conf)) {
         features |= (1 << VIRTIO_GPU_F_CONTEXT_INIT);
diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
index f3512337d05..87ee7ac57c4 100644
--- a/hw/display/virtio-gpu-virgl.c
+++ b/hw/display/virtio-gpu-virgl.c
@@ -1593,6 +1593,7 @@ GArray *virtio_gpu_virgl_get_capsets(VirtIOGPU *g)
     uint32_t capset_max_ver, capset_max_size;
     GArray *capset_ids;
 
+    g->parent_obj.conf.flags &= ~(1 << VIRTIO_GPU_FLAG_BLOB_READONLY_ENABLED);
     capset_ids = g_array_new(false, false, sizeof(uint32_t));
 
     /* VIRGL is always supported. */
@@ -1629,6 +1630,8 @@ GArray *virtio_gpu_virgl_get_capsets(VirtIOGPU *g)
                                    &capset_max_size);
         if (capset_max_size) {
             virtio_gpu_virgl_add_capset(capset_ids, VIRTIO_GPU_CAPSET_ROCM);
+            g->parent_obj.conf.flags |=
+                1 << VIRTIO_GPU_FLAG_BLOB_READONLY_ENABLED;
         }
     }
 
diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
index 3c5119ce0e4..dacf70b41a6 100644
--- a/include/hw/virtio/virtio-gpu.h
+++ b/include/hw/virtio/virtio-gpu.h
@@ -113,6 +113,7 @@ enum virtio_gpu_base_conf_flags {
     VIRTIO_GPU_FLAG_RESOURCE_UUID_ENABLED,
     VIRTIO_GPU_FLAG_DRM_ENABLED,
     VIRTIO_GPU_FLAG_ROCM_ENABLED,
+    VIRTIO_GPU_FLAG_BLOB_READONLY_ENABLED,
 };
 
 #define virtio_gpu_virgl_enabled(_cfg) \
@@ -139,6 +140,8 @@ enum virtio_gpu_base_conf_flags {
     (_cfg.flags & (1 << VIRTIO_GPU_FLAG_DRM_ENABLED))
 #define virtio_gpu_rocm_enabled(_cfg) \
     (_cfg.flags & (1 << VIRTIO_GPU_FLAG_ROCM_ENABLED))
+#define virtio_gpu_blob_readonly_enabled(_cfg) \
+    (_cfg.flags & (1 << VIRTIO_GPU_FLAG_BLOB_READONLY_ENABLED))
 
 struct virtio_gpu_base_conf {
     uint32_t max_outputs;
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [RFC PATCH v7 5/5] virtio-gpu: advertise readonly blobs for ROCm
  2026-11-06  8:27 ` [RFC PATCH v7 5/5] virtio-gpu: advertise readonly blobs for ROCm Honglei Huang
@ 2026-11-27 14:07   ` Dmitry Osipenko
  2026-11-30  9:49     ` Huang, Honglei
  0 siblings, 1 reply; 15+ messages in thread
From: Dmitry Osipenko @ 2026-11-27 14:07 UTC (permalink / raw)
  To: Honglei Huang, alex.bennee, odaki, Ray.Huang
  Cc: mst, cohuck, pbonzini, qemu-devel

On 11/6/26 11:27, Honglei Huang wrote:
> Mark readonly blobs available when the ROCm capset is present, and
> advertise the feature only for ROCm devices with blob support enabled.
> Treat readonly registration support as part of the paired ROCm backend.
> 
> Signed-off-by: Honglei Huang <honghuan@amd.com>
> ---
>   hw/display/virtio-gpu-base.c   | 4 ++++
>   hw/display/virtio-gpu-virgl.c  | 3 +++
>   include/hw/virtio/virtio-gpu.h | 3 +++
>   3 files changed, 10 insertions(+)
> 
> diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c
> index 270fbaae102..b6333e67c0f 100644
> --- a/hw/display/virtio-gpu-base.c
> +++ b/hw/display/virtio-gpu-base.c
> @@ -269,6 +269,10 @@ virtio_gpu_base_get_features(VirtIODevice *vdev, uint64_t features,
>       }
>       if (virtio_gpu_blob_enabled(g->conf)) {
>           features |= (1 << VIRTIO_GPU_F_RESOURCE_BLOB);
> +        if (virtio_gpu_rocm_enabled(g->conf) &&
> +            virtio_gpu_blob_readonly_enabled(g->conf)) {
> +            features |= (1 << VIRTIO_GPU_F_BLOB_READONLY);
> +        }
>       }
>       if (virtio_gpu_context_init_enabled(g->conf)) {
>           features |= (1 << VIRTIO_GPU_F_CONTEXT_INIT);
> diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
> index f3512337d05..87ee7ac57c4 100644
> --- a/hw/display/virtio-gpu-virgl.c
> +++ b/hw/display/virtio-gpu-virgl.c
> @@ -1593,6 +1593,7 @@ GArray *virtio_gpu_virgl_get_capsets(VirtIOGPU *g)
>       uint32_t capset_max_ver, capset_max_size;
>       GArray *capset_ids;
>   
> +    g->parent_obj.conf.flags &= ~(1 << VIRTIO_GPU_FLAG_BLOB_READONLY_ENABLED);
>       capset_ids = g_array_new(false, false, sizeof(uint32_t));
>   
>       /* VIRGL is always supported. */
> @@ -1629,6 +1630,8 @@ GArray *virtio_gpu_virgl_get_capsets(VirtIOGPU *g)
>                                      &capset_max_size);
>           if (capset_max_size) {
>               virtio_gpu_virgl_add_capset(capset_ids, VIRTIO_GPU_CAPSET_ROCM);
> +            g->parent_obj.conf.flags |=
> +                1 << VIRTIO_GPU_FLAG_BLOB_READONLY_ENABLED;
>           }
>       }
>   
> diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
> index 3c5119ce0e4..dacf70b41a6 100644
> --- a/include/hw/virtio/virtio-gpu.h
> +++ b/include/hw/virtio/virtio-gpu.h
> @@ -113,6 +113,7 @@ enum virtio_gpu_base_conf_flags {
>       VIRTIO_GPU_FLAG_RESOURCE_UUID_ENABLED,
>       VIRTIO_GPU_FLAG_DRM_ENABLED,
>       VIRTIO_GPU_FLAG_ROCM_ENABLED,
> +    VIRTIO_GPU_FLAG_BLOB_READONLY_ENABLED,
>   };
>   
>   #define virtio_gpu_virgl_enabled(_cfg) \
> @@ -139,6 +140,8 @@ enum virtio_gpu_base_conf_flags {
>       (_cfg.flags & (1 << VIRTIO_GPU_FLAG_DRM_ENABLED))
>   #define virtio_gpu_rocm_enabled(_cfg) \
>       (_cfg.flags & (1 << VIRTIO_GPU_FLAG_ROCM_ENABLED))
> +#define virtio_gpu_blob_readonly_enabled(_cfg) \
> +    (_cfg.flags & (1 << VIRTIO_GPU_FLAG_BLOB_READONLY_ENABLED))
>   
>   struct virtio_gpu_base_conf {
>       uint32_t max_outputs;

The RO flag is generic, it shouldn't be made specific to ROCm and should 
always present. Should be up to a context type how to handle this flag, 
AFAICT. Any reason it shouldn't be generic?

-- 
Best regards,
Dmitry


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [RFC PATCH v7 3/5] virtio-gpu: remove the artificial IOV mapping limit
  2026-11-06  8:27 ` [RFC PATCH v7 3/5] virtio-gpu: remove the artificial IOV mapping limit Honglei Huang
@ 2026-11-27 14:15   ` Dmitry Osipenko
  2026-11-30  9:50     ` Huang, Honglei
  0 siblings, 1 reply; 15+ messages in thread
From: Dmitry Osipenko @ 2026-11-27 14:15 UTC (permalink / raw)
  To: Honglei Huang, alex.bennee, odaki, Ray.Huang
  Cc: mst, cohuck, pbonzini, qemu-devel

On 11/6/26 11:27, Honglei Huang wrote:
> Userptr-backed blobs can require a very large number of
> virtio_gpu_mem_entry elements when their pages are not contiguous. The
> guest virtio-gpu frontend forwards that entry count and does not impose
> the 16384-entry cap previously enforced by
> virtio_gpu_create_mapping_iov().
> 
> Drop that QEMU-only limit so these larger userptr iovecs can be mapped.
> Keep the existing allocation, copy-size, and DMA mapping checks.
> 
> Signed-off-by: Honglei Huang <honghuan@amd.com>
> ---
>   hw/display/virtio-gpu.c | 7 -------
>   1 file changed, 7 deletions(-)
> 
> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
> index 5d43ffb9918..3df7e3507f4 100644
> --- a/hw/display/virtio-gpu.c
> +++ b/hw/display/virtio-gpu.c
> @@ -990,13 +990,6 @@ int virtio_gpu_create_mapping_iov(VirtIOGPU *g,
>       size_t esize, s;
>       int e, v;
>   
> -    if (nr_entries > 16384) {
> -        qemu_log_mask(LOG_GUEST_ERROR,
> -                      "%s: nr_entries is too big (%d > 16384)\n",
> -                      __func__, nr_entries);
> -        return -1;
> -    }
> -
>       esize = sizeof(*ents) * nr_entries;
>       ents = g_try_malloc(esize);
>       if (!ents && esize) {

The nr_entries needs to be validates, that it won't result in int 
overflows on 32bit arches.

-- 
Best regards,
Dmitry


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [RFC PATCH v7 2/5] virtio-gpu: Add ROCm capability support
  2026-11-06  8:27 ` [RFC PATCH v7 2/5] virtio-gpu: Add ROCm capability support Honglei Huang
@ 2026-11-27 14:18   ` Dmitry Osipenko
  2026-11-30  9:51     ` Huang, Honglei
  0 siblings, 1 reply; 15+ messages in thread
From: Dmitry Osipenko @ 2026-11-27 14:18 UTC (permalink / raw)
  To: Honglei Huang, alex.bennee, odaki, Ray.Huang
  Cc: mst, cohuck, pbonzini, qemu-devel

On 11/6/26 11:27, Honglei Huang wrote:
> Add support for ROCm (Radeon Open Compute) capability in virtio-gpu.
> This enables GPU compute workloads using AMD's ROCm platform through the
> virtio-gpu interface.
> 
> Changes include:
> - Add "rocm" property to virtio-gpu-gl device
> - Define VIRTIO_GPU_FLAG_ROCM_ENABLED flag
> - Enable VIRGL_RENDERER_USE_ROCM flag when ROCm is enabled
> - Add virtio_gpu_rocm_enabled() helper macro
> 
> This allows guests to detect and utilize ROCm capabilities through the
> virtio-gpu device when the feature is enabled.
> 
> Signed-off-by: Honglei Huang <honghuan@amd.com>
> ---
>   hw/display/virtio-gpu-gl.c     |  2 ++
>   hw/display/virtio-gpu-virgl.c  | 17 +++++++++++++++++
>   include/hw/virtio/virtio-gpu.h |  3 +++
>   3 files changed, 22 insertions(+)
> 
> diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c
> index 2b7a41c4664..d1f11a5bb92 100644
> --- a/hw/display/virtio-gpu-gl.c
> +++ b/hw/display/virtio-gpu-gl.c
> @@ -170,6 +170,8 @@ static const Property virtio_gpu_gl_properties[] = {
>                       VIRTIO_GPU_FLAG_VENUS_ENABLED, false),
>       DEFINE_PROP_BIT("drm_native_context", VirtIOGPU, parent_obj.conf.flags,
>                       VIRTIO_GPU_FLAG_DRM_ENABLED, false),
> +    DEFINE_PROP_BIT("rocm", VirtIOGPU, parent_obj.conf.flags,
> +                    VIRTIO_GPU_FLAG_ROCM_ENABLED, false),
>   };
>   
>   static void virtio_gpu_gl_device_unrealize(DeviceState *qdev)
> diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
> index f71f287d948..f3512337d05 100644
> --- a/hw/display/virtio-gpu-virgl.c
> +++ b/hw/display/virtio-gpu-virgl.c
> @@ -1514,6 +1514,14 @@ static int virtio_gpu_virgl_init(VirtIOGPU *g)
>               return -EINVAL;
>           }
>       }
> +    if (virtio_gpu_rocm_enabled(g->parent_obj.conf)) {
> +#ifdef VIRGL_RENDERER_USE_ROCM
> +        flags |= VIRGL_RENDERER_USE_ROCM;
> +#else
> +        error_report("rocm requires a ROCm-enabled virglrenderer");
> +        return -EINVAL;
> +#endif
> +    }
>   #endif
>   
>       ret = virgl_renderer_init(g, flags, &virtio_gpu_3d_cbs);
> @@ -1615,5 +1623,14 @@ GArray *virtio_gpu_virgl_get_capsets(VirtIOGPU *g)
>           }
>       }
>   
> +    if (virtio_gpu_rocm_enabled(g->parent_obj.conf)) {
> +        virgl_renderer_get_cap_set(VIRTIO_GPU_CAPSET_ROCM,
> +                                   &capset_max_ver,
> +                                   &capset_max_size);
> +        if (capset_max_size) {
> +            virtio_gpu_virgl_add_capset(capset_ids, VIRTIO_GPU_CAPSET_ROCM);
> +        }
> +    }
> +
>       return capset_ids;
>   }
> diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h
> index 631dfc63a4d..3c5119ce0e4 100644
> --- a/include/hw/virtio/virtio-gpu.h
> +++ b/include/hw/virtio/virtio-gpu.h
> @@ -112,6 +112,7 @@ enum virtio_gpu_base_conf_flags {
>       VIRTIO_GPU_FLAG_VENUS_ENABLED,
>       VIRTIO_GPU_FLAG_RESOURCE_UUID_ENABLED,
>       VIRTIO_GPU_FLAG_DRM_ENABLED,
> +    VIRTIO_GPU_FLAG_ROCM_ENABLED,
>   };
>   
>   #define virtio_gpu_virgl_enabled(_cfg) \
> @@ -136,6 +137,8 @@ enum virtio_gpu_base_conf_flags {
>       (_cfg.flags & (1 << VIRTIO_GPU_FLAG_VENUS_ENABLED))
>   #define virtio_gpu_drm_enabled(_cfg) \
>       (_cfg.flags & (1 << VIRTIO_GPU_FLAG_DRM_ENABLED))
> +#define virtio_gpu_rocm_enabled(_cfg) \
> +    (_cfg.flags & (1 << VIRTIO_GPU_FLAG_ROCM_ENABLED))
>   
>   struct virtio_gpu_base_conf {
>       uint32_t max_outputs;

Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>

-- 
Best regards,
Dmitry


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [RFC PATCH v7 1/5] virtio-gpu: Update Linux headers to add ROCm capability set
  2026-11-06  8:27 ` [RFC PATCH v7 1/5] virtio-gpu: Update Linux headers to add ROCm capability set Honglei Huang
@ 2026-11-27 14:44   ` Alex Bennée
  2026-11-30 10:00     ` Huang, Honglei
  0 siblings, 1 reply; 15+ messages in thread
From: Alex Bennée @ 2026-11-27 14:44 UTC (permalink / raw)
  To: Honglei Huang
  Cc: dmitry.osipenko, odaki, Ray.Huang, mst, cohuck, pbonzini,
	qemu-devel

Honglei Huang <honghuan@amd.com> writes:

> Add VIRTIO_GPU_CAPSET_ROCM to the imported virtio_gpu.h so the device
> can advertise the ROCm capability set to the guest.
>
> Signed-off-by: Honglei Huang <honghuan@amd.com>
> ---
>  include/standard-headers/linux/virtio_gpu.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/include/standard-headers/linux/virtio_gpu.h b/include/standard-headers/linux/virtio_gpu.h
> index c67f50f56cd..976bd225875 100644
> --- a/include/standard-headers/linux/virtio_gpu.h
> +++ b/include/standard-headers/linux/virtio_gpu.h
> @@ -321,6 +321,7 @@ struct virtio_gpu_cmd_submit {
>  #define VIRTIO_GPU_CAPSET_VENUS 4
>  #define VIRTIO_GPU_CAPSET_CROSS_DOMAIN 5
>  #define VIRTIO_GPU_CAPSET_DRM 6
> +#define VIRTIO_GPU_CAPSET_ROCM 10

Generally while patches are in flight you would include a reference to
the kernel patches so we can track when they get merged into the kernel:

  linux-headers: Update to v7.3-rc1-amd-baz (!UPSTREAM)

  You can find the current proposed  kernel series at http://foo.bar/repo/branch.

  sob

And ideally use the update-headers script to import them to make sure
they are properly sanitised.

>  
>  /* VIRTIO_GPU_CMD_GET_CAPSET_INFO */
>  struct virtio_gpu_get_capset_info {

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [RFC PATCH v7 5/5] virtio-gpu: advertise readonly blobs for ROCm
  2026-11-27 14:07   ` Dmitry Osipenko
@ 2026-11-30  9:49     ` Huang, Honglei
  0 siblings, 0 replies; 15+ messages in thread
From: Huang, Honglei @ 2026-11-30  9:49 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: mst, cohuck, pbonzini, qemu-devel, alex.bennee, odaki, Ray.Huang



On 11/27/2026 10:07 PM, Dmitry Osipenko wrote:
> On 11/6/26 11:27, Honglei Huang wrote:
>> Mark readonly blobs available when the ROCm capset is present, and
>> advertise the feature only for ROCm devices with blob support enabled.
>> Treat readonly registration support as part of the paired ROCm backend.
>>
>> Signed-off-by: Honglei Huang <honghuan@amd.com>
>> ---
>>   hw/display/virtio-gpu-base.c   | 4 ++++
>>   hw/display/virtio-gpu-virgl.c  | 3 +++
>>   include/hw/virtio/virtio-gpu.h | 3 +++
>>   3 files changed, 10 insertions(+)
>>
>> diff --git a/hw/display/virtio-gpu-base.c b/hw/display/virtio-gpu-base.c
>> index 270fbaae102..b6333e67c0f 100644
>> --- a/hw/display/virtio-gpu-base.c
>> +++ b/hw/display/virtio-gpu-base.c
>> @@ -269,6 +269,10 @@ virtio_gpu_base_get_features(VirtIODevice *vdev, 
>> uint64_t features,
>>       }
>>       if (virtio_gpu_blob_enabled(g->conf)) {
>>           features |= (1 << VIRTIO_GPU_F_RESOURCE_BLOB);
>> +        if (virtio_gpu_rocm_enabled(g->conf) &&
>> +            virtio_gpu_blob_readonly_enabled(g->conf)) {
>> +            features |= (1 << VIRTIO_GPU_F_BLOB_READONLY);
>> +        }
>>       }
>>       if (virtio_gpu_context_init_enabled(g->conf)) {
>>           features |= (1 << VIRTIO_GPU_F_CONTEXT_INIT);
>> diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu- 
>> virgl.c
>> index f3512337d05..87ee7ac57c4 100644
>> --- a/hw/display/virtio-gpu-virgl.c
>> +++ b/hw/display/virtio-gpu-virgl.c
>> @@ -1593,6 +1593,7 @@ GArray *virtio_gpu_virgl_get_capsets(VirtIOGPU *g)
>>       uint32_t capset_max_ver, capset_max_size;
>>       GArray *capset_ids;
>> +    g->parent_obj.conf.flags &= ~(1 << 
>> VIRTIO_GPU_FLAG_BLOB_READONLY_ENABLED);
>>       capset_ids = g_array_new(false, false, sizeof(uint32_t));
>>       /* VIRGL is always supported. */
>> @@ -1629,6 +1630,8 @@ GArray *virtio_gpu_virgl_get_capsets(VirtIOGPU *g)
>>                                      &capset_max_size);
>>           if (capset_max_size) {
>>               virtio_gpu_virgl_add_capset(capset_ids, 
>> VIRTIO_GPU_CAPSET_ROCM);
>> +            g->parent_obj.conf.flags |=
>> +                1 << VIRTIO_GPU_FLAG_BLOB_READONLY_ENABLED;
>>           }
>>       }
>> diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/ 
>> virtio-gpu.h
>> index 3c5119ce0e4..dacf70b41a6 100644
>> --- a/include/hw/virtio/virtio-gpu.h
>> +++ b/include/hw/virtio/virtio-gpu.h
>> @@ -113,6 +113,7 @@ enum virtio_gpu_base_conf_flags {
>>       VIRTIO_GPU_FLAG_RESOURCE_UUID_ENABLED,
>>       VIRTIO_GPU_FLAG_DRM_ENABLED,
>>       VIRTIO_GPU_FLAG_ROCM_ENABLED,
>> +    VIRTIO_GPU_FLAG_BLOB_READONLY_ENABLED,
>>   };
>>   #define virtio_gpu_virgl_enabled(_cfg) \
>> @@ -139,6 +140,8 @@ enum virtio_gpu_base_conf_flags {
>>       (_cfg.flags & (1 << VIRTIO_GPU_FLAG_DRM_ENABLED))
>>   #define virtio_gpu_rocm_enabled(_cfg) \
>>       (_cfg.flags & (1 << VIRTIO_GPU_FLAG_ROCM_ENABLED))
>> +#define virtio_gpu_blob_readonly_enabled(_cfg) \
>> +    (_cfg.flags & (1 << VIRTIO_GPU_FLAG_BLOB_READONLY_ENABLED))
>>   struct virtio_gpu_base_conf {
>>       uint32_t max_outputs;
> 
> The RO flag is generic, it shouldn't be made specific to ROCm and should 
> always present. Should be up to a context type how to handle this flag, 
> AFAICT. Any reason it shouldn't be generic?

Got it will change it to generic, change it to always present.

Regards,
Honglei



> 



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [RFC PATCH v7 3/5] virtio-gpu: remove the artificial IOV mapping limit
  2026-11-27 14:15   ` Dmitry Osipenko
@ 2026-11-30  9:50     ` Huang, Honglei
  2026-11-30 10:35       ` Huang, Honglei
  0 siblings, 1 reply; 15+ messages in thread
From: Huang, Honglei @ 2026-11-30  9:50 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: mst, cohuck, pbonzini, qemu-devel, alex.bennee, odaki, Ray.Huang



On 11/27/2026 10:15 PM, Dmitry Osipenko wrote:
> On 11/6/26 11:27, Honglei Huang wrote:
>> Userptr-backed blobs can require a very large number of
>> virtio_gpu_mem_entry elements when their pages are not contiguous. The
>> guest virtio-gpu frontend forwards that entry count and does not impose
>> the 16384-entry cap previously enforced by
>> virtio_gpu_create_mapping_iov().
>>
>> Drop that QEMU-only limit so these larger userptr iovecs can be mapped.
>> Keep the existing allocation, copy-size, and DMA mapping checks.
>>
>> Signed-off-by: Honglei Huang <honghuan@amd.com>
>> ---
>>   hw/display/virtio-gpu.c | 7 -------
>>   1 file changed, 7 deletions(-)
>>
>> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
>> index 5d43ffb9918..3df7e3507f4 100644
>> --- a/hw/display/virtio-gpu.c
>> +++ b/hw/display/virtio-gpu.c
>> @@ -990,13 +990,6 @@ int virtio_gpu_create_mapping_iov(VirtIOGPU *g,
>>       size_t esize, s;
>>       int e, v;
>> -    if (nr_entries > 16384) {
>> -        qemu_log_mask(LOG_GUEST_ERROR,
>> -                      "%s: nr_entries is too big (%d > 16384)\n",
>> -                      __func__, nr_entries);
>> -        return -1;
>> -    }
>> -
>>       esize = sizeof(*ents) * nr_entries;
>>       ents = g_try_malloc(esize);
>>       if (!ents && esize) {
> 
> The nr_entries needs to be validates, that it won't result in int 
> overflows on 32bit arches.

Got it will keep the nr_entries check, so this patch will be removed.

Regards,
Honglei

> 



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [RFC PATCH v7 2/5] virtio-gpu: Add ROCm capability support
  2026-11-27 14:18   ` Dmitry Osipenko
@ 2026-11-30  9:51     ` Huang, Honglei
  0 siblings, 0 replies; 15+ messages in thread
From: Huang, Honglei @ 2026-11-30  9:51 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: mst, cohuck, pbonzini, qemu-devel, alex.bennee, odaki, Ray.Huang



On 11/27/2026 10:18 PM, Dmitry Osipenko wrote:
> On 11/6/26 11:27, Honglei Huang wrote:
>> Add support for ROCm (Radeon Open Compute) capability in virtio-gpu.
>> This enables GPU compute workloads using AMD's ROCm platform through the
>> virtio-gpu interface.
>>
>> Changes include:
>> - Add "rocm" property to virtio-gpu-gl device
>> - Define VIRTIO_GPU_FLAG_ROCM_ENABLED flag
>> - Enable VIRGL_RENDERER_USE_ROCM flag when ROCm is enabled
>> - Add virtio_gpu_rocm_enabled() helper macro
>>
>> This allows guests to detect and utilize ROCm capabilities through the
>> virtio-gpu device when the feature is enabled.
>>
>> Signed-off-by: Honglei Huang <honghuan@amd.com>
>> ---
>>   hw/display/virtio-gpu-gl.c     |  2 ++
>>   hw/display/virtio-gpu-virgl.c  | 17 +++++++++++++++++
>>   include/hw/virtio/virtio-gpu.h |  3 +++
>>   3 files changed, 22 insertions(+)
>>
>> diff --git a/hw/display/virtio-gpu-gl.c b/hw/display/virtio-gpu-gl.c
>> index 2b7a41c4664..d1f11a5bb92 100644
>> --- a/hw/display/virtio-gpu-gl.c
>> +++ b/hw/display/virtio-gpu-gl.c
>> @@ -170,6 +170,8 @@ static const Property virtio_gpu_gl_properties[] = {
>>                       VIRTIO_GPU_FLAG_VENUS_ENABLED, false),
>>       DEFINE_PROP_BIT("drm_native_context", VirtIOGPU, 
>> parent_obj.conf.flags,
>>                       VIRTIO_GPU_FLAG_DRM_ENABLED, false),
>> +    DEFINE_PROP_BIT("rocm", VirtIOGPU, parent_obj.conf.flags,
>> +                    VIRTIO_GPU_FLAG_ROCM_ENABLED, false),
>>   };
>>   static void virtio_gpu_gl_device_unrealize(DeviceState *qdev)
>> diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu- 
>> virgl.c
>> index f71f287d948..f3512337d05 100644
>> --- a/hw/display/virtio-gpu-virgl.c
>> +++ b/hw/display/virtio-gpu-virgl.c
>> @@ -1514,6 +1514,14 @@ static int virtio_gpu_virgl_init(VirtIOGPU *g)
>>               return -EINVAL;
>>           }
>>       }
>> +    if (virtio_gpu_rocm_enabled(g->parent_obj.conf)) {
>> +#ifdef VIRGL_RENDERER_USE_ROCM
>> +        flags |= VIRGL_RENDERER_USE_ROCM;
>> +#else
>> +        error_report("rocm requires a ROCm-enabled virglrenderer");
>> +        return -EINVAL;
>> +#endif
>> +    }
>>   #endif
>>       ret = virgl_renderer_init(g, flags, &virtio_gpu_3d_cbs);
>> @@ -1615,5 +1623,14 @@ GArray *virtio_gpu_virgl_get_capsets(VirtIOGPU *g)
>>           }
>>       }
>> +    if (virtio_gpu_rocm_enabled(g->parent_obj.conf)) {
>> +        virgl_renderer_get_cap_set(VIRTIO_GPU_CAPSET_ROCM,
>> +                                   &capset_max_ver,
>> +                                   &capset_max_size);
>> +        if (capset_max_size) {
>> +            virtio_gpu_virgl_add_capset(capset_ids, 
>> VIRTIO_GPU_CAPSET_ROCM);
>> +        }
>> +    }
>> +
>>       return capset_ids;
>>   }
>> diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/ 
>> virtio-gpu.h
>> index 631dfc63a4d..3c5119ce0e4 100644
>> --- a/include/hw/virtio/virtio-gpu.h
>> +++ b/include/hw/virtio/virtio-gpu.h
>> @@ -112,6 +112,7 @@ enum virtio_gpu_base_conf_flags {
>>       VIRTIO_GPU_FLAG_VENUS_ENABLED,
>>       VIRTIO_GPU_FLAG_RESOURCE_UUID_ENABLED,
>>       VIRTIO_GPU_FLAG_DRM_ENABLED,
>> +    VIRTIO_GPU_FLAG_ROCM_ENABLED,
>>   };
>>   #define virtio_gpu_virgl_enabled(_cfg) \
>> @@ -136,6 +137,8 @@ enum virtio_gpu_base_conf_flags {
>>       (_cfg.flags & (1 << VIRTIO_GPU_FLAG_VENUS_ENABLED))
>>   #define virtio_gpu_drm_enabled(_cfg) \
>>       (_cfg.flags & (1 << VIRTIO_GPU_FLAG_DRM_ENABLED))
>> +#define virtio_gpu_rocm_enabled(_cfg) \
>> +    (_cfg.flags & (1 << VIRTIO_GPU_FLAG_ROCM_ENABLED))
>>   struct virtio_gpu_base_conf {
>>       uint32_t max_outputs;
> 
> Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>

Really thanks for the review, will send the next version soon.

Regards,
Honglei


> 



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [RFC PATCH v7 1/5] virtio-gpu: Update Linux headers to add ROCm capability set
  2026-11-27 14:44   ` Alex Bennée
@ 2026-11-30 10:00     ` Huang, Honglei
  0 siblings, 0 replies; 15+ messages in thread
From: Huang, Honglei @ 2026-11-30 10:00 UTC (permalink / raw)
  To: Alex Bennée
  Cc: dmitry.osipenko, odaki, Ray.Huang, mst, cohuck, pbonzini,
	qemu-devel



On 11/27/2026 10:44 PM, Alex Bennée wrote:
> Honglei Huang <honghuan@amd.com> writes:
> 
>> Add VIRTIO_GPU_CAPSET_ROCM to the imported virtio_gpu.h so the device
>> can advertise the ROCm capability set to the guest.
>>
>> Signed-off-by: Honglei Huang <honghuan@amd.com>
>> ---
>>   include/standard-headers/linux/virtio_gpu.h | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/include/standard-headers/linux/virtio_gpu.h b/include/standard-headers/linux/virtio_gpu.h
>> index c67f50f56cd..976bd225875 100644
>> --- a/include/standard-headers/linux/virtio_gpu.h
>> +++ b/include/standard-headers/linux/virtio_gpu.h
>> @@ -321,6 +321,7 @@ struct virtio_gpu_cmd_submit {
>>   #define VIRTIO_GPU_CAPSET_VENUS 4
>>   #define VIRTIO_GPU_CAPSET_CROSS_DOMAIN 5
>>   #define VIRTIO_GPU_CAPSET_DRM 6
>> +#define VIRTIO_GPU_CAPSET_ROCM 10
> 
> Generally while patches are in flight you would include a reference to
> the kernel patches so we can track when they get merged into the kernel:
> 
>    linux-headers: Update to v7.3-rc1-amd-baz (!UPSTREAM)
> 
>    You can find the current proposed  kernel series at http://foo.bar/repo/branch.
> 
>    sob
> 
> And ideally use the update-headers script to import them to make sure
> they are properly sanitised.

Got it, will change the commit tittle, add kernel commit id, link, and 
use update-headers script to import them.

Regards,
Honglei

> 
>>   
>>   /* VIRTIO_GPU_CMD_GET_CAPSET_INFO */
>>   struct virtio_gpu_get_capset_info {
> 



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [RFC PATCH v7 3/5] virtio-gpu: remove the artificial IOV mapping limit
  2026-11-30  9:50     ` Huang, Honglei
@ 2026-11-30 10:35       ` Huang, Honglei
  0 siblings, 0 replies; 15+ messages in thread
From: Huang, Honglei @ 2026-11-30 10:35 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: mst, cohuck, pbonzini, qemu-devel, alex.bennee, odaki, Ray.Huang



On 11/30/2026 5:50 PM, Huang, Honglei wrote:
> 
> 
> On 11/27/2026 10:15 PM, Dmitry Osipenko wrote:
>> On 11/6/26 11:27, Honglei Huang wrote:
>>> Userptr-backed blobs can require a very large number of
>>> virtio_gpu_mem_entry elements when their pages are not contiguous. The
>>> guest virtio-gpu frontend forwards that entry count and does not impose
>>> the 16384-entry cap previously enforced by
>>> virtio_gpu_create_mapping_iov().
>>>
>>> Drop that QEMU-only limit so these larger userptr iovecs can be mapped.
>>> Keep the existing allocation, copy-size, and DMA mapping checks.
>>>
>>> Signed-off-by: Honglei Huang <honghuan@amd.com>
>>> ---
>>>   hw/display/virtio-gpu.c | 7 -------
>>>   1 file changed, 7 deletions(-)
>>>
>>> diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
>>> index 5d43ffb9918..3df7e3507f4 100644
>>> --- a/hw/display/virtio-gpu.c
>>> +++ b/hw/display/virtio-gpu.c
>>> @@ -990,13 +990,6 @@ int virtio_gpu_create_mapping_iov(VirtIOGPU *g,
>>>       size_t esize, s;
>>>       int e, v;
>>> -    if (nr_entries > 16384) {
>>> -        qemu_log_mask(LOG_GUEST_ERROR,
>>> -                      "%s: nr_entries is too big (%d > 16384)\n",
>>> -                      __func__, nr_entries);
>>> -        return -1;
>>> -    }
>>> -
>>>       esize = sizeof(*ents) * nr_entries;
>>>       ents = g_try_malloc(esize);
>>>       if (!ents && esize) {
>>
>> The nr_entries needs to be validates, that it won't result in int 
>> overflows on 32bit arches.
> 
> Got it will keep the nr_entries check, so this patch will be removed.
> 

Can I change the limitation to INT_MAX? or INT_32?

Cause the virtio-gpu kernel doesn't have the 16384 limitation check,

to prevent the overflow we can use the INT_MAX or INT_32,

and the userptr BO maybe bigger than 16384 but smaller than INT_32

Regards,
Honglei


> Regards,
> Honglei
> 
>>
> 



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-11-30 10:36 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-06  8:27 [RFC PATCH v7 0/5] virtio-gpu: Add userptr support and ROCm capability Honglei Huang
2026-11-06  8:27 ` [RFC PATCH v7 1/5] virtio-gpu: Update Linux headers to add ROCm capability set Honglei Huang
2026-11-27 14:44   ` Alex Bennée
2026-11-30 10:00     ` Huang, Honglei
2026-11-06  8:27 ` [RFC PATCH v7 2/5] virtio-gpu: Add ROCm capability support Honglei Huang
2026-11-27 14:18   ` Dmitry Osipenko
2026-11-30  9:51     ` Huang, Honglei
2026-11-06  8:27 ` [RFC PATCH v7 3/5] virtio-gpu: remove the artificial IOV mapping limit Honglei Huang
2026-11-27 14:15   ` Dmitry Osipenko
2026-11-30  9:50     ` Huang, Honglei
2026-11-30 10:35       ` Huang, Honglei
2026-11-06  8:27 ` [RFC PATCH v7 4/5] virtio-gpu: add readonly blob definitions to Linux headers Honglei Huang
2026-11-06  8:27 ` [RFC PATCH v7 5/5] virtio-gpu: advertise readonly blobs for ROCm Honglei Huang
2026-11-27 14:07   ` Dmitry Osipenko
2026-11-30  9:49     ` Huang, Honglei

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.