All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Huang, Honglei" <honghuan@amd.com>
To: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Cc: mst@redhat.com, cohuck@redhat.com, pbonzini@redhat.com,
	qemu-devel@nongnu.org, alex.bennee@linaro.org,
	odaki@rsg.ci.i.u-tokyo.ac.jp, Ray.Huang@amd.com
Subject: Re: [RFC PATCH v7 2/5] virtio-gpu: Add ROCm capability support
Date: Mon, 30 Nov 2026 17:51:31 +0800	[thread overview]
Message-ID: <fd7e6d98-668e-451c-acff-cb7fee84e37e@amd.com> (raw)
In-Reply-To: <ae203d4a-691f-4cdf-bbe0-da1b2a28f823@collabora.com>



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


> 



  reply	other threads:[~2026-11-30  9:52 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 [this message]
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

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=fd7e6d98-668e-451c-acff-cb7fee84e37e@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.