1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

qemu: add virtio video device

qemu 2.5 provides virtio video device.  It can be used with -device
virtio-vga for primary devices, or -device virtio-gpu for non-vga
devices. However, only the primary device (VGA) is supported with this
patch.

Reference:
https://bugzilla.redhat.com/show_bug.cgi?id=1195176

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Marc-André Lureau 2015-11-25 09:42:32 +01:00 committed by Michal Privoznik
parent 806ae49933
commit 21373feb4e
15 changed files with 4200 additions and 7 deletions

View File

@ -5153,8 +5153,9 @@ qemu-kvm -net nic,model=? /dev/null
<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.
"vbox", "qxl" (<span class="since">since 0.8.6</span>) or
"virtio" (<span class="since">since 1.3.0</span>)
depending on the hypervisor features available.
</p>
<p>
You can provide the amount of video memory in kibibytes (blocks of

View File

@ -2921,6 +2921,7 @@
<value>vmvga</value>
<value>xen</value>
<value>vbox</value>
<value>virtio</value>
</choice>
</attribute>
<group>

View File

@ -538,7 +538,8 @@ VIR_ENUM_IMPL(virDomainVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
"xen",
"vbox",
"qxl",
"parallels")
"parallels",
"virtio")
VIR_ENUM_IMPL(virDomainInput, VIR_DOMAIN_INPUT_TYPE_LAST,
"mouse",

View File

@ -1374,6 +1374,7 @@ typedef enum {
VIR_DOMAIN_VIDEO_TYPE_VBOX,
VIR_DOMAIN_VIDEO_TYPE_QXL,
VIR_DOMAIN_VIDEO_TYPE_PARALLELS, /* pseudo device for VNC in containers */
VIR_DOMAIN_VIDEO_TYPE_VIRTIO,
VIR_DOMAIN_VIDEO_TYPE_LAST
} virDomainVideoType;

View File

@ -301,6 +301,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"gic-version",
"incoming-defer", /* 200 */
"virtio-gpu",
);
@ -1543,6 +1544,8 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{ "virtio-net-ccw", QEMU_CAPS_DEVICE_VIRTIO_NET },
{ "virtio-net-s390", QEMU_CAPS_DEVICE_VIRTIO_NET },
{ "virtio-net-device", QEMU_CAPS_DEVICE_VIRTIO_NET },
{ "virtio-gpu-pci", QEMU_CAPS_DEVICE_VIRTIO_GPU },
{ "virtio-gpu-device", QEMU_CAPS_DEVICE_VIRTIO_GPU },
};
static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {

View File

@ -327,6 +327,7 @@ typedef enum {
/* 200 */
QEMU_CAPS_INCOMING_DEFER, /* -incoming defer and migrate_incoming */
QEMU_CAPS_DEVICE_VIRTIO_GPU, /* -device virtio-gpu-* & virtio-vga */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;

View File

@ -104,7 +104,8 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
"", /* no arg needed for xen */
"", /* don't support vbox */
"qxl",
"" /* don't support parallels */);
"", /* don't support parallels */
"" /* no need for virtio */);
VIR_ENUM_DECL(qemuDeviceVideo)
@ -115,7 +116,8 @@ VIR_ENUM_IMPL(qemuDeviceVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
"", /* no device for xen */
"", /* don't support vbox */
"qxl-vga",
"" /* don't support parallels */);
"", /* don't support parallels */
"virtio-vga");
VIR_ENUM_DECL(qemuSoundCodec)
@ -10510,8 +10512,10 @@ qemuBuildCommandLine(virConnectPtr conn,
(primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_VMVGA &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMWARE_SVGA)) ||
(primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_QXL &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL_VGA)))
) {
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL_VGA)) ||
(primaryVideoType == VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU)))
) {
for (i = 0; i < def->nvideos; i++) {
char *str;
virCommandAddArg(cmd, "-device");

View File

@ -162,4 +162,5 @@
<flag name='e1000'/>
<flag name='virtio-net'/>
<flag name='incoming-defer'/>
<flag name='virtio-gpu'/>
</qemuCaps>

View File

@ -0,0 +1,166 @@
<qemuCaps>
<flag name='mem-path'/>
<flag name='drive-serial'/>
<flag name='chardev'/>
<flag name='enable-kvm'/>
<flag name='monitor-json'/>
<flag name='balloon'/>
<flag name='device'/>
<flag name='sdl'/>
<flag name='smp-topology'/>
<flag name='netdev'/>
<flag name='rtc'/>
<flag name='vhost-net'/>
<flag name='no-hpet'/>
<flag name='no-kvm-pit'/>
<flag name='pci-configfd'/>
<flag name='nodefconfig'/>
<flag name='boot-menu'/>
<flag name='fsdev'/>
<flag name='name-process'/>
<flag name='drive-readonly'/>
<flag name='smbios-type'/>
<flag name='vga-qxl'/>
<flag name='spice'/>
<flag name='vga-none'/>
<flag name='boot-index'/>
<flag name='hda-duplex'/>
<flag name='drive-aio'/>
<flag name='pci-multibus'/>
<flag name='pci-bootindex'/>
<flag name='ccid-passthru'/>
<flag name='chardev-spicevmc'/>
<flag name='virtio-tx-alg'/>
<flag name='device-qxl-vga'/>
<flag name='pci-multifunction'/>
<flag name='virtio-blk-pci.ioeventfd'/>
<flag name='sga'/>
<flag name='virtio-blk-pci.event_idx'/>
<flag name='virtio-net-pci.event_idx'/>
<flag name='cache-directsync'/>
<flag name='piix3-usb-uhci'/>
<flag name='piix4-usb-uhci'/>
<flag name='usb-ehci'/>
<flag name='ich9-usb-ehci1'/>
<flag name='vt82c686b-usb-uhci'/>
<flag name='pci-ohci'/>
<flag name='usb-redir'/>
<flag name='usb-hub'/>
<flag name='no-shutdown'/>
<flag name='cache-unsafe'/>
<flag name='rombar'/>
<flag name='ich9-ahci'/>
<flag name='no-acpi'/>
<flag name='fsdev-readonly'/>
<flag name='virtio-blk-pci.scsi'/>
<flag name='blk-sg-io'/>
<flag name='drive-copy-on-read'/>
<flag name='cpu-host'/>
<flag name='fsdev-writeout'/>
<flag name='drive-iotune'/>
<flag name='system_wakeup'/>
<flag name='scsi-disk.channel'/>
<flag name='scsi-block'/>
<flag name='transaction'/>
<flag name='block-job-async'/>
<flag name='scsi-cd'/>
<flag name='ide-cd'/>
<flag name='no-user-config'/>
<flag name='hda-micro'/>
<flag name='dump-guest-memory'/>
<flag name='nec-usb-xhci'/>
<flag name='balloon-event'/>
<flag name='bridge'/>
<flag name='lsi'/>
<flag name='virtio-scsi-pci'/>
<flag name='blockio'/>
<flag name='disable-s3'/>
<flag name='disable-s4'/>
<flag name='usb-redir.filter'/>
<flag name='ide-drive.wwn'/>
<flag name='scsi-disk.wwn'/>
<flag name='seccomp-sandbox'/>
<flag name='dump-guest-core'/>
<flag name='seamless-migration'/>
<flag name='block-commit'/>
<flag name='vnc'/>
<flag name='drive-mirror'/>
<flag name='usb-redir.bootindex'/>
<flag name='usb-host.bootindex'/>
<flag name='blockdev-snapshot-sync'/>
<flag name='qxl'/>
<flag name='VGA'/>
<flag name='cirrus-vga'/>
<flag name='vmware-svga'/>
<flag name='device-video-primary'/>
<flag name='usb-serial'/>
<flag name='usb-net'/>
<flag name='add-fd'/>
<flag name='nbd-server'/>
<flag name='virtio-rng'/>
<flag name='rng-random'/>
<flag name='rng-egd'/>
<flag name='dtb'/>
<flag name='megasas'/>
<flag name='ipv6-migration'/>
<flag name='machine-opt'/>
<flag name='machine-usb-opt'/>
<flag name='tpm-passthrough'/>
<flag name='tpm-tis'/>
<flag name='pci-bridge'/>
<flag name='vfio-pci'/>
<flag name='vfio-pci.bootindex'/>
<flag name='scsi-generic'/>
<flag name='scsi-generic.bootindex'/>
<flag name='mem-merge'/>
<flag name='vnc-websocket'/>
<flag name='drive-discard'/>
<flag name='mlock'/>
<flag name='vnc-share-policy'/>
<flag name='device-del-event'/>
<flag name='dmi-to-pci-bridge'/>
<flag name='i440fx-pci-hole64-size'/>
<flag name='q35-pci-hole64-size'/>
<flag name='usb-storage'/>
<flag name='usb-storage.removable'/>
<flag name='virtio-mmio'/>
<flag name='ich9-intel-hda'/>
<flag name='kvm-pit-lost-tick-policy'/>
<flag name='boot-strict'/>
<flag name='pvpanic'/>
<flag name='reboot-timeout'/>
<flag name='spice-file-xfer-disable'/>
<flag name='spiceport'/>
<flag name='usb-kbd'/>
<flag name='host-pci-multidomain'/>
<flag name='msg-timestamp'/>
<flag name='active-commit'/>
<flag name='change-backing-file'/>
<flag name='memory-backend-ram'/>
<flag name='memory-backend-file'/>
<flag name='numa'/>
<flag name='usb-audio'/>
<flag name='rtc-reset-reinjection'/>
<flag name='splash-timeout'/>
<flag name='iothread'/>
<flag name='migrate-rdma'/>
<flag name='ivshmem'/>
<flag name='drive-iotune-max'/>
<flag name='VGA.vgamem_mb'/>
<flag name='vmware-svga.vgamem_mb'/>
<flag name='qxl.vgamem_mb'/>
<flag name='qxl-vga.vgamem_mb'/>
<flag name='pc-dimm'/>
<flag name='machine-vmport-opt'/>
<flag name='pci-serial'/>
<flag name='ioh3420'/>
<flag name='vhost-user-multiqueue'/>
<flag name='migration-event'/>
<flag name='x3130-upstream'/>
<flag name='xio3130-downstream'/>
<flag name='rtl8139'/>
<flag name='e1000'/>
<flag name='virtio-net'/>
<flag name='incoming-defer'/>
<flag name='virtio-gpu'/>
</qemuCaps>

File diff suppressed because it is too large Load Diff

View File

@ -191,6 +191,7 @@ mymain(void)
DO_TEST("caps_1.6.50-1");
DO_TEST("caps_2.1.1-1");
DO_TEST("caps_2.4.0-1");
DO_TEST("caps_2.5.0-1");
qemuTestDriverFree(&driver);

View File

@ -0,0 +1,24 @@
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,if=none,id=drive-ide0-0-0,\
format=qcow2,cache=none \
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
-device virtio-vga,id=video0,bus=pci.0,addr=0x2 \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

View File

@ -0,0 +1,31 @@
<domain type='qemu'>
<name>QEMUGuest1</name>
<uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<vcpu placement='static'>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'/>
<controller type='usb' index='0'/>
<controller type='pci' index='0' model='pci-root'/>
<video>
<model type='virtio' heads='1'/>
</video>
<memballoon model='virtio'/>
</devices>
</domain>

View File

@ -1425,6 +1425,9 @@ mymain(void)
QEMU_CAPS_DEVICE_QXL_VGA, QEMU_CAPS_DEVICE_QXL,
QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_QXL_VGA_VGAMEM,
QEMU_CAPS_QXL_VGAMEM);
DO_TEST("video-virtio-gpu-device",
QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIRTIO_GPU,
QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
DO_TEST_PARSE_ERROR("video-invalid", NONE);
DO_TEST("virtio-rng-default", QEMU_CAPS_DEVICE, QEMU_CAPS_DEVICE_VIRTIO_RNG,

View File

@ -630,6 +630,8 @@ mymain(void)
DO_TEST("memory-hotplug-dimm");
DO_TEST("net-udp");
DO_TEST("video-virtio-gpu-device");
qemuTestDriverFree(&driver);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;