* [PATCH] virtio-gpu: fix ioctl and expose the fixed status to userspace.
@ 2018-02-21 1:50 Dave Airlie
2018-02-27 23:28 ` Dave Airlie
0 siblings, 1 reply; 4+ messages in thread
From: Dave Airlie @ 2018-02-21 1:50 UTC (permalink / raw)
To: dri-devel
From: Dave Airlie <airlied@redhat.com>
This exposes to mesa that it can use the fixed ioctl for querying
later cap sets, cap set 1 is forever frozen in time.
Signed-off-by: Dave Airlie <airlied@redhat.com>
---
drivers/gpu/drm/virtio/virtgpu_ioctl.c | 17 +++++++++++------
include/uapi/drm/virtgpu_drm.h | 1 +
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
index 5720a0d4ac0a..677ac16c8a6d 100644
--- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
+++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
@@ -197,6 +197,9 @@ static int virtio_gpu_getparam_ioctl(struct drm_device *dev, void *data,
case VIRTGPU_PARAM_3D_FEATURES:
value = vgdev->has_virgl_3d == true ? 1 : 0;
break;
+ case VIRTGPU_PARAM_CAPSET_QUERY_FIX:
+ value = 1;
+ break;
default:
return -EINVAL;
}
@@ -472,7 +475,7 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
{
struct virtio_gpu_device *vgdev = dev->dev_private;
struct drm_virtgpu_get_caps *args = data;
- int size;
+ unsigned size, host_caps_size;
int i;
int found_valid = -1;
int ret;
@@ -481,6 +484,10 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
if (vgdev->num_capsets == 0)
return -ENOSYS;
+ /* don't allow userspace to pass 0 */
+ if (args->size == 0)
+ return -EINVAL;
+
spin_lock(&vgdev->display_info_lock);
for (i = 0; i < vgdev->num_capsets; i++) {
if (vgdev->capsets[i].id == args->cap_set_id) {
@@ -496,11 +503,9 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
return -EINVAL;
}
- size = vgdev->capsets[found_valid].max_size;
- if (args->size > size) {
- spin_unlock(&vgdev->display_info_lock);
- return -EINVAL;
- }
+ host_caps_size = vgdev->capsets[found_valid].max_size;
+ /* only copy to user the minimum of the host caps size or the guest caps size */
+ size = min(args->size, host_caps_size);
list_for_each_entry(cache_ent, &vgdev->cap_cache, head) {
if (cache_ent->id == args->cap_set_id &&
diff --git a/include/uapi/drm/virtgpu_drm.h b/include/uapi/drm/virtgpu_drm.h
index 91a31ffed828..9a781f0611df 100644
--- a/include/uapi/drm/virtgpu_drm.h
+++ b/include/uapi/drm/virtgpu_drm.h
@@ -63,6 +63,7 @@ struct drm_virtgpu_execbuffer {
};
#define VIRTGPU_PARAM_3D_FEATURES 1 /* do we have 3D features in the hw */
+#define VIRTGPU_PARAM_CAPSET_QUERY_FIX 2 /* do we have the capset fix */
struct drm_virtgpu_getparam {
__u64 param;
--
2.14.3
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] virtio-gpu: fix ioctl and expose the fixed status to userspace.
2018-02-21 1:50 [PATCH] virtio-gpu: fix ioctl and expose the fixed status to userspace Dave Airlie
@ 2018-02-27 23:28 ` Dave Airlie
2018-02-28 6:34 ` Gerd Hoffmann
0 siblings, 1 reply; 4+ messages in thread
From: Dave Airlie @ 2018-02-27 23:28 UTC (permalink / raw)
To: dri-devel, Gerd Hoffmann
Hi Gerd,
Could I get an ack or review for the kernel patch now the qemu patch is in,
I'll merge it into drm-fixes unless you want to drop it in drm-misc-fixes first.
Thanks,
Dave.
On 21 February 2018 at 11:50, Dave Airlie <airlied@gmail.com> wrote:
> From: Dave Airlie <airlied@redhat.com>
>
> This exposes to mesa that it can use the fixed ioctl for querying
> later cap sets, cap set 1 is forever frozen in time.
>
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
> drivers/gpu/drm/virtio/virtgpu_ioctl.c | 17 +++++++++++------
> include/uapi/drm/virtgpu_drm.h | 1 +
> 2 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> index 5720a0d4ac0a..677ac16c8a6d 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c
> @@ -197,6 +197,9 @@ static int virtio_gpu_getparam_ioctl(struct drm_device *dev, void *data,
> case VIRTGPU_PARAM_3D_FEATURES:
> value = vgdev->has_virgl_3d == true ? 1 : 0;
> break;
> + case VIRTGPU_PARAM_CAPSET_QUERY_FIX:
> + value = 1;
> + break;
> default:
> return -EINVAL;
> }
> @@ -472,7 +475,7 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
> {
> struct virtio_gpu_device *vgdev = dev->dev_private;
> struct drm_virtgpu_get_caps *args = data;
> - int size;
> + unsigned size, host_caps_size;
> int i;
> int found_valid = -1;
> int ret;
> @@ -481,6 +484,10 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
> if (vgdev->num_capsets == 0)
> return -ENOSYS;
>
> + /* don't allow userspace to pass 0 */
> + if (args->size == 0)
> + return -EINVAL;
> +
> spin_lock(&vgdev->display_info_lock);
> for (i = 0; i < vgdev->num_capsets; i++) {
> if (vgdev->capsets[i].id == args->cap_set_id) {
> @@ -496,11 +503,9 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device *dev,
> return -EINVAL;
> }
>
> - size = vgdev->capsets[found_valid].max_size;
> - if (args->size > size) {
> - spin_unlock(&vgdev->display_info_lock);
> - return -EINVAL;
> - }
> + host_caps_size = vgdev->capsets[found_valid].max_size;
> + /* only copy to user the minimum of the host caps size or the guest caps size */
> + size = min(args->size, host_caps_size);
>
> list_for_each_entry(cache_ent, &vgdev->cap_cache, head) {
> if (cache_ent->id == args->cap_set_id &&
> diff --git a/include/uapi/drm/virtgpu_drm.h b/include/uapi/drm/virtgpu_drm.h
> index 91a31ffed828..9a781f0611df 100644
> --- a/include/uapi/drm/virtgpu_drm.h
> +++ b/include/uapi/drm/virtgpu_drm.h
> @@ -63,6 +63,7 @@ struct drm_virtgpu_execbuffer {
> };
>
> #define VIRTGPU_PARAM_3D_FEATURES 1 /* do we have 3D features in the hw */
> +#define VIRTGPU_PARAM_CAPSET_QUERY_FIX 2 /* do we have the capset fix */
>
> struct drm_virtgpu_getparam {
> __u64 param;
> --
> 2.14.3
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] virtio-gpu: fix ioctl and expose the fixed status to userspace.
2018-02-27 23:28 ` Dave Airlie
@ 2018-02-28 6:34 ` Gerd Hoffmann
2018-02-28 6:35 ` Dave Airlie
0 siblings, 1 reply; 4+ messages in thread
From: Gerd Hoffmann @ 2018-02-28 6:34 UTC (permalink / raw)
To: Dave Airlie; +Cc: dri-devel
On Wed, Feb 28, 2018 at 09:28:06AM +1000, Dave Airlie wrote:
> Hi Gerd,
>
> Could I get an ack or review for the kernel patch now the qemu patch is in,
>
> I'll merge it into drm-fixes unless you want to drop it in drm-misc-fixes first.
I've dropped it into drm-misc-fixes earlier this week.
cheers,
Gerd
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] virtio-gpu: fix ioctl and expose the fixed status to userspace.
2018-02-28 6:34 ` Gerd Hoffmann
@ 2018-02-28 6:35 ` Dave Airlie
0 siblings, 0 replies; 4+ messages in thread
From: Dave Airlie @ 2018-02-28 6:35 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: dri-devel
On 28 February 2018 at 16:34, Gerd Hoffmann <kraxel@redhat.com> wrote:
> On Wed, Feb 28, 2018 at 09:28:06AM +1000, Dave Airlie wrote:
>> Hi Gerd,
>>
>> Could I get an ack or review for the kernel patch now the qemu patch is in,
>>
>> I'll merge it into drm-fixes unless you want to drop it in drm-misc-fixes first.
>
> I've dropped it into drm-misc-fixes earlier this week.
Doh, should have checked first,
Thanks,
Dave.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-02-28 6:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-21 1:50 [PATCH] virtio-gpu: fix ioctl and expose the fixed status to userspace Dave Airlie
2018-02-27 23:28 ` Dave Airlie
2018-02-28 6:34 ` Gerd Hoffmann
2018-02-28 6:35 ` Dave Airlie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.