From nobody Wed May 14 00:37:45 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1530188156505268.5076740320832; Thu, 28 Jun 2018 05:15:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0B8623082278; Thu, 28 Jun 2018 12:15:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 97626106223F; Thu, 28 Jun 2018 12:15:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id ED09718037F0; Thu, 28 Jun 2018 12:15:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5SCFBDv011190 for ; Thu, 28 Jun 2018 08:15:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id 691DB2026D6C; Thu, 28 Jun 2018 12:15:11 +0000 (UTC) Received: from beluga.usersys.redhat.com (unknown [10.43.2.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id C5A742026D69; Thu, 28 Jun 2018 12:15:10 +0000 (UTC) From: Erik Skultety To: libvir-list@redhat.com Date: Thu, 28 Jun 2018 14:15:02 +0200 Message-Id: <8f0ea6750227b2ab278b46edad9a25483dce9b36.1530187618.git.eskultet@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Erik Skultety Subject: [libvirt] [PATCH 5/5] conf: Introduce new video type 'none' X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 28 Jun 2018 12:15:55 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Historically, we've always enabled an emulated video device every time we see that graphics should be supported with a guest. With the appearance of mediated devices which can support QEMU's vfio-display capability, users might want to use such a device as the only video device. Therefore introduce a new, effectively a 'disable', type for video device. Signed-off-by: Erik Skultety --- docs/formatdomain.html.in | 10 +++- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 55 ++++++++++++++++--= ---- src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 13 +++-- src/qemu/qemu_domain.c | 3 ++ src/qemu/qemu_domain_address.c | 10 ++++ tests/domaincapsschemadata/full.xml | 1 + .../video-invalid-multiple-devices.xml | 33 +++++++++++++ tests/qemuxml2argvdata/video-none-device.args | 27 +++++++++++ tests/qemuxml2argvdata/video-none-device.xml | 39 +++++++++++++++ tests/qemuxml2argvtest.c | 4 +- tests/qemuxml2xmloutdata/video-none-device.xml | 42 +++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 14 files changed, 219 insertions(+), 21 deletions(-) create mode 100644 tests/qemuxml2argvdata/video-invalid-multiple-devices.x= ml create mode 100644 tests/qemuxml2argvdata/video-none-device.args create mode 100644 tests/qemuxml2argvdata/video-none-device.xml create mode 100644 tests/qemuxml2xmloutdata/video-none-device.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index f45eee6812..2e8196c21f 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6639,9 +6639,15 @@ qemu-kvm -net nic,model=3D? /dev/null The model element has a mandatory type attribute which takes the value "vga", "cirrus", "vmvga", "xen", "vbox", "qxl" (since 0.8.6), - "virtio" (since 1.3.0) - or "gop" (since 3.2.0) + "virtio" (since 1.3.0), + "gop" (since 3.2.0), or + "none" (since 4.6.0) depending on the hypervisor features available. + Note that type "none" is currently only available f= or + QEMU and the intended use case is to prevent libvirt from adding= a + default emulated video card in case a host device like mdev shou= ld + handle the rendering, see also + Graphical framebuffers.

You can provide the amount of video memory in kibibytes (blocks = of diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 1df479cda2..55da8c079b 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3468,6 +3468,7 @@ vbox virtio gop + none diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 96ab6cf520..cd2a6c991c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -589,7 +589,8 @@ VIR_ENUM_IMPL(virDomainVideo, VIR_DOMAIN_VIDEO_TYPE_LAS= T, "qxl", "parallels", "virtio", - "gop") + "gop", + "none") =20 VIR_ENUM_IMPL(virDomainVideoVGAConf, VIR_DOMAIN_VIDEO_VGACONF_LAST, "io", @@ -5125,25 +5126,48 @@ static int virDomainDefPostParseVideo(virDomainDefPtr def, void *opaque) { + size_t i; + if (def->nvideos =3D=3D 0) return 0; =20 - virDomainDeviceDef device =3D { - .type =3D VIR_DOMAIN_DEVICE_VIDEO, - .data.video =3D def->videos[0], - }; - - /* Mark the first video as primary. If the user specified - * primary=3D"yes", the parser already inserted the device at - * def->videos[0] + /* it doesn't make sense to pair video device type 'none' with any oth= er + * types, there can be only a single video device in such case */ - def->videos[0]->primary =3D true; + for (i =3D 0; i < def->nvideos; i++) { + if (def->videos[i]->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_NONE && + def->nvideos > 1) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("video device type=3D'none' cannot be paired " + "with any other video device types")); + return -1; + } + } =20 - /* videos[0] might have been added in AddImplicitDevices, after we've - * done the per-device post-parse */ - if (virDomainDefPostParseDeviceIterator(def, &device, - NULL, opaque) < 0) - return -1; + if (def->videos[0]->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_NONE) { + /* we don't want to format any values we automatically fill in for + * videos into the XML, so clear them + */ + virDomainVideoDefClear(def->videos[0]); + def->videos[0]->type =3D VIR_DOMAIN_VIDEO_TYPE_NONE; + } else { + virDomainDeviceDef device =3D { + .type =3D VIR_DOMAIN_DEVICE_VIDEO, + .data.video =3D def->videos[0], + }; + + /* Mark the first video as primary. If the user specified + * primary=3D"yes", the parser already inserted the device at + * def->videos[0] + */ + def->videos[0]->primary =3D true; + + /* videos[0] might have been added in AddImplicitDevices, after we= 've + * done the per-device post-parse */ + if (virDomainDefPostParseDeviceIterator(def, &device, + NULL, opaque) < 0) + return -1; + } =20 return 0; } @@ -15093,6 +15117,7 @@ virDomainVideoDefaultRAM(const virDomainDef *def, case VIR_DOMAIN_VIDEO_TYPE_PARALLELS: case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: case VIR_DOMAIN_VIDEO_TYPE_GOP: + case VIR_DOMAIN_VIDEO_TYPE_NONE: case VIR_DOMAIN_VIDEO_TYPE_LAST: default: return 0; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 6d73a0b5d3..c1970e0f62 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1424,6 +1424,7 @@ typedef enum { VIR_DOMAIN_VIDEO_TYPE_PARALLELS, /* pseudo device for VNC in container= s */ VIR_DOMAIN_VIDEO_TYPE_VIRTIO, VIR_DOMAIN_VIDEO_TYPE_GOP, + VIR_DOMAIN_VIDEO_TYPE_NONE, =20 VIR_DOMAIN_VIDEO_TYPE_LAST } virDomainVideoType; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a2a27b5b9b..bc798f9d2d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -105,7 +105,8 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, "qxl", "", /* don't support parallels */ "", /* no need for virtio */ - "" /* don't support gop */); + "" /* don't support gop */, + "none" /* no display */); =20 VIR_ENUM_DECL(qemuDeviceVideo) =20 @@ -119,7 +120,8 @@ VIR_ENUM_IMPL(qemuDeviceVideo, VIR_DOMAIN_VIDEO_TYPE_LA= ST, "qxl-vga", "", /* don't support parallels */ "virtio-vga", - "" /* don't support gop */); + "" /* don't support gop */, + "none" /* no display */); =20 VIR_ENUM_DECL(qemuDeviceVideoSecondary) =20 @@ -133,7 +135,8 @@ VIR_ENUM_IMPL(qemuDeviceVideoSecondary, VIR_DOMAIN_VIDE= O_TYPE_LAST, "qxl", "", /* don't support parallels */ "virtio-gpu", - "" /* don't support gop */); + "" /* don't support gop */, + "" /* 'none' doesn't make sense here */); =20 VIR_ENUM_DECL(qemuSoundCodec) =20 @@ -4421,6 +4424,10 @@ qemuBuildVideoCommandLine(virCommandPtr cmd, char *str =3D NULL; virDomainVideoDefPtr video =3D def->videos[i]; =20 + /* no cmdline needed for type 'none' */ + if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_NONE) + return 0; + if (video->primary) { if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY)) { =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 42b7635ef4..51aba8d527 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4444,6 +4444,9 @@ static int qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video) { switch ((virDomainVideoType) video->type) { + case VIR_DOMAIN_VIDEO_TYPE_NONE: + /* nothing to be validated for 'none' */ + return 0; case VIR_DOMAIN_VIDEO_TYPE_XEN: case VIR_DOMAIN_VIDEO_TYPE_VBOX: case VIR_DOMAIN_VIDEO_TYPE_PARALLELS: diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index ab2ac022f1..bc9786dd60 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -821,6 +821,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevic= eDefPtr dev, =20 case VIR_DOMAIN_VIDEO_TYPE_DEFAULT: case VIR_DOMAIN_VIDEO_TYPE_GOP: + case VIR_DOMAIN_VIDEO_TYPE_NONE: case VIR_DOMAIN_VIDEO_TYPE_LAST: return 0; } @@ -1540,6 +1541,13 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPt= r def, * at slot 2. */ virDomainVideoDefPtr primaryVideo =3D def->videos[0]; + + /* for video type 'none' skip this whole procedure */ + if (primaryVideo->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_NONE) { + ret =3D 0; + goto cleanup; + } + if (virDeviceInfoPCIAddressWanted(&primaryVideo->info)) { memset(&tmp_addr, 0, sizeof(tmp_addr)); tmp_addr.slot =3D 2; @@ -2105,6 +2113,8 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, =20 /* Video devices */ for (i =3D 0; i < def->nvideos; i++) { + if (def->videos[i]->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_NONE) + break; =20 if (!virDeviceInfoPCIAddressWanted(&def->videos[i]->info)) continue; diff --git a/tests/domaincapsschemadata/full.xml b/tests/domaincapsschemada= ta/full.xml index d3faf38da0..474df90283 100644 --- a/tests/domaincapsschemadata/full.xml +++ b/tests/domaincapsschemadata/full.xml @@ -73,6 +73,7 @@ parallels virtio gop + none diff --git a/tests/qemuxml2argvdata/video-invalid-multiple-devices.xml b/te= sts/qemuxml2argvdata/video-invalid-multiple-devices.xml new file mode 100644 index 0000000000..3f105efaae --- /dev/null +++ b/tests/qemuxml2argvdata/video-invalid-multiple-devices.xml @@ -0,0 +1,33 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + +

+ + + + + + + + + diff --git a/tests/qemuxml2argvdata/video-none-device.args b/tests/qemuxml2= argvdata/video-none-device.args new file mode 100644 index 0000000000..1b03c0cb97 --- /dev/null +++ b/tests/qemuxml2argvdata/video-none-device.args @@ -0,0 +1,27 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i686 \ +-name QEMUGuest1 \ +-S \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,\ +server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot c \ +-usb \ +-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ +-device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-= 0 \ +-vnc 127.0.0.1:0 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/video-none-device.xml b/tests/qemuxml2a= rgvdata/video-none-device.xml new file mode 100644 index 0000000000..4b591562b7 --- /dev/null +++ b/tests/qemuxml2argvdata/video-none-device.xml @@ -0,0 +1,39 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + +
+ + +
+ + +
+ + + + + + + +
+ + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 8293be949d..4ed165d76b 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2010,7 +2010,9 @@ mymain(void) QEMU_CAPS_DEVICE_VIRTIO_VGA, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS); - DO_TEST_PARSE_ERROR("video-invalid", NONE); + DO_TEST("video-none-device", + QEMU_CAPS_VNC); + DO_TEST_PARSE_ERROR("video-invalid-multiple-devices", NONE); =20 DO_TEST("virtio-rng-default", QEMU_CAPS_DEVICE_VIRTIO_RNG, diff --git a/tests/qemuxml2xmloutdata/video-none-device.xml b/tests/qemuxml= 2xmloutdata/video-none-device.xml new file mode 100644 index 0000000000..6e76b394fe --- /dev/null +++ b/tests/qemuxml2xmloutdata/video-none-device.xml @@ -0,0 +1,42 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + +
+ + +
+ + +
+ + + + + + + + + +
+ + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 0095c27cf6..e482705f0e 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1143,6 +1143,7 @@ mymain(void) QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS, QEMU_CAPS_VNC, QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW); + DO_TEST("video-none-device", NONE); =20 DO_TEST("intel-iommu", QEMU_CAPS_DEVICE_INTEL_IOMMU); --=20 2.14.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list