Dmitry Osipenko <[email protected]> writes:
> Make virgl_cmd_resource_map_blob() return -1 for errors originated from
> external virglrenderer library and respond to guest with most appropriate
> error message.
>
> Suggested-by: Akihiko Odaki <[email protected]> # guest err msg
> Signed-off-by: Dmitry Osipenko <[email protected]>
> ---
> hw/display/virtio-gpu-virgl.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/hw/display/virtio-gpu-virgl.c b/hw/display/virtio-gpu-virgl.c
> index 2224f59cf5d7..edcdad0af232 100644
> --- a/hw/display/virtio-gpu-virgl.c
> +++ b/hw/display/virtio-gpu-virgl.c
> @@ -138,7 +138,7 @@ virtio_gpu_virgl_map_resource_blob(VirtIOGPU *g,
> if (ret) {
> qemu_log_mask(LOG_GUEST_ERROR, "%s: failed to map virgl resource:
> %s\n",
> __func__, strerror(-ret));
> - return ret;
> + return -1;
If we are using errno's lets use the defines rather than -1, should this
be -EPERM?
> }
>
> vmr = g_new0(struct virtio_gpu_virgl_hostmem_region, 1);
> @@ -789,7 +789,16 @@ static void virgl_cmd_resource_map_blob(VirtIOGPU *g,
> }
>
> ret = virtio_gpu_virgl_map_resource_blob(g, res, mblob.offset);
> - if (ret) {
> +
> + switch (ret) {
> + case 0:
> + break;
> +
> + case -EINVAL:
> + cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_PARAMETER;
> + return;
which isn't what can come here. I see EOPNOTSUPP not being handled either.
> +
> + default:
> cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
> return;
> }
--
Alex Bennée
Virtualisation Tech Lead @ Linaro