BACKPORT: drm/virtio: implement context init: support init ioctl

This implements the context initialization ioctl.  A list of params
is passed in by userspace, and kernel driver validates them.  The
only currently supported param is VIRTGPU_CONTEXT_PARAM_CAPSET_ID.

If the context has already been initialized, -EEXIST is returned.
This happens after Linux userspace does dumb_create + followed by
opening the Mesa virgl driver with the same virtgpu instance.

However, for most applications, 3D contexts will be explicitly
initialized when the feature is available.

Signed-off-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
Acked-by: Lingfeng Yang <lfy@google.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20210921232024.817-6-gurchetansingh@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Bug: 278150168
Change-Id: I3dd83a1765fd26f40e86e3b25b597e946a83da9f
(cherry picked from commit 4fb530e5caf7cb666948db65f245b350ce520436)
[kaiyili: Reslved merge conflicts in virtio_gpu/{virtgpu_drv.h,virtgpu_ioctl.c}]
Signed-off-by: Kaiyi Li <kaiyili@google.com>
2 files changed