From nobody Fri May 10 11:47:14 2024 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 1530188255255307.2248261102651; Thu, 28 Jun 2018 05:17:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DCAF48553F; Thu, 28 Jun 2018 12:17:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8F724290EA; Thu, 28 Jun 2018 12:17:33 +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 0E19A4A460; Thu, 28 Jun 2018 12:17:33 +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 w5SCF8XA011161 for ; Thu, 28 Jun 2018 08:15:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 52D832026D6C; Thu, 28 Jun 2018 12:15:08 +0000 (UTC) Received: from beluga.usersys.redhat.com (unknown [10.43.2.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD6A42026D69; Thu, 28 Jun 2018 12:15:07 +0000 (UTC) From: Erik Skultety To: libvir-list@redhat.com Date: Thu, 28 Jun 2018 14:14:58 +0200 Message-Id: <8dd86d8e804b2f46291b6771fbe77ad1f55a6dc0.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 1/5] qemu: address: Handle all the video devices within a single loop 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 28 Jun 2018 12:17:34 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We've been handling the primary video device separately from all the other ones when in fact the code to do that was the same. Therefore, let's handle all the devices within the existing 'for' loop. Signed-off-by: Erik Skultety Reviewed-by: John Ferlan --- src/qemu/qemu_domain_address.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index e9f460d77a..ab2ac022f1 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -2103,15 +2103,9 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, goto error; } =20 - /* Assign a PCI slot to the primary video card if there is not an - * assigned address. */ - if (def->nvideos > 0 && - virDeviceInfoPCIAddressWanted(&def->videos[0]->info)) { - if (qemuDomainPCIAddressReserveNextAddr(addrs, &def->videos[0]->in= fo) < 0) - goto error; - } + /* Video devices */ + for (i =3D 0; i < def->nvideos; i++) { =20 - for (i =3D 1; i < def->nvideos; i++) { if (!virDeviceInfoPCIAddressWanted(&def->videos[i]->info)) continue; =20 --=20 2.14.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 10 11:47:14 2024 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 1530188137469258.164367914388; Thu, 28 Jun 2018 05:15:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8973587621; Thu, 28 Jun 2018 12:15:35 +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 20D43117681; Thu, 28 Jun 2018 12:15:35 +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 81EE618037ED; Thu, 28 Jun 2018 12:15:34 +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 w5SCF9g7011167 for ; Thu, 28 Jun 2018 08:15:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id 14FF92027047; Thu, 28 Jun 2018 12:15:09 +0000 (UTC) Received: from beluga.usersys.redhat.com (unknown [10.43.2.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 909392026D69; Thu, 28 Jun 2018 12:15:08 +0000 (UTC) From: Erik Skultety To: libvir-list@redhat.com Date: Thu, 28 Jun 2018 14:14:59 +0200 Message-Id: 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 2/5] conf: Introduce virDomainVideoDefClear helper 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.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 28 Jun 2018 12:15:36 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Future patches rely on the ability to reset the contents of the virDomainVideoDef structure rather than re-allocating it. Signed-off-by: Erik Skultety Reviewed-by: John Ferlan --- src/conf/domain_conf.c | 14 +++++++++++++- src/conf/domain_conf.h | 1 + src/libvirt_private.syms | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 70686ebd88..87dbb9a433 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2549,7 +2549,8 @@ virDomainVideoDefNew(void) } =20 =20 -void virDomainVideoDefFree(virDomainVideoDefPtr def) +void +virDomainVideoDefClear(virDomainVideoDefPtr def) { if (!def) return; @@ -2559,6 +2560,17 @@ void virDomainVideoDefFree(virDomainVideoDefPtr def) VIR_FREE(def->accel); VIR_FREE(def->virtio); VIR_FREE(def->driver); + + memset(def, 0, sizeof(*def)); +} + + +void virDomainVideoDefFree(virDomainVideoDefPtr def) +{ + if (!def) + return; + + virDomainVideoDefClear(def); VIR_FREE(def); } =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index f31c78d5e6..834a7c1d7f 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2891,6 +2891,7 @@ void virDomainNVRAMDefFree(virDomainNVRAMDefPtr def); void virDomainWatchdogDefFree(virDomainWatchdogDefPtr def); virDomainVideoDefPtr virDomainVideoDefNew(void); void virDomainVideoDefFree(virDomainVideoDefPtr def); +void virDomainVideoDefClear(virDomainVideoDefPtr def); virDomainHostdevDefPtr virDomainHostdevDefNew(void); void virDomainHostdevDefClear(virDomainHostdevDefPtr def); void virDomainHostdevDefFree(virDomainHostdevDefPtr def); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 5499a368c0..5bd08d3f67 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -567,6 +567,7 @@ virDomainTPMModelTypeToString; virDomainUSBDeviceDefForeach; virDomainVideoDefaultRAM; virDomainVideoDefaultType; +virDomainVideoDefClear; virDomainVideoDefFree; virDomainVideoDefNew; virDomainVideoTypeFromString; --=20 2.14.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 10 11:47:14 2024 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 1530188120344491.54276656768604; Thu, 28 Jun 2018 05:15:20 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4A45E3082155; Thu, 28 Jun 2018 12:15:16 +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 931A0308BDB0; Thu, 28 Jun 2018 12:15:15 +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 A68DE18037F0; Thu, 28 Jun 2018 12:15:13 +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 w5SCF9Ji011175 for ; Thu, 28 Jun 2018 08:15:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id CA6092026D6C; Thu, 28 Jun 2018 12:15:09 +0000 (UTC) Received: from beluga.usersys.redhat.com (unknown [10.43.2.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 510182026D69; Thu, 28 Jun 2018 12:15:09 +0000 (UTC) From: Erik Skultety To: libvir-list@redhat.com Date: Thu, 28 Jun 2018 14:15:00 +0200 Message-Id: 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 3/5] conf: Introduce virDomainDefPostParseVideo helper 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.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Thu, 28 Jun 2018 12:15:19 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move the video post parse bits into a separate helper as the logic is going to be extended in the future. Signed-off-by: Erik Skultety Reviewed-by: John Ferlan --- src/conf/domain_conf.c | 45 ++++++++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 87dbb9a433..96ab6cf520 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -5121,6 +5121,34 @@ virDomainDefBootOrderPostParse(virDomainDefPtr def) } =20 =20 +static int +virDomainDefPostParseVideo(virDomainDefPtr def, + void *opaque) +{ + if (def->nvideos =3D=3D 0) + return 0; + + 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; + + return 0; +} + + static int virDomainDefPostParseCommon(virDomainDefPtr def, struct virDomainDefPostParseDeviceIteratorData= *data) @@ -5157,21 +5185,8 @@ virDomainDefPostParseCommon(virDomainDefPtr def, if (virDomainDefAddImplicitDevices(def) < 0) return -1; =20 - if (def->nvideos !=3D 0) { - 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, data) = < 0) - return -1; - } + if (virDomainDefPostParseVideo(def, data) < 0) + return -1; =20 if (def->nserials !=3D 0) { virDomainDeviceDef device =3D { --=20 2.14.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 10 11:47:14 2024 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 1530188146455924.390370069461; Thu, 28 Jun 2018 05:15:46 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 888CB31676A0; Thu, 28 Jun 2018 12:15:44 +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 379A42B4C6; Thu, 28 Jun 2018 12:15:44 +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 7476018037EF; Thu, 28 Jun 2018 12:15:43 +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 w5SCFAXq011180 for ; Thu, 28 Jun 2018 08:15:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8AA8B2027047; Thu, 28 Jun 2018 12:15:10 +0000 (UTC) Received: from beluga.usersys.redhat.com (unknown [10.43.2.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1157A2026D69; Thu, 28 Jun 2018 12:15:09 +0000 (UTC) From: Erik Skultety To: libvir-list@redhat.com Date: Thu, 28 Jun 2018 14:15:01 +0200 Message-Id: <97423658a3b3158d2b9258071362b01aa7222d29.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 4/5] qemu: validate: Enforce compile time switch type checking for videos 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Thu, 28 Jun 2018 12:15:45 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" There wasn't an explicit type case to the video type enum in qemuDomainDeviceDefValidateVideo, _TYPE_GOP was also missing from the switch. Signed-off-by: Erik Skultety Reviewed-by: John Ferlan --- src/conf/domain_conf.h | 2 +- src/qemu/qemu_domain.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 834a7c1d7f..6d73a0b5d3 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1454,7 +1454,7 @@ struct _virDomainVideoDriverDef { }; =20 struct _virDomainVideoDef { - int type; + int type; /* enum virDomainVideoType */ unsigned int ram; /* kibibytes (multiples of 1024) */ unsigned int vram; /* kibibytes (multiples of 1024) */ unsigned int vram64; /* kibibytes (multiples of 1024) */ diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 32128bf04d..42b7635ef4 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4443,10 +4443,11 @@ qemuDomainDeviceDefValidateHostdev(const virDomainH= ostdevDef *hostdev, static int qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video) { - switch (video->type) { + switch ((virDomainVideoType) video->type) { case VIR_DOMAIN_VIDEO_TYPE_XEN: case VIR_DOMAIN_VIDEO_TYPE_VBOX: case VIR_DOMAIN_VIDEO_TYPE_PARALLELS: + case VIR_DOMAIN_VIDEO_TYPE_GOP: case VIR_DOMAIN_VIDEO_TYPE_DEFAULT: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("video type '%s' is not supported with QEMU"), --=20 2.14.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 10 11:47:14 2024 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