[libvirt] [PATCH v2 0/4] use the 'vram' attribute for QEMU video devices

There are some changes from the first version. We will not have a new 'vgamem' attribute for video devices because we can use the 'vram' attribute. So far for QEMU the 'vram' is used only to set the secondary ram for QXL which seems to be correct as the secondary ram is used for pixmaps and surfaces. The 'vgamem_mb' parameter for QXL sets the VGA framebuffer size, but the VGA mode in QXL is used only as fallback if the OS doesn't have any QXL drivers or before the drivers are loaded. The VGA framebuffer is part of the first ram for QXL and for that we have 'ram' attribute. The rest of the first ram is memory for rendering commands and it's data. Default VGA framebuffer size is 8MB which is sufficient. Other QEMU video devices have only 'vgamem_mb' parameter and we will use the 'vram' attribute to set the size of video memory as it's used also for other hypervisors. The first two patches clean the usage of vram attribute and improve the documentation and the rest two patches implements usage of 'vram' attribute for remaining QEMU video devices. Pavel Hrdina (4): video: cleanup usage of vram attribute and update documentation qxl: fix setting ram and vram values for qemu qxl device caps: introduce new qemu capability for vgamem_mb device property qemu-command: introduce new vgamem attribute for video devices docs/formatdomain.html.in | 62 +++++++----- src/conf/domain_conf.c | 19 +++- src/conf/domain_conf.h | 3 +- src/qemu/qemu_capabilities.c | 25 +++++ src/qemu/qemu_capabilities.h | 3 + src/qemu/qemu_command.c | 44 ++++++++- tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 2 + tests/qemucapabilitiesdata/caps_1.2.2-1.replies | 100 +++++++++++++++++-- tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.3.1-1.replies | 108 +++++++++++++++++++-- tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.4.2-1.replies | 108 +++++++++++++++++++-- tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.5.3-1.replies | 108 +++++++++++++++++++-- tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.6.0-1.replies | 108 +++++++++++++++++++-- tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.6.50-1.replies | 108 +++++++++++++++++++-- tests/qemucapabilitiesdata/caps_2.1.1-1.caps | 3 + tests/qemucapabilitiesdata/caps_2.1.1-1.replies | 108 +++++++++++++++++++-- .../qemuxml2argv-graphics-spice-compression.args | 2 +- .../qemuxml2argv-graphics-spice-sasl.args | 4 +- .../qemuxml2argv-graphics-spice.args | 4 +- .../qemuxml2argv-pcihole64-q35.args | 2 +- tests/qemuxml2argvdata/qemuxml2argv-q35.args | 2 +- .../qemuxml2argv-video-qxl-device-vgamem.args | 6 ++ .../qemuxml2argv-video-qxl-device-vgamem.xml | 29 ++++++ .../qemuxml2argv-video-qxl-device.args | 6 ++ .../qemuxml2argv-video-qxl-device.xml | 29 ++++++ .../qemuxml2argv-video-qxl-nodevice.args | 5 + .../qemuxml2argv-video-qxl-nodevice.xml | 29 ++++++ .../qemuxml2argv-video-qxl-sec-device-vgamem.args | 8 ++ .../qemuxml2argv-video-qxl-sec-device-vgamem.xml | 32 ++++++ .../qemuxml2argv-video-qxl-sec-device.args | 7 ++ .../qemuxml2argv-video-qxl-sec-device.xml | 32 ++++++ .../qemuxml2argv-video-qxl-sec-nodevice.xml | 32 ++++++ .../qemuxml2argv-video-vga-device-vgamem.args | 6 ++ .../qemuxml2argv-video-vga-device-vgamem.xml | 29 ++++++ .../qemuxml2argv-video-vga-device.args | 6 ++ .../qemuxml2argv-video-vga-device.xml | 29 ++++++ .../qemuxml2argv-video-vga-nodevice.args | 5 + .../qemuxml2argv-video-vga-nodevice.xml | 29 ++++++ tests/qemuxml2argvtest.c | 16 +++ tools/virsh-domain.c | 4 +- 44 files changed, 1188 insertions(+), 89 deletions(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-nodevice.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.xml -- 2.0.4

The vram attribute was introduced to set the video memory but it is usable only for few hypervisors excluding QEMU/KVM. QEMU/KVM has different attribute for this purpose "vgamem_mb" and it will be introduced lately. The correct usage of vram is to set the video memory for other hypervisors or to set secondary bar size for QXL video device for QEMU/KVM. This patch updates the documentation to reflect current code in libvirt and also changes the cases when we will set the default vram attribute. It's pointless to set it for QEMU/KVM if you aren't using QXL as it won't be used. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1076098 Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- docs/formatdomain.html.in | 62 +++++++++++++++++++++++++++++------------------ src/conf/domain_conf.c | 19 ++++++++++++--- src/conf/domain_conf.h | 3 ++- src/qemu/qemu_command.c | 4 +-- 4 files changed, 58 insertions(+), 30 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index d4189e6..2bbd389 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4658,33 +4658,49 @@ qemu-kvm -net nic,model=? /dev/null <dl> <dt><code>video</code></dt> <dd> - The <code>video</code> element is the container for describing - video devices. For backwards compatibility, if no <code>video</code> - is set but there is a <code>graphics</code> in domain xml, then libvirt - will add a default <code>video</code> according to the guest type. - For a guest of type "kvm", the default <code>video</code> for it is: - <code>type</code> with value "cirrus", <code>vram</code> with value - "9216", and <code>heads</code> with value "1". By default, the first - video device in domain xml is the primary one, but the optional - attribute <code>primary</code> (<span class="since">since 1.0.2</span>) - with value 'yes' can be used to mark the primary in cases of multiple - video device. The non-primary must be type of "qxl". 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 <code>vram</code> specifies the - secondary bar size. If "ram" or "vram" are not supplied a default - value is used. + <p> + The <code>video</code> element is the container for describing + video devices. For backwards compatibility, if no <code>video</code> + is set but there is a <code>graphics</code> in domain xml, then + libvirt will add a default <code>video</code> according to the guest + type. + </p> + <p> + For a guest of type "kvm", the default <code>video</code> is: + <code>type</code> with value "cirrus", <code>vram</code> with value + "9216" and <code>heads</code> with value "1". By default, the first + video device in domain xml is the primary one, but the optional + attribute <code>primary</code> (<span class="since">since 1.0.2</span>) + with value 'yes' can be used to mark the primary in cases of multiple + video device. The non-primary must be type of "qxl". + </p> </dd> <dt><code>model</code></dt> <dd> - The <code>model</code> element has a mandatory <code>type</code> - attribute which takes the value "vga", "cirrus", "vmvga", "xen", - "vbox", or "qxl" (<span class="since">since 0.8.6</span>) - depending on the hypervisor features available. - You can also provide the amount of video memory in kibibytes - (blocks of 1024 bytes) using - <code>vram</code> and the number of screen with <code>heads</code>. + <p> + The <code>model</code> element has a mandatory <code>type</code> + attribute which takes the value "vga", "cirrus", "vmvga", "xen", + "vbox", or "qxl" (<span class="since">since 0.8.6</span>) depending + on the hypervisor features available. + </p> + <p> + You can provide the amount of video memory in kibibytes (blocks of + 1024 bytes) using <code>vram</code>. This is supported only for guest + type of "libxl", "parallels", "qemu", "vbox", "vmx" and "xen". If no + value is provided the default is used. + </p> + <p> + The number of screen can be set using <code>heads</code>. This is + supported only for guests type of "parallels", "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 + attribute <code>vram</code> specifies the secondary bar size. + If "ram" or "vram" are not supplied a default value is used. + </p> </dd> <dt><code>acceleration</code></dt> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2c65276..3a844b4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10099,9 +10099,9 @@ virSysinfoParseXML(xmlNodePtr node, goto cleanup; } -int +unsigned int virDomainVideoDefaultRAM(const virDomainDef *def, - int type) + const virDomainVideoType type) { /* Defer setting default vram to the Xen drivers */ if (def->virtType == VIR_DOMAIN_VIRT_XEN) @@ -10278,11 +10278,22 @@ virDomainVideoDefParseXML(xmlNodePtr node, if (vram) { if (virStrToLong_ui(vram, NULL, 10, &def->vram) < 0) { virReportError(VIR_ERR_XML_ERROR, - _("cannot parse video ram '%s'"), vram); + _("cannot parse video vram '%s'"), vram); goto error; } } else { - def->vram = virDomainVideoDefaultRAM(dom, def->type); + switch (dom->virtType) { + case VIR_DOMAIN_VIRT_QEMU: + case VIR_DOMAIN_VIRT_KQEMU: + case VIR_DOMAIN_VIRT_KVM: + break; + default: + def->vram = virDomainVideoDefaultRAM(dom, def->type); + break; + } + + if (def->type == VIR_DOMAIN_VIDEO_TYPE_QXL) + def->vram = virDomainVideoDefaultRAM(dom, def->type); } if (heads) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 530a3ca..b6ea6e4 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2606,7 +2606,8 @@ int virDomainFSIndexByName(virDomainDefPtr def, const char *name); virDomainFSDefPtr virDomainFSRemove(virDomainDefPtr def, size_t i); int virDomainVideoDefaultType(const virDomainDef *def); -int virDomainVideoDefaultRAM(const virDomainDef *def, int type); +unsigned int virDomainVideoDefaultRAM(const virDomainDef *def, + const virDomainVideoType type); int virDomainObjListNumOfDomains(virDomainObjListPtr doms, bool active, diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f674ba9..fa7c365 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9334,8 +9334,8 @@ qemuBuildCommandLine(virConnectPtr conn, virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { const char *dev = (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL_VGA) ? "qxl-vga" : "qxl"); - int ram = def->videos[0]->ram; - int vram = def->videos[0]->vram; + unsigned int ram = def->videos[0]->ram; + unsigned int vram = def->videos[0]->vram; if (vram > (UINT_MAX / 1024)) { virReportError(VIR_ERR_OVERFLOW, -- 2.0.4

QEMU has two different type of QXL display device. The first "qxl-vga" is for primary video device and second "qxl" is for secondary video device. There are also two different ways how to specify those devices on qemu command line, the first one and obsolete is using "-vga" option and the current new one is using "-device" option. The "-vga" could be used only to setup primary video device, so the "-vga qxl" equal to "-device qxl-vga". Unfortunately the "-vga qxl" doesn't support setting additional parameters for the device and "-global" option must be used for this purpose. It's mandatory to use "-global qxl-vga...." to set the parameters of primary video device previously defined with "-vga qxl". Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1076098 Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/qemu/qemu_command.c | 4 ++-- tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args | 2 +- tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.args | 4 ++-- tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args | 4 ++-- tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args | 2 +- tests/qemuxml2argvdata/qemuxml2argv-q35.args | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index fa7c365..d6154a4 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9329,11 +9329,11 @@ qemuBuildCommandLine(virConnectPtr conn, virCommandAddArgList(cmd, "-vga", vgastr, NULL); + const char *dev = qemuDeviceVideoTypeToString(primaryVideoType); + if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL && (def->videos[0]->vram || def->videos[0]->ram) && virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) { - const char *dev = (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL_VGA) - ? "qxl-vga" : "qxl"); unsigned int ram = def->videos[0]->ram; unsigned int vram = def->videos[0]->vram; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args index 59f064b..ac8e316 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-compression.args @@ -6,6 +6,6 @@ x509-dir=/etc/pki/libvirt-spice,\ image-compression=auto_glz,jpeg-wan-compression=auto,\ zlib-glz-wan-compression=auto,\ playback-compression=on,streaming-video=filter -vga \ -qxl -global qxl.ram_size=67108864 -global qxl.vram_size=18874368 \ +qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=18874368 \ -device qxl,id=video1,ram_size=67108864,vram_size=33554432,bus=pci.0,addr=0x4 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.args index 8847bce..3a73588 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice-sasl.args @@ -5,5 +5,5 @@ SASL_CONF_PATH=/root/.sasl2 QEMU_AUDIO_DRV=spice \ /dev/HostVG/QEMUGuest1 \ -spice port=5903,tls-port=5904,sasl,addr=127.0.0.1,\ x509-dir=/etc/pki/libvirt-spice,tls-channel=default \ --vga qxl -global qxl.ram_size=67108864 -global \ -qxl.vram_size=18874368 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 +-vga qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=18874368 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args index 8430d9c..f2c2dcc 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-graphics-spice.args @@ -7,7 +7,7 @@ plaintext-channel=inputs,\ image-compression=auto_glz,jpeg-wan-compression=auto,\ zlib-glz-wan-compression=auto,\ playback-compression=on,streaming-video=filter,disable-copy-paste,\ -disable-agent-file-xfer -vga qxl -global qxl.ram_size=67108864 \ --global qxl.vram_size=18874368 \ +disable-agent-file-xfer -vga qxl -global qxl-vga.ram_size=67108864 \ +-global qxl-vga.vram_size=18874368 \ -device qxl,id=video1,ram_size=67108864,vram_size=33554432,bus=pci.0,addr=0x4 \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args b/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args index 6855cd2..ad72d15 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-pcihole64-q35.args @@ -6,4 +6,4 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \ -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-sata0-0-0 \ -device ide-drive,bus=ide.0,drive=drive-sata0-0-0,id=sata0-0-0 \ --vga qxl -global qxl.ram_size=67108864 -global qxl.vram_size=18874368 +-vga qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=18874368 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-q35.args b/tests/qemuxml2argvdata/qemuxml2argv-q35.args index 8cc5874..24545fd 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-q35.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-q35.args @@ -5,4 +5,4 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ -device pci-bridge,chassis_nr=2,id=pci.2,bus=pci.1,addr=0x1 \ -drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-sata0-0-0 \ -device ide-drive,bus=ide.0,drive=drive-sata0-0-0,id=sata0-0-0 \ --vga qxl -global qxl.ram_size=67108864 -global qxl.vram_size=18874368 +-vga qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=18874368 -- 2.0.4

Allow setting vgamem size for video devices. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1076098 Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/qemu/qemu_capabilities.c | 25 ++++++ src/qemu/qemu_capabilities.h | 3 + tests/qemucapabilitiesdata/caps_1.2.2-1.caps | 2 + tests/qemucapabilitiesdata/caps_1.2.2-1.replies | 100 +++++++++++++++++++-- tests/qemucapabilitiesdata/caps_1.3.1-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.3.1-1.replies | 108 +++++++++++++++++++++-- tests/qemucapabilitiesdata/caps_1.4.2-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.4.2-1.replies | 108 +++++++++++++++++++++-- tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.5.3-1.replies | 108 +++++++++++++++++++++-- tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.6.0-1.replies | 108 +++++++++++++++++++++-- tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 3 + tests/qemucapabilitiesdata/caps_1.6.50-1.replies | 108 +++++++++++++++++++++-- tests/qemucapabilitiesdata/caps_2.1.1-1.caps | 3 + tests/qemucapabilitiesdata/caps_2.1.1-1.replies | 108 +++++++++++++++++++++-- 16 files changed, 747 insertions(+), 49 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index cbdc08b..b222c52 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -272,6 +272,10 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "migrate-rdma", "ivshmem", "drive-iotune-max", + + "cirrus-vga.vgamem_mb", /* 180 */ + "VGA.vgamem_mb", + "vmware-svga.vgamem_mb", ); @@ -1582,6 +1586,18 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsKVMPit[] = { { "lost_tick_policy", QEMU_CAPS_KVM_PIT_TICK_POLICY }, }; +static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsCirrusVga[] = { + { "vgamem_mb", QEMU_CAPS_CIRRUS_VGA_VGAMEM }, +}; + +static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVGA[] = { + { "vgamem_mb", QEMU_CAPS_VGA_VGAMEM }, +}; + +static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVmwareSvga[] = { + { "vgamem_mb", QEMU_CAPS_VMWARE_SVGA_VGAMEM }, +}; + struct virQEMUCapsObjectTypeProps { const char *type; struct virQEMUCapsStringFlags *props; @@ -1627,6 +1643,12 @@ static struct virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = { ARRAY_CARDINALITY(virQEMUCapsObjectPropsUSBStorage) }, { "kvm-pit", virQEMUCapsObjectPropsKVMPit, ARRAY_CARDINALITY(virQEMUCapsObjectPropsKVMPit) }, + { "cirrus-vga", virQEMUCapsObjectPropsCirrusVga, + ARRAY_CARDINALITY(virQEMUCapsObjectPropsCirrusVga) }, + { "VGA", virQEMUCapsObjectPropsVGA, + ARRAY_CARDINALITY(virQEMUCapsObjectPropsVGA) }, + { "vmware-svga", virQEMUCapsObjectPropsVmwareSvga, + ARRAY_CARDINALITY(virQEMUCapsObjectPropsVmwareSvga) }, }; @@ -1818,6 +1840,9 @@ virQEMUCapsExtractDeviceStr(const char *qemu, "-device", "usb-host,?", "-device", "scsi-generic,?", "-device", "usb-storage,?", + "-device", "cirrus-vga,?", + "-device", "VGA,?", + "-device", "vmware-svga,?", NULL); /* qemu -help goes to stdout, but qemu -device ? goes to stderr. */ virCommandSetErrorBuffer(cmd, &output); diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index ffe3494..c8f0f14 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -219,6 +219,9 @@ typedef enum { QEMU_CAPS_MIGRATE_RDMA = 177, /* have rdma migration */ QEMU_CAPS_DEVICE_IVSHMEM = 178, /* -device ivshmem */ QEMU_CAPS_DRIVE_IOTUNE_MAX = 179, /* -drive bps_max= and friends */ + QEMU_CAPS_CIRRUS_VGA_VGAMEM = 180, /* -device cirrus-vga.vgamem_mb */ + QEMU_CAPS_VGA_VGAMEM = 181, /* -device VGA.vgamem_mb */ + QEMU_CAPS_VMWARE_SVGA_VGAMEM = 182, /* -device vmware-svga.vgamem_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 fc8dfc1..63fc139 100644 --- a/tests/qemucapabilitiesdata/caps_1.2.2-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.2.2-1.caps @@ -116,4 +116,6 @@ <flag name='host-pci-multidomain'/> <flag name='usb-audio'/> <flag name='ivshmem'/> + <flag name='VGA.vgamem_mb'/> + <flag name='vmware-svga.vgamem_mb'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_1.2.2-1.replies b/tests/qemucapabilitiesdata/caps_1.2.2-1.replies index 4fce9d7..d29a36f 100644 --- a/tests/qemucapabilitiesdata/caps_1.2.2-1.replies +++ b/tests/qemucapabilitiesdata/caps_1.2.2-1.replies @@ -1408,6 +1408,92 @@ { "return": [ { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + } + ], + "id": "libvirt-27" +} + +{ + "return": [ + { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-28" +} + +{ + "return": [ + { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-29" +} + +{ + "return": [ + { "name": "xenpv" }, { @@ -1449,7 +1535,7 @@ "name": "none" } ], - "id": "libvirt-26" + "id": "libvirt-30" } { @@ -1521,7 +1607,7 @@ "name": "Opteron_G4" } ], - "id": "libvirt-27" + "id": "libvirt-31" } { @@ -1529,11 +1615,11 @@ "enabled": false, "present": true }, - "id": "libvirt-28" + "id": "libvirt-32" } { - "id": "libvirt-29", + "id": "libvirt-33", "error": { "class": "CommandNotFound", "desc": "The command query-tpm-models has not been found" @@ -1541,7 +1627,7 @@ } { - "id": "libvirt-30", + "id": "libvirt-34", "error": { "class": "CommandNotFound", "desc": "The command query-tpm-types has not been found" @@ -1549,7 +1635,7 @@ } { - "id": "libvirt-31", + "id": "libvirt-35", "error": { "class": "CommandNotFound", "desc": "The command query-command-line-options has not been found" @@ -1563,5 +1649,5 @@ "state": false } ], - "id": "libvirt-32" + "id": "libvirt-36" } diff --git a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps index f4f0397..452b285 100644 --- a/tests/qemucapabilitiesdata/caps_1.3.1-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.3.1-1.caps @@ -130,4 +130,7 @@ <flag name='host-pci-multidomain'/> <flag name='usb-audio'/> <flag name='ivshmem'/> + <flag name='cirrus-vga.vgamem_mb'/> + <flag name='VGA.vgamem_mb'/> + <flag name='vmware-svga.vgamem_mb'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_1.3.1-1.replies b/tests/qemucapabilitiesdata/caps_1.3.1-1.replies index 43713b2..5fbeb0c 100644 --- a/tests/qemucapabilitiesdata/caps_1.3.1-1.replies +++ b/tests/qemucapabilitiesdata/caps_1.3.1-1.replies @@ -1575,6 +1575,100 @@ { "return": [ { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-27" +} + +{ + "return": [ + { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "mmio", + "type": "on/off" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-28" +} + +{ + "return": [ + { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-29" +} + +{ + "return": [ + { "name": "xenpv" }, { @@ -1623,7 +1717,7 @@ "name": "none" } ], - "id": "libvirt-28" + "id": "libvirt-30" } { @@ -1701,7 +1795,7 @@ "name": "Opteron_G5" } ], - "id": "libvirt-29" + "id": "libvirt-31" } { @@ -1709,11 +1803,11 @@ "enabled": false, "present": true }, - "id": "libvirt-30" + "id": "libvirt-32" } { - "id": "libvirt-31", + "id": "libvirt-33", "error": { "class": "CommandNotFound", "desc": "The command query-tpm-models has not been found" @@ -1721,7 +1815,7 @@ } { - "id": "libvirt-32", + "id": "libvirt-34", "error": { "class": "CommandNotFound", "desc": "The command query-tpm-types has not been found" @@ -1729,7 +1823,7 @@ } { - "id": "libvirt-33", + "id": "libvirt-35", "error": { "class": "CommandNotFound", "desc": "The command query-command-line-options has not been found" @@ -1743,5 +1837,5 @@ "state": false } ], - "id": "libvirt-34" + "id": "libvirt-36" } diff --git a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps index e6659e4..658da0b 100644 --- a/tests/qemucapabilitiesdata/caps_1.4.2-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.4.2-1.caps @@ -131,4 +131,7 @@ <flag name='host-pci-multidomain'/> <flag name='usb-audio'/> <flag name='ivshmem'/> + <flag name='cirrus-vga.vgamem_mb'/> + <flag name='VGA.vgamem_mb'/> + <flag name='vmware-svga.vgamem_mb'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_1.4.2-1.replies b/tests/qemucapabilitiesdata/caps_1.4.2-1.replies index 34384f8..0dee35c 100644 --- a/tests/qemucapabilitiesdata/caps_1.4.2-1.replies +++ b/tests/qemucapabilitiesdata/caps_1.4.2-1.replies @@ -1622,6 +1622,100 @@ { "return": [ { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-27" +} + +{ + "return": [ + { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "mmio", + "type": "on/off" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-28" +} + +{ + "return": [ + { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-29" +} + +{ + "return": [ + { "name": "xenpv" }, { @@ -1673,7 +1767,7 @@ "name": "none" } ], - "id": "libvirt-28" + "id": "libvirt-30" } { @@ -1751,7 +1845,7 @@ "name": "qemu64" } ], - "id": "libvirt-29" + "id": "libvirt-31" } { @@ -1759,11 +1853,11 @@ "enabled": false, "present": true }, - "id": "libvirt-30" + "id": "libvirt-32" } { - "id": "libvirt-31", + "id": "libvirt-33", "error": { "class": "CommandNotFound", "desc": "The command query-tpm-models has not been found" @@ -1771,7 +1865,7 @@ } { - "id": "libvirt-32", + "id": "libvirt-34", "error": { "class": "CommandNotFound", "desc": "The command query-tpm-types has not been found" @@ -1779,7 +1873,7 @@ } { - "id": "libvirt-33", + "id": "libvirt-35", "error": { "class": "CommandNotFound", "desc": "The command query-command-line-options has not been found" @@ -1793,5 +1887,5 @@ "state": false } ], - "id": "libvirt-34" + "id": "libvirt-36" } diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps index 9716cf5..09949f8 100644 --- a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps @@ -140,4 +140,7 @@ <flag name='usb-audio'/> <flag name='splash-timeout'/> <flag name='ivshmem'/> + <flag name='cirrus-vga.vgamem_mb'/> + <flag name='VGA.vgamem_mb'/> + <flag name='vmware-svga.vgamem_mb'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.replies b/tests/qemucapabilitiesdata/caps_1.5.3-1.replies index 4613472..6b84488 100644 --- a/tests/qemucapabilitiesdata/caps_1.5.3-1.replies +++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.replies @@ -1696,6 +1696,100 @@ { "return": [ { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-28" +} + +{ + "return": [ + { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "mmio", + "type": "on/off" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-29" +} + +{ + "return": [ + { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-30" +} + +{ + "return": [ + { "name": "pc-q35-1.4", "cpu-max": 255 }, @@ -1763,7 +1857,7 @@ "cpu-max": 1 } ], - "id": "libvirt-28" + "id": "libvirt-31" } { @@ -1841,7 +1935,7 @@ "name": "qemu64" } ], - "id": "libvirt-29" + "id": "libvirt-32" } { @@ -1849,19 +1943,19 @@ "enabled": false, "present": true }, - "id": "libvirt-30" + "id": "libvirt-33" } { "return": [ ], - "id": "libvirt-31" + "id": "libvirt-34" } { "return": [ ], - "id": "libvirt-32" + "id": "libvirt-35" } { @@ -2537,7 +2631,7 @@ "option": "drive" } ], - "id": "libvirt-33" + "id": "libvirt-36" } { @@ -2547,5 +2641,5 @@ "state": false } ], - "id": "libvirt-34" + "id": "libvirt-37" } diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps index a820cd4..fb3e6d4 100644 --- a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps @@ -146,4 +146,7 @@ <flag name='usb-audio'/> <flag name='splash-timeout'/> <flag name='ivshmem'/> + <flag name='cirrus-vga.vgamem_mb'/> + <flag name='VGA.vgamem_mb'/> + <flag name='vmware-svga.vgamem_mb'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.replies b/tests/qemucapabilitiesdata/caps_1.6.0-1.replies index 4205c89..15052be 100644 --- a/tests/qemucapabilitiesdata/caps_1.6.0-1.replies +++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.replies @@ -1758,6 +1758,100 @@ { "return": [ { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-28" +} + +{ + "return": [ + { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "mmio", + "type": "on/off" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-29" +} + +{ + "return": [ + { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-30" +} + +{ + "return": [ + { "name": "xenpv", "cpu-max": 1 }, @@ -1841,7 +1935,7 @@ "cpu-max": 1 } ], - "id": "libvirt-28" + "id": "libvirt-31" } { @@ -1919,7 +2013,7 @@ "name": "qemu64" } ], - "id": "libvirt-29" + "id": "libvirt-32" } { @@ -1927,19 +2021,19 @@ "enabled": false, "present": true }, - "id": "libvirt-30" + "id": "libvirt-33" } { "return": [ ], - "id": "libvirt-31" + "id": "libvirt-34" } { "return": [ ], - "id": "libvirt-32" + "id": "libvirt-35" } { @@ -2517,7 +2611,7 @@ "option": "drive" } ], - "id": "libvirt-33" + "id": "libvirt-36" } { @@ -2539,5 +2633,5 @@ "state": false } ], - "id": "libvirt-34" + "id": "libvirt-37" } diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps index f65b3f4..7d9f36e 100644 --- a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps +++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps @@ -146,4 +146,7 @@ <flag name='usb-audio'/> <flag name='splash-timeout'/> <flag name='ivshmem'/> + <flag name='cirrus-vga.vgamem_mb'/> + <flag name='VGA.vgamem_mb'/> + <flag name='vmware-svga.vgamem_mb'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.replies b/tests/qemucapabilitiesdata/caps_1.6.50-1.replies index 7582385..38074e5 100644 --- a/tests/qemucapabilitiesdata/caps_1.6.50-1.replies +++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.replies @@ -1722,6 +1722,100 @@ { "return": [ { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-28" +} + +{ + "return": [ + { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "mmio", + "type": "on/off" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-29" +} + +{ + "return": [ + { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-30" +} + +{ + "return": [ + { "name": "xenpv", "cpu-max": 1 }, @@ -1813,7 +1907,7 @@ "cpu-max": 1 } ], - "id": "libvirt-28" + "id": "libvirt-31" } { @@ -1891,7 +1985,7 @@ "name": "qemu64" } ], - "id": "libvirt-29" + "id": "libvirt-32" } { @@ -1899,19 +1993,19 @@ "enabled": false, "present": true }, - "id": "libvirt-30" + "id": "libvirt-33" } { "return": [ ], - "id": "libvirt-31" + "id": "libvirt-34" } { "return": [ ], - "id": "libvirt-32" + "id": "libvirt-35" } { @@ -2499,7 +2593,7 @@ "option": "drive" } ], - "id": "libvirt-33" + "id": "libvirt-36" } { @@ -2521,5 +2615,5 @@ "state": false } ], - "id": "libvirt-34" + "id": "libvirt-37" } diff --git a/tests/qemucapabilitiesdata/caps_2.1.1-1.caps b/tests/qemucapabilitiesdata/caps_2.1.1-1.caps index 7003ad8..dd8bb1a 100644 --- a/tests/qemucapabilitiesdata/caps_2.1.1-1.caps +++ b/tests/qemucapabilitiesdata/caps_2.1.1-1.caps @@ -161,4 +161,7 @@ <flag name='migrate-rdma'/> <flag name='ivshmem'/> <flag name='drive-iotune-max'/> + <flag name='cirrus-vga.vgamem_mb'/> + <flag name='VGA.vgamem_mb'/> + <flag name='vmware-svga.vgamem_mb'/> </qemuCaps> diff --git a/tests/qemucapabilitiesdata/caps_2.1.1-1.replies b/tests/qemucapabilitiesdata/caps_2.1.1-1.replies index 74d09dc..5e27ac5 100644 --- a/tests/qemucapabilitiesdata/caps_2.1.1-1.replies +++ b/tests/qemucapabilitiesdata/caps_2.1.1-1.replies @@ -2166,6 +2166,100 @@ } { + "return": [ + { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-28" +} + +{ + "return": [ + { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "mmio", + "type": "on/off" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-29" +} + +{ + "return": [ + { + "name": "command_serr_enable", + "type": "on/off" + }, + { + "name": "multifunction", + "type": "on/off" + }, + { + "name": "rombar", + "type": "uint32" + }, + { + "name": "romfile", + "type": "string" + }, + { + "name": "addr", + "type": "pci-devfn" + }, + { + "name": "vgamem_mb", + "type": "uint32" + } + ], + "id": "libvirt-30" +} + +{ "return": [ { "name": "pc-1.3", @@ -2275,7 +2369,7 @@ "cpu-max": 255 } ], - "id": "libvirt-28" + "id": "libvirt-31" } { @@ -2356,7 +2450,7 @@ "name": "qemu64" } ], - "id": "libvirt-29" + "id": "libvirt-32" } { @@ -2364,21 +2458,21 @@ "enabled": false, "present": true }, - "id": "libvirt-30" + "id": "libvirt-33" } { "return": [ "tpm-tis" ], - "id": "libvirt-31" + "id": "libvirt-34" } { "return": [ "passthrough" ], - "id": "libvirt-32" + "id": "libvirt-35" } { @@ -3238,7 +3332,7 @@ "option": "drive" } ], - "id": "libvirt-33" + "id": "libvirt-36" } { @@ -3260,5 +3354,5 @@ "capability": "zero-blocks" } ], - "id": "libvirt-34" + "id": "libvirt-37" } -- 2.0.4

On Fr, 2014-11-14 at 14:54 +0100, Pavel Hrdina wrote:
+static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsCirrusVga[] = { + { "vgamem_mb", QEMU_CAPS_CIRRUS_VGA_VGAMEM }, +};
Please don't touch vgamem_mb on cirrus. The only reason we have this property in the first place is live migration compatibility (default vga mem used to be 8MB, but is 16 MB on recent machine types). cheers, Gerd

On 11/14/2014 04:03 PM, Gerd Hoffmann wrote:
On Fr, 2014-11-14 at 14:54 +0100, Pavel Hrdina wrote:
+static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsCirrusVga[] = { + { "vgamem_mb", QEMU_CAPS_CIRRUS_VGA_VGAMEM }, +};
Please don't touch vgamem_mb on cirrus. The only reason we have this property in the first place is live migration compatibility (default vga mem used to be 8MB, but is 16 MB on recent machine types).
cheers, Gerd
So you are saying that we should not allow setting the 'vgamem_mb' for cirrus? Is there any reason for that? Pavel

On Fr, 2014-11-14 at 16:15 +0100, Pavel Hrdina wrote:
On 11/14/2014 04:03 PM, Gerd Hoffmann wrote:
On Fr, 2014-11-14 at 14:54 +0100, Pavel Hrdina wrote:
+static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsCirrusVga[] = { + { "vgamem_mb", QEMU_CAPS_CIRRUS_VGA_VGAMEM }, +};
Please don't touch vgamem_mb on cirrus. The only reason we have this property in the first place is live migration compatibility (default vga mem used to be 8MB, but is 16 MB on recent machine types).
cheers, Gerd
So you are saying that we should not allow setting the 'vgamem_mb' for cirrus?
Yes.
Is there any reason for that?
We mimic real hardware, and video memory isn't configurable there. That we have 8 and 16 mb variants in the first place is not correct, the only reason we still have that is fixing it breaks live migration. cheers, Gerd

On 11/14/2014 04:24 PM, Gerd Hoffmann wrote:
On Fr, 2014-11-14 at 16:15 +0100, Pavel Hrdina wrote:
On 11/14/2014 04:03 PM, Gerd Hoffmann wrote:
On Fr, 2014-11-14 at 14:54 +0100, Pavel Hrdina wrote:
+static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsCirrusVga[] = { + { "vgamem_mb", QEMU_CAPS_CIRRUS_VGA_VGAMEM }, +};
Please don't touch vgamem_mb on cirrus. The only reason we have this property in the first place is live migration compatibility (default vga mem used to be 8MB, but is 16 MB on recent machine types).
cheers, Gerd
So you are saying that we should not allow setting the 'vgamem_mb' for cirrus?
Yes.
Is there any reason for that?
We mimic real hardware, and video memory isn't configurable there. That we have 8 and 16 mb variants in the first place is not correct, the only reason we still have that is fixing it breaks live migration.
cheers, Gerd
Ok, in that case we will continue ignoring the vram settings for cirrus. Pavel

So far we hadn't any option to set video memory size for qemu video devices. There were only vram (ram for QXL) attribute but it was valid only for QXL video device. To provide this feature to users qemu has dedicated device attribute called 'vgamem_mb' to set the video memory size. We will use the 'vram' attribute also for setting video memory size for other qemu video devices. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1076098 Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/qemu/qemu_command.c | 36 ++++++++++++++++++++++ .../qemuxml2argv-video-qxl-device-vgamem.args | 6 ++++ .../qemuxml2argv-video-qxl-device-vgamem.xml | 29 +++++++++++++++++ .../qemuxml2argv-video-qxl-device.args | 6 ++++ .../qemuxml2argv-video-qxl-device.xml | 29 +++++++++++++++++ .../qemuxml2argv-video-qxl-nodevice.args | 5 +++ .../qemuxml2argv-video-qxl-nodevice.xml | 29 +++++++++++++++++ .../qemuxml2argv-video-qxl-sec-device-vgamem.args | 8 +++++ .../qemuxml2argv-video-qxl-sec-device-vgamem.xml | 32 +++++++++++++++++++ .../qemuxml2argv-video-qxl-sec-device.args | 7 +++++ .../qemuxml2argv-video-qxl-sec-device.xml | 32 +++++++++++++++++++ .../qemuxml2argv-video-qxl-sec-nodevice.xml | 32 +++++++++++++++++++ .../qemuxml2argv-video-vga-device-vgamem.args | 6 ++++ .../qemuxml2argv-video-vga-device-vgamem.xml | 29 +++++++++++++++++ .../qemuxml2argv-video-vga-device.args | 6 ++++ .../qemuxml2argv-video-vga-device.xml | 29 +++++++++++++++++ .../qemuxml2argv-video-vga-nodevice.args | 5 +++ .../qemuxml2argv-video-vga-nodevice.xml | 29 +++++++++++++++++ tests/qemuxml2argvtest.c | 16 ++++++++++ tools/virsh-domain.c | 4 ++- 20 files changed, 374 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-nodevice.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d6154a4..0b61176 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5030,6 +5030,21 @@ qemuBuildDeviceVideoStr(virDomainDefPtr def, /* QEMU accepts bytes for vram_size. */ virBufferAsprintf(&buf, ",vram_size=%u", video->vram * 1024); + } else if (video->vram && + ((video->type == VIR_DOMAIN_VIDEO_TYPE_CIRRUS && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_CIRRUS_VGA_VGAMEM)) || + (video->type == VIR_DOMAIN_VIDEO_TYPE_VGA && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_VGAMEM)) || + (video->type == VIR_DOMAIN_VIDEO_TYPE_VMVGA && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_VMWARE_SVGA_VGAMEM)))) { + + if (video->vram % 1024) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("value for 'vram' must be multiple of 1024")); + goto error; + } + + virBufferAsprintf(&buf, ",vgamem_mb=%u", video->vram / 1024); } if (qemuBuildDeviceAddressStr(&buf, def, &video->info, qemuCaps) < 0) @@ -9361,6 +9376,27 @@ qemuBuildCommandLine(virConnectPtr conn, dev, vram * 1024); } } + + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE) && + def->videos[0]->vram && + ((primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_CIRRUS && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_CIRRUS_VGA_VGAMEM)) || + (primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_VGA && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_VGAMEM)) || + (primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_VMVGA && + virQEMUCapsGet(qemuCaps, QEMU_CAPS_VMWARE_SVGA_VGAMEM)))) { + unsigned int vram = def->videos[0]->vram; + + if (vram % 1024) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("value for 'vgamem' must be multiple of 1024")); + goto error; + } + + virCommandAddArg(cmd, "-global"); + virCommandAddArgFormat(cmd, "%s.vgamem_mb=%u", + dev, vram / 1024); + } } if (def->nvideos > 1) { diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.args b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.args new file mode 100644 index 0000000..c9eb535 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.args @@ -0,0 +1,6 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu -S -M pc -m 1024 -smp 1 -nographic -nodefaults \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ +-hda /var/lib/libvirt/images/QEMUGuest1 \ +-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,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-vgamem.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.xml new file mode 100644 index 0000000..9fc42af --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device-vgamem.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='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> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.args b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.args new file mode 100644 index 0000000..c9eb535 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.args @@ -0,0 +1,6 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu -S -M pc -m 1024 -smp 1 -nographic -nodefaults \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ +-hda /var/lib/libvirt/images/QEMUGuest1 \ +-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,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.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.xml new file mode 100644 index 0000000..9fc42af --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-device.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='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> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.args b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.args new file mode 100644 index 0000000..a6ac6d8 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.args @@ -0,0 +1,5 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu -S -M pc -m 1024 -smp 1 -nographic \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ +-hda /var/lib/libvirt/images/QEMUGuest1 -net none -serial none -parallel none \ +-vga qxl diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.xml new file mode 100644 index 0000000..9fc42af --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-nodevice.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='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> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.args b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.args new file mode 100644 index 0000000..5fc41bb --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.args @@ -0,0 +1,8 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu -S -M pc -m 1024 -smp 1 -nographic -nodefaults \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ +-hda /var/lib/libvirt/images/QEMUGuest1 \ +-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0\ +,addr=0x2 -device qxl,id=video1,ram_size=67108864,vram_size=67108864,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-vgamem.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.xml new file mode 100644 index 0000000..0868f39 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device-vgamem.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' heads='1'/> + </video> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.args b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.args new file mode 100644 index 0000000..208408e --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.args @@ -0,0 +1,7 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu -S -M pc -m 1024 -smp 1 -nographic -nodefaults \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ +-hda /var/lib/libvirt/images/QEMUGuest1 \ +-device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0\ +,addr=0x2 -device qxl,id=video1,ram_size=67108864,vram_size=67108864,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.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.xml new file mode 100644 index 0000000..0868f39 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-device.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' heads='1'/> + </video> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-nodevice.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-nodevice.xml new file mode 100644 index 0000000..0868f39 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-qxl-sec-nodevice.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' heads='1'/> + </video> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.args b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.args new file mode 100644 index 0000000..81e4aec --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.args @@ -0,0 +1,6 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu -S -M pc -m 1024 -smp 1 -nographic -nodefaults \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ +-hda /var/lib/libvirt/images/QEMUGuest1 \ +-device VGA,id=video0,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-vga-device-vgamem.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.xml new file mode 100644 index 0000000..9b1ddfc --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device-vgamem.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='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='vga' vram='16384' heads='1'/> + </video> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.args b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.args new file mode 100644 index 0000000..f822280 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.args @@ -0,0 +1,6 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu -S -M pc -m 1024 -smp 1 -nographic -nodefaults \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ +-hda /var/lib/libvirt/images/QEMUGuest1 \ +-device VGA,id=video0,bus=pci.0,addr=0x2 \ +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.xml new file mode 100644 index 0000000..9b1ddfc --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-device.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='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='vga' vram='16384' heads='1'/> + </video> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.args b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.args new file mode 100644 index 0000000..7b5f151 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.args @@ -0,0 +1,5 @@ +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \ +/usr/bin/qemu -S -M pc -m 1024 -smp 1 -nographic \ +-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \ +-hda /var/lib/libvirt/images/QEMUGuest1 -net none -serial none -parallel none \ +-vga std diff --git a/tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.xml b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.xml new file mode 100644 index 0000000..9b1ddfc --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-video-vga-nodevice.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='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='vga' vram='16384' heads='1'/> + </video> + <memballoon model='virtio'/> + </devices> +</domain> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 623237b..153af94 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1348,6 +1348,22 @@ mymain(void) QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_QXL_VGA, QEMU_CAPS_DEVICE_PCI_BRIDGE); + DO_TEST("video-vga-nodevice", QEMU_CAPS_VGA); + DO_TEST("video-vga-device", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VGA, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY); + DO_TEST("video-vga-device-vgamem", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VGA, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VGA_VGAMEM); + DO_TEST("video-qxl-nodevice", QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL); + DO_TEST("video-qxl-device", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_QXL_VGA, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY); + DO_TEST("video-qxl-device-vgamem", QEMU_CAPS_DEVICE, + QEMU_CAPS_DEVICE_QXL_VGA, QEMU_CAPS_DEVICE_VIDEO_PRIMARY); + DO_TEST_FAILURE("video-qxl-sec-nodevice", QEMU_CAPS_VGA, QEMU_CAPS_VGA_QXL); + DO_TEST("video-qxl-sec-device", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_QXL_VGA, + QEMU_CAPS_DEVICE_QXL, QEMU_CAPS_DEVICE_VIDEO_PRIMARY); + DO_TEST("video-qxl-sec-device-vgamem", QEMU_CAPS_DEVICE, + QEMU_CAPS_DEVICE_QXL_VGA, QEMU_CAPS_DEVICE_QXL, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY); DO_TEST("virtio-rng-default", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM); diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 541363d..916a28d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2560,8 +2560,10 @@ cmdBlockPull(vshControl *ctl, const vshCmd *cmd) vshError(ctl, _("failed to query job for disk %s"), path); goto cleanup; } - if (result == 0) + if (result == 0) { + quit = true; break; + } if (verbose) vshPrintJobProgress(_("Block Pull"), info.end - info.cur, info.end); -- 2.0.4

On Fr, 2014-11-14 at 14:54 +0100, Pavel Hrdina wrote:
+ if (video->vram % 1024) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("value for 'vram' must be multiple of 1024")); + goto error; + }
pci bar size must be a power of two. Especially the 9216 default value libvirt fills in there is *not* valid. This probably needs some extra care to handle so existing guest xml files don't blow up things. cheers, Gerd

On 11/14/2014 04:06 PM, Gerd Hoffmann wrote:
On Fr, 2014-11-14 at 14:54 +0100, Pavel Hrdina wrote:
+ if (video->vram % 1024) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("value for 'vram' must be multiple of 1024")); + goto error; + }
pci bar size must be a power of two. Especially the 9216 default value libvirt fills in there is *not* valid. This probably needs some extra care to handle so existing guest xml files don't blow up things.
cheers, Gerd
Default value for QXL is 64MB in libvirt, the 9MB is for other video devices. But we can probably add a special check for QXL device to ensure that ram or vram size is power of 2. Pavel

On Fr, 2014-11-14 at 16:13 +0100, Pavel Hrdina wrote:
On 11/14/2014 04:06 PM, Gerd Hoffmann wrote:
On Fr, 2014-11-14 at 14:54 +0100, Pavel Hrdina wrote:
+ if (video->vram % 1024) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("value for 'vram' must be multiple of 1024")); + goto error; + }
pci bar size must be a power of two. Especially the 9216 default value libvirt fills in there is *not* valid. This probably needs some extra care to handle so existing guest xml files don't blow up things.
cheers, Gerd
Default value for QXL is 64MB in libvirt, the 9MB is for other video devices. But we can probably add a special check for QXL device to ensure that ram or vram size is power of 2.
For stdvga and vmware vga it must be a power of two too. cheers, Gerd

On 11/14/2014 04:25 PM, Gerd Hoffmann wrote:
On Fr, 2014-11-14 at 16:13 +0100, Pavel Hrdina wrote:
On 11/14/2014 04:06 PM, Gerd Hoffmann wrote:
On Fr, 2014-11-14 at 14:54 +0100, Pavel Hrdina wrote:
+ if (video->vram % 1024) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("value for 'vram' must be multiple of 1024")); + goto error; + }
pci bar size must be a power of two. Especially the 9216 default value libvirt fills in there is *not* valid. This probably needs some extra care to handle so existing guest xml files don't blow up things.
cheers, Gerd
Default value for QXL is 64MB in libvirt, the 9MB is for other video devices. But we can probably add a special check for QXL device to ensure that ram or vram size is power of 2.
For stdvga and vmware vga it must be a power of two too.
cheers, Gerd
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
We cannot just start enforcing that the vram attribute should be power of 2. We can ether silently modify the value from user to power of 2 or let QEMU round the value up to nearest power of 2 value and just add a note about this to documentation. Pavel

Hi,
We cannot just start enforcing that the vram attribute should be power of 2. We can ether silently modify the value from user to power of 2 or let QEMU round the value up to nearest power of 2 value and just add a note about this to documentation.
How about simply ignoring vram in case it has a invalid value? This way current behavior is maintained for existing xml files (not pass anything and let qemu use the defaults). Whenever libvirt applies fixups to the xml (like adding pci controllers to old xml configs, as done on "virsh edit" for example) libvirt can also fixup vram to have a valid value. cheers, Gerd

On 11/17/2014 08:48 AM, Gerd Hoffmann wrote:
Hi,
We cannot just start enforcing that the vram attribute should be power of 2. We can ether silently modify the value from user to power of 2 or let QEMU round the value up to nearest power of 2 value and just add a note about this to documentation.
How about simply ignoring vram in case it has a invalid value? This way current behavior is maintained for existing xml files (not pass anything and let qemu use the defaults).
Whenever libvirt applies fixups to the xml (like adding pci controllers to old xml configs, as done on "virsh edit" for example) libvirt can also fixup vram to have a valid value.
cheers, Gerd
Yes, fix the value to the next higher power of 2 is a solution. I've checked the QEMU source code and it's done on your part since the vgamem anyway so it's probable safe to do it also on our side for QEMU. Pavel

Hi,
The 'vgamem_mb' parameter for QXL sets the VGA framebuffer size, but the VGA mode in QXL is used only as fallback if the OS doesn't have any QXL drivers or before the drivers are loaded. The VGA framebuffer is part of the first ram for QXL and for that we have 'ram' attribute. The rest of the first ram is memory for rendering commands and it's data. Default VGA framebuffer size is 8MB which is sufficient.
It isn't that simple. The vga framebuffer can be used as as video memory in non-vga mode too. Guest driver can choose whenever it uses the vga framebuffer or vram bar. Traditional behavior is to use the vga framebuffer, in fact very old qxl device revisions don't have a vram pci bar in the first place. Because of that vgamem_mb should be configurable on qxl too. cheers, Gerd

On 11/14/2014 04:00 PM, Gerd Hoffmann wrote:
Hi,
The 'vgamem_mb' parameter for QXL sets the VGA framebuffer size, but the VGA mode in QXL is used only as fallback if the OS doesn't have any QXL drivers or before the drivers are loaded. The VGA framebuffer is part of the first ram for QXL and for that we have 'ram' attribute. The rest of the first ram is memory for rendering commands and it's data. Default VGA framebuffer size is 8MB which is sufficient.
It isn't that simple. The vga framebuffer can be used as as video memory in non-vga mode too. Guest driver can choose whenever it uses the vga framebuffer or vram bar.
Traditional behavior is to use the vga framebuffer, in fact very old qxl device revisions don't have a vram pci bar in the first place. Because of that vgamem_mb should be configurable on qxl too.
cheers, Gerd
Hi Gerd, I thought that it isn't that simple. Thanks for the clarification. The goal of those patches is to have only one 'vram' attribute in libvirt's XML and it should be used to set the size of video memory for different video devices for different hypervisors. It's simple for all QEMU video devices except the QXL where you can set 3 different parameters. That's probably good point to also introduce a way to set the] 'vgamem_mb' for QXL.
participants (2)
-
Gerd Hoffmann
-
Pavel Hrdina