From: "Huang, Honglei" <honghuan@amd.com>
To: Dmitry Osipenko <dmitry.osipenko@collabora.com>,
Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>,
David Airlie <airlied@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>
Cc: Gurchetan Singh <gurchetansingh@chromium.org>,
Chia-I Wu <olvaffe@gmail.com>, Ray Huang <Ray.Huang@amd.com>,
dri-devel@lists.freedesktop.org, virtualization@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v10 0/4] drm/virtio: userptr blobs for native-context compute
Date: Wed, 25 Nov 2026 14:41:45 +0800 [thread overview]
Message-ID: <baa471a6-502d-41ac-9ef3-cbac35a103e0@amd.com> (raw)
In-Reply-To: <20261106082625.812860-1-honghuan@amd.com>
On 11/6/2026 4:26 PM, Honglei Huang wrote:
> This series adds virtio-gpu userptr support for ROCm native compute
> contexts. The guest kernel pins an existing userspace mapping with
> FOLL_LONGTERM and exposes it to the host as ordinary CREATE_BLOB
> backing entries, avoiding a second shmem allocation and memcpy.
>
> A non-zero userptr field selects that path. Probe
> VIRTGPU_PARAM_USERPTR before using the field so an older guest kernel
> rejects the request instead of silently creating a shmem blob.
>
> See overall detail in virglrenderer pr [1]
Hi all,
Any review comments on this series? includes code for the kernel, QEMU,
and other components.
Open to any review.
Regards,
Honglei
>
> Patches overview:
> 1. Add VIRTIO_GPU_CAPSET_ROCM capability for compute workloads
> 2. Extend DRM/virtio UAPI with userptr, PARAM_USERPTR,
> USE_READONLY, and F_BLOB_READONLY
> 3. Implement core userptr functionality with page management
> 4. Wire blob ioctl creation to userptr objects and probe the
> readonly feature
>
> V10 changes:
> - Require DMA_ATTR_REQUIRE_COHERENT on create and restore mappings.
> - Use drm_gem_object_put() after UUID assignment or handle creation
> failure.
> - Drop the new_pinned < 0 check.
> - Validate the userptr address against the host's blob_alignment in
> verify_blob().
>
> V9 changes:
> - Marked series RFC pending a virtio-gpu spec update for
> F_BLOB_READONLY / BLOB_FLAG_USE_READONLY (Odaki)
> - Moved VIRTIO_GPU_CAPSET_ROCM/VIRTGPU_DRM_CAPSET_ROCM from ID 8 to
> 10 to avoid the gfxstream/rutabaga_gfx 7-9 collision (Odaki)
> - Added the missing VIRTGPU_DRM_CAPSET_ROCM alias (Odaki, sashiko-bot)
> - Dropped the kernel/guest-internal wire-flag comment from the UAPI
> header and reworded "Guest VA" to "address" in the userptr field
> comment (Odaki)
> - Fixed a BUG() on every virtio-gpu probe: VIRTIO_GPU_F_BLOB_READONLY
> was queried with virtio_has_feature() but never added to the
> driver's features[] array (Odaki)
> - Removed the dead TRANSFER_TO_HOST userptr DMA-sync branches added
> to virtgpu_vq.c; verify_blob() already rejects VIRTGPU_BLOB_MEM_GUEST
> for that ioctl, so the branches were unreachable (Odaki)
> - Documented the DMA mapping and bounce buffer behavior of
> virtio_gpu_userptr_restore() and dropped the zero-copy claim from
> the commit title and message (Odaki)
>
> V8 changes:
> - Drop guest-only USERPTR ioctl flags; a non-zero userptr field
> selects the path
> - Add VIRTGPU_PARAM_USERPTR so older kernels do not silently
> ignore the new field
> - Request GPU-readonly backing with virtio wire flag USE_READONLY
> - Accept USE_READONLY and omit FOLL_WRITE only if the host
> advertised VIRTIO_GPU_F_BLOB_READONLY
> - Restore userptr blobs after hibernation without the shmem path
>
> V7 changes:
> - Mask guest-only DRM flags out of CREATE_BLOB wire blob_flags
> - Clear userptr->pages after pin failure to avoid double-free
> - DMA-map userptr SG only when virtio_gpu_use_dma_api() is required
> - Use DMA_TO_DEVICE for readonly blobs
> - Sync userptr SG for the device on TRANSFER_TO_HOST
> - Mark writable pages dirty when unpinning
> - Reject USERPTR unless blob_mem is VIRTGPU_BLOB_MEM_GUEST
> - Disallow PRIME export of userptr objects
> - Note that CAPSET_ROCM uses ID 8 because ID 7 is taken by VIRCL
>
> V6 changes:
> - Rebase onto drm-misc-next
> - Keep USE_USERPTR / USERPTR_RDONLY as guest-only DRM flags; drop the
> virtio wire-header patch (5 patches down to 4)
> - Fix userptr lifetime, DMA mapping, memlock accounting, alignment
> checks, and PRIME SG export
> - Updated corresponding cover letter and commit messages
>
> V5 changes:
> - Add VIRTIO_GPU_BLOB_FLAG_USERPTR_RDONLY definition to patch 2
> - Dropped unused VIRTIO_GPU_F_RESOURCE_USERPTR feature bit in patch 2
> - Included VIRTIO_GPU_BLOB_FLAG_USERPTR_RDONLY in
> VIRTGPU_BLOB_FLAG_USE_MASK in patch 5
> - Add check for userptr feature in patch 5 before creating userptr blob resource
> - Updated corresponding cover letter and commit messages
>
> V4 changes:
> - Renamed VIRTIO_GPU_CAPSET_HSAKMT to VIRTIO_GPU_CAPSET_ROCM
> - Remove userptr feature probing cause it can reuse the guest
> blob resource code path, reduce patch count from 6 to 5
> - Updated corresponding commit messages
> - Consolidated userptr feature detection in final patch
> - Update corresponding cover letter content
>
> V3 changes:
> - Split into focused patches for easier review
> - Removed complex interval tree userptr management
> - Simplified resource creation without deduplication
> - Added VIRTGPU_PARAM_RESOURCE_USERPTR for feature detection
> - Improved UAPI documentation and error handling
> - Removed MMU notifier dependencies for simplicity
> - Fixed resource lifecycle management issues
>
> V2: - Split add HSAKMT context and blob userptr resource to two patches.
> - Remove MMU notifier related patches, cause use not moveable user space
> memory with MMU notifier is not a good idea.
> - Remove HSAKMT context check when create context, let all the context
> support the userptr feature.
> - Remove MMU notifier related content in cover letter.
> - Add more comments for patch 6 in cover letter.
>
> [1]: https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1708
>
> Honglei Huang (4):
> drm/virtio: add VIRTIO_GPU_CAPSET_ROCM capability
> drm/virtio: add userptr blob resource to the UAPI
> drm/virtio: implement userptr resource support
> drm/virtio: wire blob ioctl creation to userptr objects
>
> drivers/gpu/drm/virtio/Makefile | 3 +-
> drivers/gpu/drm/virtio/virtgpu_debugfs.c | 1 +
> drivers/gpu/drm/virtio/virtgpu_drv.c | 1 +
> drivers/gpu/drm/virtio/virtgpu_drv.h | 42 +++
> drivers/gpu/drm/virtio/virtgpu_ioctl.c | 49 +++-
> drivers/gpu/drm/virtio/virtgpu_kms.c | 8 +-
> drivers/gpu/drm/virtio/virtgpu_object.c | 22 ++
> drivers/gpu/drm/virtio/virtgpu_userptr.c | 350 +++++++++++++++++++++++
> include/uapi/drm/virtgpu_drm.h | 11 +
> include/uapi/linux/virtio_gpu.h | 6 +
> 10 files changed, 480 insertions(+), 13 deletions(-)
> create mode 100644 drivers/gpu/drm/virtio/virtgpu_userptr.c
>
>
> base-commit: 1ecab8b0bad393750c60cc3819ce9c256595463c
prev parent reply other threads:[~2026-11-25 6:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 8:26 Honglei Huang
2026-11-06 8:26 ` [RFC PATCH v10 1/4] drm/virtio: add VIRTIO_GPU_CAPSET_ROCM capability Honglei Huang
2026-11-06 8:26 ` [RFC PATCH v10 2/4] drm/virtio: add userptr blob resource to the UAPI Honglei Huang
2026-11-06 8:26 ` [RFC PATCH v10 3/4] drm/virtio: implement userptr resource support Honglei Huang
2026-11-06 8:26 ` [RFC PATCH v10 4/4] drm/virtio: wire blob ioctl creation to userptr objects Honglei Huang
2026-11-25 6:41 ` Huang, Honglei [this message]
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=baa471a6-502d-41ac-9ef3-cbac35a103e0@amd.com \
--to=honghuan@amd.com \
--cc=Ray.Huang@amd.com \
--cc=airlied@redhat.com \
--cc=dmitry.osipenko@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gurchetansingh@chromium.org \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
--cc=olvaffe@gmail.com \
--cc=virtualization@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®