]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/virtio: add VIRTGPU_PARAM_BLOB_ALIGNMENT to params
authorSergio Lopez <slp@redhat.com>
Tue, 28 Apr 2026 19:44:50 +0000 (21:44 +0200)
committerDmitry Osipenko <dmitry.osipenko@collabora.com>
Wed, 20 May 2026 14:59:21 +0000 (17:59 +0300)
Add VIRTGPU_PARAM_BLOB_ALIGNMENT as a param that can be read with
VIRTGPU_GETPARAM by userspace applications running in the guest to
obtain the host's page size and find out the right alignment to be used
in shared memory allocations.

Signed-off-by: Sergio Lopez <slp@redhat.com>
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Link: https://patch.msgid.link/20260428194450.518296-4-slp@redhat.com
drivers/gpu/drm/virtio/virtgpu_ioctl.c
include/uapi/drm/virtgpu_drm.h

index 85e2fafe4152be7fce64a2f309c7276895ce3121..3d8e4ccdb7c1f8914bf50a53c12adf337af39602 100644 (file)
@@ -117,6 +117,11 @@ static int virtio_gpu_getparam_ioctl(struct drm_device *dev, void *data,
        case VIRTGPU_PARAM_EXPLICIT_DEBUG_NAME:
                value = vgdev->has_context_init ? 1 : 0;
                break;
+       case VIRTGPU_PARAM_BLOB_ALIGNMENT:
+               if (!vgdev->has_blob_alignment)
+                       return -ENOENT;
+               value = vgdev->blob_alignment;
+               break;
        default:
                return -EINVAL;
        }
index ba09a4ee3e77a713b5df74a0ab0c763cfc022dfc..95587e12aed575cd2ac3527467a2a0d3e67c5ab8 100644 (file)
@@ -98,6 +98,7 @@ struct drm_virtgpu_execbuffer {
 #define VIRTGPU_PARAM_CONTEXT_INIT 6 /* DRM_VIRTGPU_CONTEXT_INIT */
 #define VIRTGPU_PARAM_SUPPORTED_CAPSET_IDs 7 /* Bitmask of supported capability set ids */
 #define VIRTGPU_PARAM_EXPLICIT_DEBUG_NAME 8 /* Ability to set debug name from userspace */
+#define VIRTGPU_PARAM_BLOB_ALIGNMENT 9 /* Device alignment requirements for blobs */
 
 struct drm_virtgpu_getparam {
        __u64 param;