All of lore.kernel.org
 help / color / mirror / Atom feed
From: Honglei Huang <honghuan@amd.com>
To: <alex.bennee@linaro.org>, <dmitry.osipenko@collabora.com>,
	<odaki@rsg.ci.i.u-tokyo.ac.jp>, <Ray.Huang@amd.com>
Cc: <mst@redhat.com>, <cohuck@redhat.com>, <pbonzini@redhat.com>,
	<qemu-devel@nongnu.org>, <honghuan@amd.com>
Subject: [RFC PATCH v7 5/5] virtio-gpu: advertise readonly blobs for ROCm
Date: Fri, 6 Nov 2026 16:27:11 +0800	[thread overview]
Message-ID: <20261106082711.813336-6-honghuan@amd.com> (raw)
In-Reply-To: <20261106082711.813336-1-honghuan@amd.com>

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



  parent reply	other threads:[~2026-11-06  8:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Honglei Huang [this message]
2026-11-27 14:07   ` [RFC PATCH v7 5/5] virtio-gpu: advertise readonly blobs for ROCm Dmitry Osipenko
2026-11-30  9:49     ` Huang, Honglei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261106082711.813336-6-honghuan@amd.com \
    --to=honghuan@amd.com \
    --cc=Ray.Huang@amd.com \
    --cc=alex.bennee@linaro.org \
    --cc=cohuck@redhat.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=mst@redhat.com \
    --cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.