[PATCH v2 4/7] drm/virtio: implement userptr: probe for the feature

2025-04-05 Thread Honglei Huang
From: Honglei Huang Add probe code path for virtio gpu userptr. Signed-off-by: Honglei Huang --- drivers/gpu/drm/virtio/virtgpu_debugfs.c | 1 + drivers/gpu/drm/virtio/virtgpu_drv.c | 1 + drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_kms.c | 8

[PATCH v2 3/7] drm/virtgpu api: add blob userptr resource

2025-03-23 Thread Honglei Huang
From: Honglei Huang This makes blob userptr resource available to guest userspace. - Flag VIRTGPU_BLOB_FLAG_USE_USERPTR for guest userspace blob create, enable this flag to indicate blob userptr resource create. - Flag VIRTGPU_BLOB_FLAG_USERPTR_RDONLY used for read only userptr, if not set then

[PATCH v2 0/7] *** Add virtio gpu userptr support ***

2025-03-21 Thread Honglei Huang
From: Honglei Huang Hello, This series add virtio gpu userptr support and add libhsakmt capset. The userptr feature is used for let host access guest user space memory, this feature is used for GPU compute use case, to enable ROCm/OpenCL native context. It should be pointed out that we are not

[PATCH v2 7/7] drm/virtio: implement userptr: add interval tree

2025-03-21 Thread Honglei Huang
From: Honglei Huang Add interval tree to manage the userptrs to prevent repeat creation. If the userptr exists, the ioctl will return the existing BO, and it's offset with the create ioctl address. Signed-off-by: Honglei Huang --- drivers/gpu/drm/virtio/virtgpu_drv.h | 16 ++- dr

[PATCH v2 6/7] drm/virtio: advertise base userptr feature to userspace

2025-03-21 Thread Honglei Huang
From: Honglei Huang Introduce the basic userptr feature to userspace. Signed-off-by: Honglei Huang --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio

[PATCH v2 2/7] virtio-gpu api: add blob userptr resource

2025-03-21 Thread Honglei Huang
From: Honglei Huang Add a new resource for blob resource, called userptr, used for let host access guest user space memory, to acquire buffer based userptr feature in virtio GPU. - New flag VIRTIO_GPU_BLOB_FLAG_USE_USERPTR used in blob create to indicate the blob create ioctl is used for create

[PATCH v2 5/7] drm/virtio: implement userptr: add userptr obj

2025-03-21 Thread Honglei Huang
From: Honglei Huang Add implement for virtio gpu userptr. Current solution is pinning all the user space memory. The UMD needs manage all the userptrs. Signed-off-by: Honglei Huang --- drivers/gpu/drm/virtio/Makefile | 3 +- drivers/gpu/drm/virtio/virtgpu_drv.h | 33

[PATCH v2 1/7] virtio-gpu api: add HSAKMT context

2025-03-21 Thread Honglei Huang
From: Honglei Huang Add a new context named HSAKMT for compute use case. - The capset VIRTIO_GPU_CAPSET_HSAKMT used for context init, in this series patches only HSAKMT context can use the userptr feature. HSAKMT is a GPU compute library in HSA stack, like the role libdrm in mesa stack. Signed

[PATCH v1 3/7] drm/virtio: implement userptr: probe for the feature

2025-02-27 Thread Honglei Huang
From: Honglei Huang Add probe code path for virtio gpu userptr. Signed-off-by: Honglei Huang --- drivers/gpu/drm/virtio/virtgpu_debugfs.c | 1 + drivers/gpu/drm/virtio/virtgpu_drv.c | 1 + drivers/gpu/drm/virtio/virtgpu_drv.h | 1 + drivers/gpu/drm/virtio/virtgpu_kms.c | 8

[PATCH v1 6/7] drm/virtio: implement userptr: add interval tree

2025-02-27 Thread Honglei Huang
From: Honglei Huang Add interval tree to manage the userptrs to prevent repeat creation. If the userptr exists, the ioctl will return the existing BO, and it's offset with the create ioctl address. Signed-off-by: Honglei Huang --- drivers/gpu/drm/virtio/virtgpu_drv.h | 16 ++- dr

[PATCH v1 4/7] drm/virtio: implement userptr: add userptr obj

2025-02-27 Thread Honglei Huang
From: Honglei Huang Add implement for virtio gpu userptr. Current solution is pinning all the user space memory. The UMD needs manage all the userptrs. Signed-off-by: Honglei Huang --- drivers/gpu/drm/virtio/Makefile | 3 +- drivers/gpu/drm/virtio/virtgpu_drv.h | 33

[PATCH v1 7/7] drm/virtio: implement userptr: add mmu notifier

2025-02-27 Thread Honglei Huang
From: Honglei Huang Add mmu notifier, there are some benefits: - UMD do not need manage the userptrs, just alloc and free user space memory, with the MMU notifier userpters can be managed by kernel. - Can achieve a performance improvement of 20%~30%. With the MMU notifier UMD like OpenCL can

[PATCH v1 2/7] drm/virtgpu api: add blob userptr resource

2025-02-27 Thread Honglei Huang
From: Honglei Huang This makes blob userptr resource available to guest userspace. - Flag VIRTGPU_BLOB_FLAG_USE_USERPTR for guest userspace blob create, enable this flag to indicate blob userptr resource create. - Flag VIRTGPU_BLOB_FLAG_USERPTR_RDONLY used for read only userptr, if not set then

[PATCH v1 5/7] drm/virtio: advertise base userptr feature to userspace

2025-02-27 Thread Honglei Huang
From: Honglei Huang Introduce the basic userptr feature to userspace. Signed-off-by: Honglei Huang --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio

[PATCH v1 0/7] Add virtio gpu userptr support

2025-02-27 Thread Honglei Huang
From: Honglei Huang Hello, This series add virtio gpu userptr support and add libhsakmt capset. The userptr feature is used for let host access guest user space memory, this feature is used for GPU compute use case, to enable ROCm/OpenCL native context. It should be pointed out that we are not

[PATCH v1 1/7] virtio-gpu api: add blob userptr resource

2025-02-27 Thread Honglei Huang
From: Honglei Huang Add a new resource for blob resource, called userptr, used for let host access guest user space memory, to acquire buffer based userptr feature in virtio GPU. - The capset VIRTIO_GPU_CAPSET_HSAKMT used for context init, in this series patches only HSAKMT context can use the

[RFC PATCH 3/3] drm/virtio: implement blob userptr resource object

2024-12-20 Thread Honglei Huang
From: Honglei Huang A virtio-gpu userptr is based on HMM notifier. Used for let host access guest userspace memory and notice the change of userspace memory. This series patches are in very beginning state, User space are pinned currently to ensure the host device memory operations are correct

[RFC PATCH 2/3] drm/virtgpu api: add blob userptr resource

2024-12-20 Thread Honglei Huang
From: Honglei Huang This makes blob userptr resource available to guest userspace. - Flag VIRTGPU_BLOB_FLAG_USE_USERPTR for guest userspace blob create, enable this flag to indicate blob userptr resource create. - New parameter blob_userptr for bypass userspace memory address to virtio GPU

[RFC PATCH 1/3] virtio-gpu api: add blob userptr resource

2024-12-20 Thread Honglei Huang
From: Honglei Huang Add a new resource for blob resource, called userptr, used for let host access guest user space memory, to acquire a simple SVM features in virtio GPU. - The capset VIRTIO_GPU_CAPSET_HSAKMT used for context init, in this series patches only HSAKMT context can use the userptr

[PATCH] virtio: Add hsakmt capset definition

2024-12-05 Thread Honglei Huang
From: Honglei Huang Add libhsakmt native context capset in the VIRTIO-GPU protocol header. Virglrenderer related patch: https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1450 OpenCL based on libhsakmt native context patch in progress: https://gitlab.freedesktop.org/virgl