Add DRM ioctl hints and a userptr address field so userspace can request a blob backed by an existing process mapping.
UAPI changes: - Add guest-only DRM_VIRTGPU_BLOB_FLAG_HINT_USERPTR and DRM_VIRTGPU_BLOB_FLAG_HINT_USERPTR_RDONLY to blob_hints - Add a userptr field to drm_virtgpu_resource_create_blob These hints select guest pin behavior in the ioctl. They are not part of the virtio CREATE_BLOB wire ABI. Signed-off-by: Honglei Huang <[email protected]> --- include/uapi/drm/virtgpu_drm.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/uapi/drm/virtgpu_drm.h b/include/uapi/drm/virtgpu_drm.h index 95587e12ae..aa8abef8f9 100644 --- a/include/uapi/drm/virtgpu_drm.h +++ b/include/uapi/drm/virtgpu_drm.h @@ -203,8 +203,17 @@ struct drm_virtgpu_resource_create_blob { __u64 blob_id; #define DRM_VIRTGPU_BLOB_FLAG_HINT_DEFER_MAPPING 0x0001 +/* Guest-only: pin an existing process mapping as blob backing. */ +#define DRM_VIRTGPU_BLOB_FLAG_HINT_USERPTR 0x0002 +#define DRM_VIRTGPU_BLOB_FLAG_HINT_USERPTR_RDONLY 0x0004 __u32 blob_hints; __u32 pad2; + + /* + * userptr: guest userspace memory address for + * DRM_VIRTGPU_BLOB_FLAG_HINT_USERPTR. Must be 0 if that hint is not set. + */ + __u64 userptr; }; #define VIRTGPU_CONTEXT_PARAM_CAPSET_ID 0x0001 -- 2.34.1
