[libvirt] [PATCH v2 0/4] implement vram64 attribute for QXL video device

New in v2: - added patch to always set primary video device as primary - introduced new qemu monitor functions to update vram64 values after QEMU is started only if QEMU supports this parameter Pavel Hrdina (4): domain_conf: always set primary video device as primary docs/formatdomain: rewrite video documentation qemu_capabilities: introduce QEMU_CAPS_QXL(_VGA)_VRAM64 qemu: introduce vram64 attribute for QXL video device docs/formatdomain.html.in | 18 ++++---- docs/schemas/domaincommon.rng | 5 ++ src/conf/domain_conf.c | 40 +++++++++++++--- src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 4 ++ src/qemu/qemu_capabilities.h | 2 + src/qemu/qemu_command.c | 32 ++++++++++--- src/qemu/qemu_monitor.c | 35 ++++++++++++++ src/qemu/qemu_monitor.h | 4 ++ src/qemu/qemu_monitor_json.c | 54 ++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 3 ++ src/qemu/qemu_process.c | 24 ++++++---- tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 2 + tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 2 + tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 2 + tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 2 + tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 2 + tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 2 + tests/qemucapabilitiesdata/caps_2.1.1-1.caps | 2 + tests/qemucapabilitiesdata/caps_2.4.0-1.caps | 2 + tests/qemucapabilitiesdata/caps_2.5.0-1.caps | 2 + tests/qemucapabilitiesdata/caps_2.6.0-1.caps | 2 + ...qemuhotplug-console-compat-2+console-virtio.xml | 2 +- .../qemuxml2argv-console-compat-2.xml | 2 +- .../qemuxml2argv-video-qxl-device-vram64.args | 25 ++++++++++ .../qemuxml2argv-video-qxl-device-vram64.xml | 29 ++++++++++++ .../qemuxml2argv-video-qxl-sec-device-vram64.args | 27 +++++++++++ .../qemuxml2argv-video-qxl-sec-device-vram64.xml | 32 +++++++++++++ .../qemuxml2xmlout-graphics-listen-network.xml | 2 +- .../qemuxml2xmlout-graphics-listen-network2.xml | 2 +- .../qemuxml2xmlout-graphics-sdl-fullscreen.xml | 2 +- .../qemuxml2xmlout-graphics-sdl.xml | 2 +- .../qemuxml2xmlout-graphics-spice-compression.xml | 2 +- .../qemuxml2xmlout-graphics-spice-qxl-vga.xml | 2 +- .../qemuxml2xmlout-graphics-spice-timeout.xml | 2 +- .../qemuxml2xmlout-graphics-spice.xml | 2 +- .../qemuxml2xmlout-graphics-vnc-sasl.xml | 2 +- .../qemuxml2xmlout-graphics-vnc-tls.xml | 2 +- .../qemuxml2xmlout-graphics-vnc-websocket.xml | 2 +- .../qemuxml2xmlout-graphics-vnc.xml | 2 +- .../qemuxml2xmlout-interface-server.xml | 2 +- .../qemuxml2xmlout-net-bandwidth.xml | 2 +- .../qemuxml2xmlout-net-bandwidth2.xml | 2 +- .../qemuxml2xmlout-pci-autoadd-addr.xml | 2 +- .../qemuxml2xmlout-pci-autoadd-idx.xml | 2 +- .../qemuxml2xmlout-pci-bridge.xml | 2 +- .../qemuxml2xmlout-pcie-root-port.xml | 2 +- .../qemuxml2xmlout-pcie-switch-downstream-port.xml | 2 +- .../qemuxml2xmlout-pcie-switch-upstream-port.xml | 2 +- .../qemuxml2xmlout-pcihole64-q35.xml | 2 +- .../qemuxml2xmlout-q35-usb2-multi.xml | 2 +- .../qemuxml2xmlout-q35-usb2-reorder.xml | 2 +- .../qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml | 2 +- ...emuxml2xmlout-seclabel-dynamic-none-relabel.xml | 2 +- .../qemuxml2xmlout-serial-spiceport.xml | 2 +- .../qemuxml2xmlout-video-virtio-gpu-device.xml | 2 +- .../qemuxml2xmlout-video-virtio-gpu-virgl.xml | 2 +- 58 files changed, 357 insertions(+), 62 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vram64.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vram64.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vram64.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vram64.xml -- 2.7.1

We always place primary video device at first place, to make it easier to create a qemu command or format an xml, but we should also set the primary boolean for primary video device to 'true'. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/conf/domain_conf.c | 6 +++++- src/qemu/qemu_command.c | 17 ++++++++++------- .../qemuhotplug-console-compat-2+console-virtio.xml | 2 +- .../qemuxml2argvdata/qemuxml2argv-console-compat-2.xml | 2 +- .../qemuxml2xmlout-graphics-listen-network.xml | 2 +- .../qemuxml2xmlout-graphics-listen-network2.xml | 2 +- .../qemuxml2xmlout-graphics-sdl-fullscreen.xml | 2 +- .../qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl.xml | 2 +- .../qemuxml2xmlout-graphics-spice-compression.xml | 2 +- .../qemuxml2xmlout-graphics-spice-qxl-vga.xml | 2 +- .../qemuxml2xmlout-graphics-spice-timeout.xml | 2 +- .../qemuxml2xmlout-graphics-spice.xml | 2 +- .../qemuxml2xmlout-graphics-vnc-sasl.xml | 2 +- .../qemuxml2xmlout-graphics-vnc-tls.xml | 2 +- .../qemuxml2xmlout-graphics-vnc-websocket.xml | 2 +- .../qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc.xml | 2 +- .../qemuxml2xmlout-interface-server.xml | 2 +- .../qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml | 2 +- .../qemuxml2xmlout-net-bandwidth2.xml | 2 +- .../qemuxml2xmlout-pci-autoadd-addr.xml | 2 +- .../qemuxml2xmlout-pci-autoadd-idx.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge.xml | 2 +- .../qemuxml2xmlout-pcie-root-port.xml | 2 +- .../qemuxml2xmlout-pcie-switch-downstream-port.xml | 2 +- .../qemuxml2xmlout-pcie-switch-upstream-port.xml | 2 +- .../qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-q35.xml | 2 +- .../qemuxml2xmlout-q35-usb2-multi.xml | 2 +- .../qemuxml2xmlout-q35-usb2-reorder.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2.xml | 2 +- tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml | 2 +- .../qemuxml2xmlout-seclabel-dynamic-none-relabel.xml | 2 +- .../qemuxml2xmlout-serial-spiceport.xml | 2 +- .../qemuxml2xmlout-video-virtio-gpu-device.xml | 2 +- .../qemuxml2xmlout-video-virtio-gpu-virgl.xml | 2 +- 34 files changed, 47 insertions(+), 40 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3b15cb4..5e9c096 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11918,7 +11918,7 @@ virDomainVideoDefParseXML(xmlNodePtr node, if ((primary = virXMLPropString(cur, "primary")) != NULL) { if (STREQ(primary, "yes")) - def->primary = 1; + def->primary = true; VIR_FREE(primary); } @@ -16060,6 +16060,10 @@ virDomainDefParseXML(xmlDocPtr xml, goto error; } } + /* if not specified by user mark the first video as primary */ + if (n && !primaryVideo) + def->videos[0]->primary = true; + VIR_FREE(nodes); /* For backwards compatibility, if no <video> tag is set but there diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 854e51c..20ebb64 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3280,13 +3280,12 @@ qemuBuildSoundCodecStr(virDomainSoundDefPtr sound, static char * qemuBuildDeviceVideoStr(virDomainDefPtr def, virDomainVideoDefPtr video, - virQEMUCapsPtr qemuCaps, - bool primary) + virQEMUCapsPtr qemuCaps) { virBuffer buf = VIR_BUFFER_INITIALIZER; const char *model; - if (primary) { + if (video->primary) { model = qemuDeviceVideoTypeToString(video->type); if (!model || STREQ(model, "")) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -3347,8 +3346,10 @@ qemuBuildDeviceVideoStr(virDomainDefPtr def, virBufferAsprintf(&buf, ",vram_size=%u", video->vram * 1024); } - if ((primary && virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGA_VGAMEM)) || - (!primary && virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGAMEM))) { + if ((video->primary && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGA_VGAMEM)) || + (!video->primary && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGAMEM))) { /* QEMU accepts mebibytes for vgamem_mb. */ virBufferAsprintf(&buf, ",vgamem_mb=%u", video->vgamem / 1024); } @@ -8209,7 +8210,8 @@ qemuBuildCommandLine(virConnectPtr conn, for (i = 0; i < def->nvideos; i++) { char *str; virCommandAddArg(cmd, "-device"); - if (!(str = qemuBuildDeviceVideoStr(def, def->videos[i], qemuCaps, !i))) + if (!(str = qemuBuildDeviceVideoStr(def, def->videos[i], + qemuCaps))) goto error; virCommandAddArg(cmd, str); @@ -8321,7 +8323,8 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArg(cmd, "-device"); - if (!(str = qemuBuildDeviceVideoStr(def, def->videos[i], qemuCaps, false))) + if (!(str = qemuBuildDeviceVideoStr(def, def->videos[i], + qemuCaps))) goto error; virCommandAddArg(cmd, str); diff --git a/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml b/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml index d848677..a2796ec 100644 --- a/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml +++ b/tests/qemuhotplugtestdata/qemuhotplug-console-compat-2+console-virtio.xml @@ -91,7 +91,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </sound> <video> - <model type='cirrus' vram='16384' heads='1'/> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml index a7209b2..2ae104e 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml +++ b/tests/qemuxml2argvdata/qemuxml2argv-console-compat-2.xml @@ -88,7 +88,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </sound> <video> - <model type='cirrus' vram='16384' heads='1'/> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network.xml index 599eda9..79f990c 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network.xml @@ -32,7 +32,7 @@ <listen type='network' network='Bobsnetwork'/> </graphics> <video> - <model type='cirrus' vram='16384' heads='1'/> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml index 8687a6b..a0831aa 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-listen-network2.xml @@ -33,7 +33,7 @@ <listen type='network' network='Bobsnetwork'/> </graphics> <video> - <model type='cirrus' vram='16384' heads='1'/> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl-fullscreen.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl-fullscreen.xml index cbf7a78..91bf3af 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl-fullscreen.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl-fullscreen.xml @@ -31,7 +31,7 @@ <input type='keyboard' bus='ps2'/> <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority' fullscreen='yes'/> <video> - <model type='cirrus' vram='16384' heads='1'/> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='none'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl.xml index 536a0f7..3b31e59 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-sdl.xml @@ -31,7 +31,7 @@ <input type='keyboard' bus='ps2'/> <graphics type='sdl' display=':0.1' xauth='/root/.Xauthority'/> <video> - <model type='vga' vram='16384' heads='1'/> + <model type='vga' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='none'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-compression.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-compression.xml index e0419e1..dea1347 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-compression.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-compression.xml @@ -37,7 +37,7 @@ <streaming mode='filter'/> </graphics> <video> - <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/> + <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <video> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-qxl-vga.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-qxl-vga.xml index 82a359d..a17fab2 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-qxl-vga.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-qxl-vga.xml @@ -34,7 +34,7 @@ <channel name='inputs' mode='insecure'/> </graphics> <video> - <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/> + <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <video> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml index 8a0711e..33b5465 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice-timeout.xml @@ -82,7 +82,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </sound> <video> - <model type='vga' vram='16384' heads='1'/> + <model type='vga' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice.xml index 38d3507..59ed507 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-spice.xml @@ -41,7 +41,7 @@ <filetransfer enable='no'/> </graphics> <video> - <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/> + <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <video> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-sasl.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-sasl.xml index 7146529..f29abe2 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-sasl.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-sasl.xml @@ -33,7 +33,7 @@ <listen type='address' address='127.0.0.1'/> </graphics> <video> - <model type='cirrus' vram='16384' heads='1'/> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='none'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-tls.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-tls.xml index 7146529..f29abe2 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-tls.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-tls.xml @@ -33,7 +33,7 @@ <listen type='address' address='127.0.0.1'/> </graphics> <video> - <model type='cirrus' vram='16384' heads='1'/> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='none'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-websocket.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-websocket.xml index 3f23c79..6e879eb 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-websocket.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc-websocket.xml @@ -24,7 +24,7 @@ <listen type='address' address='127.0.0.1'/> </graphics> <video> - <model type='cirrus' vram='16384' heads='1'/> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='none'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc.xml index 73d3b1b..0627bbd 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-graphics-vnc.xml @@ -33,7 +33,7 @@ <listen type='address' address='2001:1:2:3:4:5:1234:1234'/> </graphics> <video> - <model type='cirrus' vram='16384' heads='1'/> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='none'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml index a92aff4..9bc610b 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-interface-server.xml @@ -124,7 +124,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> </sound> <video> - <model type='cirrus' vram='16384' heads='1'/> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml index 7dc55e0..b9c9015 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth.xml @@ -68,7 +68,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </sound> <video> - <model type='vga' vram='16384' heads='1'/> + <model type='vga' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml index 46e5d61..411b409 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-net-bandwidth2.xml @@ -57,7 +57,7 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </sound> <video> - <model type='vga' vram='16384' heads='1'/> + <model type='vga' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml index b4d6a41..0ee137f 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-addr.xml @@ -71,7 +71,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <video> - <model type='cirrus' vram='16384' heads='1'/> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml index 8ca1e39..692025e 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-autoadd-idx.xml @@ -76,7 +76,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <video> - <model type='cirrus' vram='16384' heads='1'/> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge.xml index 3958ab3..61de009 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pci-bridge.xml @@ -241,7 +241,7 @@ <listen type='address' address='127.0.0.1'/> </graphics> <video> - <model type='cirrus' vram='16384' heads='1'/> + <model type='cirrus' vram='16384' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port.xml index cb1c60f..ea61bcf 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-root-port.xml @@ -45,7 +45,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <video> - <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/> + <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </video> <memballoon model='none'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-downstream-port.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-downstream-port.xml index 8f0e5ac..22cfeaa 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-downstream-port.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-downstream-port.xml @@ -83,7 +83,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <video> - <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/> + <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </video> <memballoon model='none'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-upstream-port.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-upstream-port.xml index 79c0304..813ba97 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-upstream-port.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcie-switch-upstream-port.xml @@ -53,7 +53,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <video> - <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/> + <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </video> <memballoon model='none'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-q35.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-q35.xml index 0845413..7e9a366 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-q35.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pcihole64-q35.xml @@ -37,7 +37,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <video> - <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/> + <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </video> <memballoon model='none'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-multi.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-multi.xml index 04cf91e..35e8fed 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-multi.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-multi.xml @@ -80,7 +80,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <video> - <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/> + <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </video> <memballoon model='none'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-reorder.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-reorder.xml index eef74d7..914c7f8 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-reorder.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2-reorder.xml @@ -80,7 +80,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <video> - <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/> + <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </video> <memballoon model='none'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2.xml index 19729cc..3fd2c0e 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35-usb2.xml @@ -50,7 +50,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <video> - <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/> + <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </video> <memballoon model='none'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml index 19729cc..3fd2c0e 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-q35.xml @@ -50,7 +50,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <video> - <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1'/> + <model type='qxl' ram='65536' vram='32768' vgamem='8192' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/> </video> <memballoon model='none'/> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none-relabel.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none-relabel.xml index 1b36533..050967b 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none-relabel.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-seclabel-dynamic-none-relabel.xml @@ -42,7 +42,7 @@ <listen type='address' address='0.0.0.0'/> </graphics> <video> - <model type='cirrus' vram='8192' heads='1'/> + <model type='cirrus' vram='8192' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml index 5808960..5b18cac 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-serial-spiceport.xml @@ -41,7 +41,7 @@ <listen type='address' address='127.0.0.1'/> </graphics> <video> - <model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='1'/> + <model type='qxl' ram='65536' vram='65536' vgamem='8192' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-device.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-device.xml index 726c0d3..a17b86e 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-device.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-device.xml @@ -30,7 +30,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <video> - <model type='virtio' heads='1'/> + <model type='virtio' heads='1' primary='yes'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-virgl.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-virgl.xml index 3655a39..8ec0d1a 100644 --- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-virgl.xml +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-video-virtio-gpu-virgl.xml @@ -30,7 +30,7 @@ <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <video> - <model type='virtio' heads='1'> + <model type='virtio' heads='1' primary='yes'> <acceleration accel3d='yes'/> </model> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> -- 2.7.1

On Tue, Feb 23, 2016 at 05:58:08PM +0100, Pavel Hrdina wrote:
We always place primary video device at first place, to make it easier to create a qemu command or format an xml, but we should also set the primary boolean for primary video device to 'true'.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com> ---
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3b15cb4..5e9c096 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11918,7 +11918,7 @@ virDomainVideoDefParseXML(xmlNodePtr node,
if ((primary = virXMLPropString(cur, "primary")) != NULL) { if (STREQ(primary, "yes")) - def->primary = 1; + def->primary = true; VIR_FREE(primary); }
So we already had this property, support it and behave based on it, we just don't document it or use it very much, nice. If I could, I would put it somewhere else than in the <model/>, but that's gone...
@@ -16060,6 +16060,10 @@ virDomainDefParseXML(xmlDocPtr xml, goto error; } } + /* if not specified by user mark the first video as primary */ + if (n && !primaryVideo) + def->videos[0]->primary = true; +
We basically used the first video as primary and we reorder them in order for this to be true. So this is true even if primaryVideo == true. Anyway, I still see it as a good way to save that info as well. ACK, Martin

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- docs/formatdomain.html.in | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index a524c17..3fcd728 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5182,15 +5182,15 @@ qemu-kvm -net nic,model=? /dev/null supported only for guests type of "vz", "kvm", "vbox" and "vmx". </p> <p> - For guest type of kvm the optional attribute <code>ram</code> - (<span class="since">since 1.0.2</span>) is allowed for "qxl" type - only and specifies the size of the primary bar, while the optional + For guest type of "kvm" or "qemu" and model type "qxl" there are + optional attributes. Attribute <code>ram</code> (<span class="since"> + since 1.0.2</span>) specifies the size of the primary bar, while the attribute <code>vram</code> specifies the secondary bar size. - If "ram" or "vram" are not supplied a default value is used. The ram - should also be rounded to power of two as vram. There is also optional - attribute <code>vgamem</code> (<span class="since">since 1.2.11 (QEMU - only)</span>) to set the size of VGA framebuffer for fallback mode of - QXL device. + If <code>ram</code> or <code>vram</code> are not supplied a default + value is used. The <code>ram</code> should also be rounded to power of + two as <code>vram</code>. There is also optional attribute + <code>vgamem</code> (<span class="since">since 1.2.11</span>) to set + the size of VGA framebuffer for fallback mode of QXL device. </p> </dd> -- 2.7.1

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/qemu/qemu_capabilities.c | 4 ++++ src/qemu/qemu_capabilities.h | 2 ++ tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 2 ++ tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 2 ++ tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 2 ++ tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 2 ++ tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 2 ++ tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 2 ++ tests/qemucapabilitiesdata/caps_2.1.1-1.caps | 2 ++ tests/qemucapabilitiesdata/caps_2.4.0-1.caps | 2 ++ tests/qemucapabilitiesdata/caps_2.5.0-1.caps | 2 ++ tests/qemucapabilitiesdata/caps_2.6.0-1.caps | 2 ++ 12 files changed, 26 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 1018d6c..e7dffd5 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -315,6 +315,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "vserport-change-event", /* 210 */ "virtio-balloon-pci.deflate-on-oom", "mptsas1068", + "qxl.vram64_size_mb", + "qxl-vga.vram64_size_mb", ); @@ -1652,10 +1654,12 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVmwareSvga[] = { static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsQxl[] = { { "vgamem_mb", QEMU_CAPS_QXL_VGAMEM }, + { "vram64_size_mb", QEMU_CAPS_QXL_VRAM64 }, }; static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsQxlVga[] = { { "vgamem_mb", QEMU_CAPS_QXL_VGA_VGAMEM }, + { "vram64_size_mb", QEMU_CAPS_QXL_VGA_VRAM64 }, }; static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioGpu[] = { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index b73c529..5cb2e63 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -344,6 +344,8 @@ typedef enum { QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE, /* virtio-balloon-{device,pci,ccw}. * deflate-on-oom */ QEMU_CAPS_SCSI_MPTSAS1068, /* -device mptsas1068 */ + QEMU_CAPS_QXL_VRAM64, /* -device qxl.vram64_size_mb */ + QEMU_CAPS_QXL_VGA_VRAM64, /* -device qxl-vga.vram64_size_mb */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps index 34ddd80..2e452ea 100644 --- a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps @@ -112,4 +112,6 @@ <flag name='rtl8139'/> <flag name='e1000'/> <flag name='virtio-net'/> + <flag name='qxl.vram64_size_mb'/> + <flag name='qxl-vga.vram64_size_mb'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps index cb8eac9..5ad56aa 100644 --- a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps @@ -127,4 +127,6 @@ <flag name='rtl8139'/> <flag name='e1000'/> <flag name='virtio-net'/> + <flag name='qxl.vram64_size_mb'/> + <flag name='qxl-vga.vram64_size_mb'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps index 86982f1..d0341fd 100644 --- a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps @@ -128,4 +128,6 @@ <flag name='rtl8139'/> <flag name='e1000'/> <flag name='virtio-net'/> + <flag name='qxl.vram64_size_mb'/> + <flag name='qxl-vga.vram64_size_mb'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps index 5401d65..93ea687 100644 --- a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps @@ -137,4 +137,6 @@ <flag name='rtl8139'/> <flag name='e1000'/> <flag name='virtio-net'/> + <flag name='qxl.vram64_size_mb'/> + <flag name='qxl-vga.vram64_size_mb'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps index 63536a7..c25b076 100644 --- a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps @@ -143,4 +143,6 @@ <flag name='rtl8139'/> <flag name='e1000'/> <flag name='virtio-net'/> + <flag name='qxl.vram64_size_mb'/> + <flag name='qxl-vga.vram64_size_mb'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps index 6717a94..30b70e9 100644 --- a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps @@ -143,4 +143,6 @@ <flag name='rtl8139'/> <flag name='e1000'/> <flag name='virtio-net'/> + <flag name='qxl.vram64_size_mb'/> + <flag name='qxl-vga.vram64_size_mb'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_2.1.1-1.caps b/tests/qemucapabilitiesdata/caps_2.1.1-1.caps index 332b85a..fd2639d 100644 --- a/tests/qemucapabilitiesdata/caps_2.1.1-1.caps +++ b/tests/qemucapabilitiesdata/caps_2.1.1-1.caps @@ -160,4 +160,6 @@ <flag name='e1000'/> <flag name='virtio-net'/> <flag name='vserport-change-event'/> + <flag name='qxl.vram64_size_mb'/> + <flag name='qxl-vga.vram64_size_mb'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_2.4.0-1.caps b/tests/qemucapabilitiesdata/caps_2.4.0-1.caps index e411542..4b61fc1 100644 --- a/tests/qemucapabilitiesdata/caps_2.4.0-1.caps +++ b/tests/qemucapabilitiesdata/caps_2.4.0-1.caps @@ -171,4 +171,6 @@ <flag name='ich9-disable-s4'/> <flag name='vserport-change-event'/> <flag name='virtio-balloon-pci.deflate-on-oom'/> + <flag name='qxl.vram64_size_mb'/> + <flag name='qxl-vga.vram64_size_mb'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_2.5.0-1.caps b/tests/qemucapabilitiesdata/caps_2.5.0-1.caps index 931bc4f..2061d0e 100644 --- a/tests/qemucapabilitiesdata/caps_2.5.0-1.caps +++ b/tests/qemucapabilitiesdata/caps_2.5.0-1.caps @@ -172,4 +172,6 @@ <flag name='ich9-disable-s4'/> <flag name='vserport-change-event'/> <flag name='virtio-balloon-pci.deflate-on-oom'/> + <flag name='qxl.vram64_size_mb'/> + <flag name='qxl-vga.vram64_size_mb'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-1.caps b/tests/qemucapabilitiesdata/caps_2.6.0-1.caps index f32d5aa..8d78b82 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0-1.caps +++ b/tests/qemucapabilitiesdata/caps_2.6.0-1.caps @@ -174,4 +174,6 @@ <flag name='ich9-disable-s4'/> <flag name='vserport-change-event'/> <flag name='virtio-balloon-pci.deflate-on-oom'/> + <flag name='qxl.vram64_size_mb'/> + <flag name='qxl-vga.vram64_size_mb'/> </qemuCaps> -- 2.7.1

This attribute is used to extend secondary PCI bar and expose it to the guest as 64bit memory. It works like this: attribute vram is there to set size of secondary PCI bar and guest sees it as 32bit memory, attribute vram64 can extend this secondary PCI bar. If both attributes are used, guest sees two memory bars, both address the same memory, with the difference that the 32bit bar can address only the first part of the whole memory. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1260749 Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- docs/formatdomain.html.in | 2 + docs/schemas/domaincommon.rng | 5 ++ src/conf/domain_conf.c | 34 +++++++++++--- src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 15 ++++++ src/qemu/qemu_monitor.c | 35 ++++++++++++++ src/qemu/qemu_monitor.h | 4 ++ src/qemu/qemu_monitor_json.c | 54 ++++++++++++++++++++++ src/qemu/qemu_monitor_json.h | 3 ++ src/qemu/qemu_process.c | 24 ++++++---- .../qemuxml2argv-video-qxl-device-vram64.args | 25 ++++++++++ .../qemuxml2argv-video-qxl-device-vram64.xml | 29 ++++++++++++ .../qemuxml2argv-video-qxl-sec-device-vram64.args | 27 +++++++++++ .../qemuxml2argv-video-qxl-sec-device-vram64.xml | 32 +++++++++++++ 14 files changed, 276 insertions(+), 14 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vram64.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vram64.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vram64.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vram64.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 3fcd728..318ffd9 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -5191,6 +5191,8 @@ qemu-kvm -net nic,model=? /dev/null two as <code>vram</code>. There is also optional attribute <code>vgamem</code> (<span class="since">since 1.2.11</span>) to set the size of VGA framebuffer for fallback mode of QXL device. + Attribute <code>vram64</code> (<span class="since">since 1.3.2</span>) + extends secondary bar and makes it addressable as 64bit memory. </p> </dd> diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 67af93a..fe5eaf0 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2938,6 +2938,11 @@ <ref name="unsignedInt"/> </attribute> </optional> + <optional> + <attribute name="vram64"> + <ref name="unsignedInt"/> + </attribute> + </optional> </group> </choice> <optional> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5e9c096..4689984 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -11898,6 +11898,7 @@ virDomainVideoDefParseXML(xmlNodePtr node, char *type = NULL; char *heads = NULL; char *vram = NULL; + char *vram64 = NULL; char *ram = NULL; char *vgamem = NULL; char *primary = NULL; @@ -11913,6 +11914,7 @@ virDomainVideoDefParseXML(xmlNodePtr node, type = virXMLPropString(cur, "type"); ram = virXMLPropString(cur, "ram"); vram = virXMLPropString(cur, "vram"); + vram64 = virXMLPropString(cur, "vram64"); vgamem = virXMLPropString(cur, "vgamem"); heads = virXMLPropString(cur, "heads"); @@ -11967,6 +11969,19 @@ virDomainVideoDefParseXML(xmlNodePtr node, def->vram = virDomainVideoDefaultRAM(dom, def->type); } + if (vram64) { + if (def->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("vram64 attribute only supported for type of qxl")); + goto error; + } + if (virStrToLong_uip(vram64, NULL, 10, &def->vram64) < 0) { + virReportError(VIR_ERR_XML_ERROR, + _("cannot parse video vram64 '%s'"), vram64); + goto error; + } + } + if (vgamem) { if (def->type != VIR_DOMAIN_VIDEO_TYPE_QXL) { virReportError(VIR_ERR_XML_ERROR, "%s", @@ -11993,9 +12008,11 @@ virDomainVideoDefParseXML(xmlNodePtr node, if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0) goto error; + cleanup: VIR_FREE(type); VIR_FREE(ram); VIR_FREE(vram); + VIR_FREE(vram64); VIR_FREE(vgamem); VIR_FREE(heads); @@ -12003,12 +12020,8 @@ virDomainVideoDefParseXML(xmlNodePtr node, error: virDomainVideoDefFree(def); - VIR_FREE(type); - VIR_FREE(ram); - VIR_FREE(vram); - VIR_FREE(vgamem); - VIR_FREE(heads); - return NULL; + def = NULL; + goto cleanup; } static virDomainHostdevDefPtr @@ -17027,6 +17040,13 @@ virDomainVideoDefCheckABIStability(virDomainVideoDefPtr src, return false; } + if (src->vram64 != dst->vram64) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target video card vram64 %u does not match source %u"), + dst->vram64, src->vram64); + return false; + } + if (src->vgamem != dst->vgamem) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Target video card vgamem %u does not match source %u"), @@ -20712,6 +20732,8 @@ virDomainVideoDefFormat(virBufferPtr buf, virBufferAsprintf(buf, " ram='%u'", def->ram); if (def->vram) virBufferAsprintf(buf, " vram='%u'", def->vram); + if (def->vram64) + virBufferAsprintf(buf, " vram64='%u'", def->vram64); if (def->vgamem) virBufferAsprintf(buf, " vgamem='%u'", def->vgamem); if (def->heads) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 1de3be3..c3a7386 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1399,6 +1399,7 @@ struct _virDomainVideoDef { int type; unsigned int ram; /* kibibytes (multiples of 1024) */ unsigned int vram; /* kibibytes (multiples of 1024) */ + unsigned int vram64; /* kibibytes (multiples of 1024) */ unsigned int vgamem; /* kibibytes (multiples of 1024) */ unsigned int heads; bool primary; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 20ebb64..e5fbc80 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3347,6 +3347,14 @@ qemuBuildDeviceVideoStr(virDomainDefPtr def, } if ((video->primary && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGA_VRAM64)) || + (!video->primary && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VRAM64))) { + /* QEMU accepts mebibytes for vram64_size_mb. */ + virBufferAsprintf(&buf, ",vram64_size_mb=%u", video->vram64 / 1024); + } + + if ((video->primary && virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGA_VGAMEM)) || (!video->primary && virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGAMEM))) { @@ -8256,6 +8264,7 @@ qemuBuildCommandLine(virConnectPtr conn, virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { unsigned int ram = def->videos[0]->ram; unsigned int vram = def->videos[0]->vram; + unsigned int vram64 = def->videos[0]->vram64; unsigned int vgamem = def->videos[0]->vgamem; if (vram > (UINT_MAX / 1024)) { @@ -8281,6 +8290,12 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArgFormat(cmd, "%s.vram_size=%u", dev, vram * 1024); } + if (vram64 && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGA_VRAM64)) { + virCommandAddArg(cmd, "-global"); + virCommandAddArgFormat(cmd, "%s.vram64_size_mb=%u", + dev, vram64 / 1024); + } if (vgamem && virQEMUCapsGet(qemuCaps, QEMU_CAPS_QXL_VGA_VGAMEM)) { virCommandAddArg(cmd, "-global"); diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index cb87412..ace3bb4 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -1154,6 +1154,41 @@ qemuMonitorUpdateVideoMemorySize(qemuMonitorPtr mon, } +/** + * To update video vram64 size in status XML we need to load correct value from + * QEMU. This is supported only with JSON monitor. + * + * Returns 0 on success, -1 on failure and sets proper error message. + */ +int +qemuMonitorUpdateVideoVram64Size(qemuMonitorPtr mon, + virDomainVideoDefPtr video, + const char *videoName) +{ + int ret = -1; + char *path = NULL; + + QEMU_CHECK_MONITOR(mon); + + if (mon->json) { + ret = qemuMonitorJSONFindLinkPath(mon, videoName, &path); + if (ret < 0) { + if (ret == -2) + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to find QOM Object path for " + "device '%s'"), videoName); + return -1; + } + + ret = qemuMonitorJSONUpdateVideoVram64Size(mon, video, path); + VIR_FREE(path); + return ret; + } + + return 0; +} + + int qemuMonitorHMPCommandWithFd(qemuMonitorPtr mon, const char *cmd, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 6a2a985..4467a41 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -269,6 +269,10 @@ int qemuMonitorUpdateVideoMemorySize(qemuMonitorPtr mon, virDomainVideoDefPtr video, const char *videoName) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); +int qemuMonitorUpdateVideoVram64Size(qemuMonitorPtr mon, + virDomainVideoDefPtr video, + const char *videoName) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); int qemuMonitorHMPCommandWithFd(qemuMonitorPtr mon, const char *cmd, int scm_fd, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index d2b641f..8352e53 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -1436,6 +1436,18 @@ qemuMonitorJSONUpdateVideoMemorySize(qemuMonitorPtr mon, return -1; } video->vram = prop.val.ul / 1024; + + if (video->vram64 != 0) { + if (qemuMonitorJSONGetObjectProperty(mon, path, + "vram64_size_mb", &prop) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("QOM Object '%s' has no property 'vram64_size_mb'"), + path); + return -1; + } + video->vram64 = prop.val.ul / 1024; + } + if (qemuMonitorJSONGetObjectProperty(mon, path, "ram_size", &prop) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("QOM Object '%s' has no property 'ram_size'"), @@ -1471,6 +1483,48 @@ qemuMonitorJSONUpdateVideoMemorySize(qemuMonitorPtr mon, } +/** + * Loads correct video vram64 size value from QEMU and update the video + * definition. + * + * Return 0 on success, -1 on failure and set proper error message. + */ +int +qemuMonitorJSONUpdateVideoVram64Size(qemuMonitorPtr mon, + virDomainVideoDefPtr video, + char *path) +{ + qemuMonitorJSONObjectProperty prop = { + QEMU_MONITOR_OBJECT_PROPERTY_ULONG, + {0} + }; + + switch (video->type) { + case VIR_DOMAIN_VIDEO_TYPE_QXL: + if (video->vram64 != 0) { + if (qemuMonitorJSONGetObjectProperty(mon, path, + "vram64_size_mb", &prop) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("QOM Object '%s' has no property 'vram64_size_mb'"), + path); + return -1; + } + video->vram64 = prop.val.ul / 1024; + } + break; + case VIR_DOMAIN_VIDEO_TYPE_VGA: + case VIR_DOMAIN_VIDEO_TYPE_VMVGA: + case VIR_DOMAIN_VIDEO_TYPE_CIRRUS: + case VIR_DOMAIN_VIDEO_TYPE_XEN: + case VIR_DOMAIN_VIDEO_TYPE_VBOX: + case VIR_DOMAIN_VIDEO_TYPE_LAST: + break; + } + + return 0; +} + + int qemuMonitorJSONGetBalloonInfo(qemuMonitorPtr mon, unsigned long long *currmem) diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 2c27c6f..4068187 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -60,6 +60,9 @@ int qemuMonitorJSONGetVirtType(qemuMonitorPtr mon, int qemuMonitorJSONUpdateVideoMemorySize(qemuMonitorPtr mon, virDomainVideoDefPtr video, char *path); +int qemuMonitorJSONUpdateVideoVram64Size(qemuMonitorPtr mon, + virDomainVideoDefPtr video, + char *path); int qemuMonitorJSONGetBalloonInfo(qemuMonitorPtr mon, unsigned long long *currmem); int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index e760182..2da20b8 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2740,17 +2740,25 @@ qemuProcessUpdateVideoRamSize(virQEMUDriverPtr driver, break; case VIR_DOMAIN_VIDEO_TYPE_QXL: if (i == 0) { - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QXL_VGA_VGAMEM)) { - if (qemuMonitorUpdateVideoMemorySize(priv->mon, video, - "qxl-vga") < 0) + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QXL_VGA_VGAMEM) && + qemuMonitorUpdateVideoMemorySize(priv->mon, video, + "qxl-vga") < 0) goto error; - } + + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QXL_VGA_VRAM64) && + qemuMonitorUpdateVideoVram64Size(priv->mon, video, + "qxl-vga") < 0) + goto error; } else { - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QXL_VGAMEM)) { - if (qemuMonitorUpdateVideoMemorySize(priv->mon, video, - "qxl") < 0) + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QXL_VGAMEM) && + qemuMonitorUpdateVideoMemorySize(priv->mon, video, + "qxl") < 0) + goto error; + + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_QXL_VRAM64) && + qemuMonitorUpdateVideoVram64Size(priv->mon, video, + "qxl") < 0) goto error; - } } break; case VIR_DOMAIN_VIDEO_TYPE_VMVGA: diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vram64.args b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vram64.args new file mode 100644 index 0000000..b9e65ea --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vram64.args @@ -0,0 +1,25 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu-system-x86_64 \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 1024 \ +-smp 1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/test-monitor,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-drive file=/var/lib/libvirt/images/QEMUGuest1,format=qcow2,if=none,\ +id=drive-ide0-0-0,cache=none \ +-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ +-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,\ +vram64_size_mb=128,vgamem_mb=16,bus=pci.0,addr=0x2 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vram64.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vram64.xml new file mode 100644 index 0000000..1e89d06 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vram64.xml @@ -0,0 +1,29 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='x86_64' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + <disk type='file' device='disk'> + <driver name='qemu' type='qcow2' cache='none'/> + <source file='/var/lib/libvirt/images/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='ide' index='0'/> + <video> + <model type='qxl' vram64='131072' heads='1'/> + </video> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vram64.args b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vram64.args new file mode 100644 index 0000000..fadc3ed --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vram64.args @@ -0,0 +1,27 @@ +LC_ALL=C \ +PATH=/bin \ +HOME=/home/test \ +USER=test \ +LOGNAME=test \ +QEMU_AUDIO_DRV=none \ +/usr/bin/qemu \ +-name QEMUGuest1 \ +-S \ +-M pc \ +-m 1024 \ +-smp 1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/test-monitor,server,nowait \ +-no-acpi \ +-boot c \ +-usb \ +-drive file=/var/lib/libvirt/images/QEMUGuest1,format=qcow2,if=none,\ +id=drive-ide0-0-0,cache=none \ +-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ +-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vgamem_mb=16,\ +bus=pci.0,addr=0x2 \ +-device qxl,id=video1,ram_size=67108864,vram_size=67108864,vram64_size_mb=128,\ +vgamem_mb=16,bus=pci.0,addr=0x4 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vram64.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vram64.xml new file mode 100644 index 0000000..72e8bad --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vram64.xml @@ -0,0 +1,32 @@ +<domain type='qemu'> + <name>QEMUGuest1</name> + <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid> + <memory unit='KiB'>1048576</memory> + <currentMemory unit='KiB'>1048576</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686' machine='pc'>hvm</type> + <boot dev='hd'/> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <emulator>/usr/bin/qemu</emulator> + <disk type='file' device='disk'> + <driver name='qemu' type='qcow2' cache='none'/> + <source file='/var/lib/libvirt/images/QEMUGuest1'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='ide' index='0'/> + <video> + <model type='qxl' heads='1'/> + </video> + <video> + <model type='qxl' vram64='131072' heads='1'/> + </video> + <memballoon model='virtio'/> + </devices> +</domain> -- 2.7.1

On Tue, Feb 23, 2016 at 05:58:07PM +0100, Pavel Hrdina wrote:
New in v2: - added patch to always set primary video device as primary - introduced new qemu monitor functions to update vram64 values after QEMU is started only if QEMU supports this parameter
ACK series, although I would prefer it to go in after release even though you sent it before the freeze.
participants (2)
-
Martin Kletzander
-
Pavel Hrdina