[libvirt] [PATCH 0/2] qemu: reject invalid video accel* settings

This series adds a couple checks for invalid video accel* settings, incase users screw up their XML when trying to enable spice GL Cole Robinson (2): qemu: command: Error if accel3d isn't supported for non-virtio qemu: command: Explicitly error if accel2d specified src/qemu/qemu_command.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) -- 2.7.4

We should be raising an error if accel3d is present for any non-virtio video as well, incase someone hand edits incorrect XML --- src/qemu/qemu_command.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 4a2fa1d..731f4c0 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4125,18 +4125,20 @@ qemuBuildDeviceVideoStr(const virDomainDef *def, virBufferAsprintf(&buf, "%s,id=%s", model, video->info.alias); - if (video->type == VIR_DOMAIN_VIDEO_TYPE_VIRTIO) { - if (video->accel && video->accel->accel3d == VIR_TRISTATE_SWITCH_ON) { - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU_VIRGL)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("virtio-gpu 3d acceleration is not supported")); - goto error; - } - - virBufferAsprintf(&buf, ",virgl=%s", - virTristateSwitchTypeToString(video->accel->accel3d)); + if (video->accel && video->accel->accel3d == VIR_TRISTATE_SWITCH_ON) { + if (video->type != VIR_DOMAIN_VIDEO_TYPE_VIRTIO || + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU_VIRGL)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("%s 3d acceleration is not supported"), + virDomainVideoTypeToString(video->type)); + goto error; } - } else if (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL) { + + virBufferAsprintf(&buf, ",virgl=%s", + virTristateSwitchTypeToString(video->accel->accel3d)); + } + + if (video->type == VIR_DOMAIN_VIDEO_TYPE_QXL) { if (video->vram > (UINT_MAX / 1024)) { virReportError(VIR_ERR_OVERFLOW, _("value for 'vram' must be less than '%u'"), -- 2.7.4

qemu doesn't have any accel2d support wired up. Explicitly error if a user tries it out, or typos the accel3d option --- src/qemu/qemu_command.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 731f4c0..cca59a6 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4125,6 +4125,12 @@ qemuBuildDeviceVideoStr(const virDomainDef *def, virBufferAsprintf(&buf, "%s,id=%s", model, video->info.alias); + if (video->accel && video->accel->accel2d == VIR_TRISTATE_SWITCH_ON) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("qemu does not support the accel2d setting")); + goto error; + } + if (video->accel && video->accel->accel3d == VIR_TRISTATE_SWITCH_ON) { if (video->type != VIR_DOMAIN_VIDEO_TYPE_VIRTIO || !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU_VIRGL)) { -- 2.7.4

On Do, 2016-05-19 at 20:07 -0400, Cole Robinson wrote:
qemu doesn't have any accel2d support wired up. Explicitly error if a user tries it out, or typos the accel3d option
Well, cirrus has 2d accel. You can't turn it on or off though, so setting 2d accel=yes for cirrus would just be cosmetical. Probably confusing too as 2d accel is pretty much unused these days. I think Windows NT4 age software can and will use cirrus 2d blit ops. cheers, Gerd

On 05/20/2016 03:22 AM, Gerd Hoffmann wrote:
On Do, 2016-05-19 at 20:07 -0400, Cole Robinson wrote:
qemu doesn't have any accel2d support wired up. Explicitly error if a user tries it out, or typos the accel3d option
Well, cirrus has 2d accel. You can't turn it on or off though, so setting 2d accel=yes for cirrus would just be cosmetical. Probably confusing too as 2d accel is pretty much unused these days. I think Windows NT4 age software can and will use cirrus 2d blit ops.
Interesting. Though WRT libvirt accel2d has only ever been an option supported by the virtualbox drivers AFAIK. At least with this patch libvirt makes it explicit that the accel2d setting isn't impacting config whatsoever Thanks, Cole
participants (2)
-
Cole Robinson
-
Gerd Hoffmann