From nobody Sun May 5 15:23:01 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 ARC-Seal: i=1; a=rsa-sha256; t=1570829282; cv=none; d=zoho.com; s=zohoarc; b=jyfzSBrrWK7upI/aqMcy5HMgezq5gY7pm8kkjJHCH01zcTDpPTLcOCGDZpNNsR1YFT971WUdyIzqLO5jQiAQ/LuRWxP2b/E13apbQBCJ1aoowTstulFcZMfYEqYwplVqJCxCupS1ZfJU6ZPbqXLJq2tpLjSa8WbZdK6b0s892c4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570829282; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=4fisWQW8VpGRlZgsyuwCCuv6QxEC0gcIrPspNeSoVzE=; b=omB2+tvfURkgYBlqnoYK/Rfrl/8HIE4MeHbTomQq40DxYrGKu1Hc8ydHtybui3gQA5RBwRv+6wjndKcInYyBeAdeBxTr1TxTTHQDnKxZwXykNoJjca5fDv5XPNu3nnVs132uaa1ZX/n03CCqxrzsT3x/9Lnpzc6D3BKblPz/1WY= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1570829282631684.683521541755; Fri, 11 Oct 2019 14:28:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 00F7210C0930; Fri, 11 Oct 2019 21:28:01 +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 D1EA9600CC; Fri, 11 Oct 2019 21:28:00 +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 9231283733; Fri, 11 Oct 2019 21:28:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9BLRw7w007273 for ; Fri, 11 Oct 2019 17:27:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1DB32601A3; Fri, 11 Oct 2019 21:27:58 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-118-45.phx2.redhat.com [10.3.118.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D7B15600CC; Fri, 11 Oct 2019 21:27:57 +0000 (UTC) From: Jonathon Jongsma To: libvir-list@redhat.com Date: Fri, 11 Oct 2019 16:27:47 -0500 Message-Id: <20191011212752.27139-2-jjongsma@redhat.com> In-Reply-To: <20191011212752.27139-1-jjongsma@redhat.com> References: <20191011212752.27139-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 1/6] qemu: set domain capabilities for ramfb device 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: , 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.66]); Fri, 11 Oct 2019 21:28:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" commit 9bfcf0f62d9cf16db526a948242a7409ae883209 added the QEMU_CAPS_DEVICE_RAMFB capability but did not set the domain capability. This patch sets the domain capabilities for the ramfb device and updates the tests. Signed-off-by: Jonathon Jongsma --- src/qemu/qemu_capabilities.c | 2 ++ tests/domaincapsschemadata/qemu_3.0.0.s390x.xml | 1 + tests/domaincapsschemadata/qemu_3.1.0.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_4.1.0.x86_64.xml | 1 + tests/domaincapsschemadata/qemu_4.2.0.x86_64.xml | 1 + 6 files changed, 7 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 091e48c7e1..11559d3d92 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5400,6 +5400,8 @@ virQEMUCapsFillDomainDeviceVideoCaps(virQEMUCapsPtr q= emuCaps, VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_VIR= TIO); if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_BOCHS_DISPLAY)) VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_BOC= HS); + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_RAMFB)) + VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_RAM= FB); =20 return 0; } diff --git a/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml b/tests/domain= capsschemadata/qemu_3.0.0.s390x.xml index 0e81e2ea33..d32f7b5875 100644 --- a/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml +++ b/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml @@ -158,6 +158,7 @@ diff --git a/tests/domaincapsschemadata/qemu_3.1.0.x86_64.xml b/tests/domai= ncapsschemadata/qemu_3.1.0.x86_64.xml index 059403cebc..ecb1f06e90 100644 --- a/tests/domaincapsschemadata/qemu_3.1.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_3.1.0.x86_64.xml @@ -128,6 +128,7 @@ qxl virtio bochs + ramfb diff --git a/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml b/tests/domai= ncapsschemadata/qemu_4.0.0.x86_64.xml index eb24b9a604..2a475f20be 100644 --- a/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml @@ -128,6 +128,7 @@ qxl virtio bochs + ramfb diff --git a/tests/domaincapsschemadata/qemu_4.1.0.x86_64.xml b/tests/domai= ncapsschemadata/qemu_4.1.0.x86_64.xml index f5685d2068..07b869859c 100644 --- a/tests/domaincapsschemadata/qemu_4.1.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_4.1.0.x86_64.xml @@ -132,6 +132,7 @@ qxl virtio bochs + ramfb diff --git a/tests/domaincapsschemadata/qemu_4.2.0.x86_64.xml b/tests/domai= ncapsschemadata/qemu_4.2.0.x86_64.xml index 5bd376bb2e..2f86eac7f0 100644 --- a/tests/domaincapsschemadata/qemu_4.2.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_4.2.0.x86_64.xml @@ -132,6 +132,7 @@ qxl virtio bochs + ramfb --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 15:23:01 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 ARC-Seal: i=1; a=rsa-sha256; t=1570829285; cv=none; d=zoho.com; s=zohoarc; b=nMI/c2t4MhYh1pk1eIrcolsswFKQfeCHKME9NZJC4hfLQlm47E/LHa+NMH0g3rj8Y7kMl4wwAXlISAEffqncqehUsld2S8P6Kj8r2tTsbaTrMR6+Wnj8y08CIlZCcDrqVOelONgTQEL5VEYEcSgZkWayoEFBwEfyyqFWvutNSpM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570829285; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vFXiMgJFHy2D5jW/POpgy8bsBCazit46xXs5gtoMj78=; b=eK9QhmkQbaN5tqHfORIRE2VFdRNVHxd1AYN97MVj82fJM6cTd33oBomBHkv+qS5KJCq9j/D9IUPOIcsym6TICJ6K/kUcIvx1sQzD66LDTQgahKrj6an/tJKjxltmEmj/OWfBOMEDiIcEB4GqPo78TwqnNcH0LMHrPtiWMPDsrn8= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1570829285479867.2293530314915; Fri, 11 Oct 2019 14:28:05 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E38F410CC20B; Fri, 11 Oct 2019 21:28:02 +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 B6F715D713; Fri, 11 Oct 2019 21:28:02 +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 6ED8A83738; Fri, 11 Oct 2019 21:28:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9BLRwai007285 for ; Fri, 11 Oct 2019 17:27:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 73F176017E; Fri, 11 Oct 2019 21:27:58 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-118-45.phx2.redhat.com [10.3.118.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3928C600CC; Fri, 11 Oct 2019 21:27:58 +0000 (UTC) From: Jonathon Jongsma To: libvir-list@redhat.com Date: Fri, 11 Oct 2019 16:27:48 -0500 Message-Id: <20191011212752.27139-3-jjongsma@redhat.com> In-Reply-To: <20191011212752.27139-1-jjongsma@redhat.com> References: <20191011212752.27139-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 2/6] qemu: use VIR_AUTOUNREF in qemuDomainDeviceDefValidate() 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: , 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Fri, 11 Oct 2019 21:28:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This allows us to simplify the function and avoid jumping to 'cleanup'. Signed-off-by: Jonathon Jongsma --- src/qemu/qemu_domain.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index dc7568fe18..516ae7e444 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7197,8 +7197,8 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef = *dev, { int ret =3D 0; virQEMUDriverPtr driver =3D opaque; - virQEMUCapsPtr qemuCaps =3D NULL; - virDomainCapsPtr domCaps =3D NULL; + VIR_AUTOUNREF(virQEMUCapsPtr) qemuCaps =3D NULL; + VIR_AUTOUNREF(virDomainCapsPtr) domCaps =3D NULL; =20 if (!(qemuCaps =3D virQEMUCapsCacheLookup(driver->qemuCapsCache, def->emulator))) @@ -7208,13 +7208,13 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDe= f *dev, def->os.machine, def->os.arch, def->virtType))) - goto cleanup; + return -1; =20 if ((ret =3D qemuDomainDeviceDefValidateAddress(dev, qemuCaps)) < 0) - goto cleanup; + return ret; =20 if (virDomainCapsDeviceDefValidate(domCaps, dev, def) < 0) - goto cleanup; + return ret; =20 switch ((virDomainDeviceType)dev->type) { case VIR_DOMAIN_DEVICE_NET: @@ -7300,9 +7300,6 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef = *dev, break; } =20 - cleanup: - virObjectUnref(qemuCaps); - virObjectUnref(domCaps); return ret; } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 15:23:01 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 ARC-Seal: i=1; a=rsa-sha256; t=1570829282; cv=none; d=zoho.com; s=zohoarc; b=U/A1wqLBvj1EIDCM1ZoOo29rSPULnosuVyTif1nW+eVUqdu977Qmhoir+pYhwJlpHJqGH8w8XIt0qt9KMYdooaav9LabO7BOrrmsCZjEK0ks5ohbt3oDGLzc5kFY4UVWMbSRfnjIhG1QxqKBLoovsvbVziJr38XngaZ8MIjbaJY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570829282; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=gksjx3+DecYS9LYJC48C5RK19/1nxKVFsvGANKtxIcU=; b=E7iaN+8mZjiSQZgdpvrsvKky7VwD0gkbsIkIHzPC1UJetdj1/AdjARkulu4Rn/Iri36BG36h9hI/zzZ33eQy2dygsiO2pny6O/6vgxmaEnygwxlHk63/8fbjCtD61VzhgyCSWxJYsTg8txaL97cdRR/l+56Z/nIjp+BFVqQBErI= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1570829282791136.82052686529437; Fri, 11 Oct 2019 14:28:02 -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 4F6A4309C385; Fri, 11 Oct 2019 21:28:01 +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 297C05DA8D; Fri, 11 Oct 2019 21:28:01 +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 DB17783737; Fri, 11 Oct 2019 21:28:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9BLRwo9007290 for ; Fri, 11 Oct 2019 17:27:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id CB7636017E; Fri, 11 Oct 2019 21:27:58 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-118-45.phx2.redhat.com [10.3.118.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 90E59600CC; Fri, 11 Oct 2019 21:27:58 +0000 (UTC) From: Jonathon Jongsma To: libvir-list@redhat.com Date: Fri, 11 Oct 2019 16:27:49 -0500 Message-Id: <20191011212752.27139-4-jjongsma@redhat.com> In-Reply-To: <20191011212752.27139-1-jjongsma@redhat.com> References: <20191011212752.27139-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 3/6] qemu: fix domain device validation 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: , 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.43]); Fri, 11 Oct 2019 21:28:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" When the virDomainCapsDeviceDefValidate() function returned an error status (-1), we were aborting the function early, but returning the default return value (0). This patch properly returns an error in that case. Signed-off-by: Jonathon Jongsma --- src/qemu/qemu_domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 516ae7e444..bc455e7da3 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7213,7 +7213,7 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef = *dev, if ((ret =3D qemuDomainDeviceDefValidateAddress(dev, qemuCaps)) < 0) return ret; =20 - if (virDomainCapsDeviceDefValidate(domCaps, dev, def) < 0) + if ((ret =3D virDomainCapsDeviceDefValidate(domCaps, dev, def)) < 0) return ret; =20 switch ((virDomainDeviceType)dev->type) { --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 15:23:01 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 ARC-Seal: i=1; a=rsa-sha256; t=1570829289; cv=none; d=zoho.com; s=zohoarc; b=PcGI5YQ+hx/UuGORFZf1KjWxzqvextmzZ3scTtZZonqLgmk4ZUXkNrrKzOk1lrUKIsWRSeUlgYQIklP1J5yUWtQlRsL25hN21Egq/YGphyKgq1PEk2gMYdPv/iapPUdSr3qaNnvXptad79ayTMkzQ3MvuQ5M9Le/aRh5LcxfbrQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570829289; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=N8EussLhxKN2nR0/Ik7h5K8fib4FtCpzmMtNZQcHky4=; b=Kdpi3QmkBLdoRcSk/qjGp55okMayvkGY9xfzsniFG60z+UqTtdm/RNBVxSO5m9Qn8RcVt+B0tQh8fA7tah2qKFSuT4b7Rr/U5luhM4wBWRwo/uUfcFaQ1h+tGRC1kPLZ8VfFCzn1GZGgMAiWGSEtiujulTA04Q9qA0GuRdyDVfQ= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1570829289619683.1583309830652; Fri, 11 Oct 2019 14:28:09 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 111E5309DEEE; Fri, 11 Oct 2019 21:28:08 +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 78E1B60C18; Fri, 11 Oct 2019 21:28:06 +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 2FBC083739; Fri, 11 Oct 2019 21:28:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9BLRx4T007299 for ; Fri, 11 Oct 2019 17:27:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3C03A601A3; Fri, 11 Oct 2019 21:27:59 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-118-45.phx2.redhat.com [10.3.118.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E8052600CC; Fri, 11 Oct 2019 21:27:58 +0000 (UTC) From: Jonathon Jongsma To: libvir-list@redhat.com Date: Fri, 11 Oct 2019 16:27:50 -0500 Message-Id: <20191011212752.27139-5-jjongsma@redhat.com> In-Reply-To: <20191011212752.27139-1-jjongsma@redhat.com> References: <20191011212752.27139-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 4/6] qemu: consolidate video validation 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: , 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 11 Oct 2019 21:28:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Move video validation logic from qemuProcessStartValidateVideo() to qemuDomainDeviceDefValidateVideo() (which is in fact called from the aforementioned function). Signed-off-by: Jonathon Jongsma --- src/qemu/qemu_domain.c | 172 +++++++++++++++++++++++++--------------- src/qemu/qemu_process.c | 62 --------------- 2 files changed, 107 insertions(+), 127 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index bc455e7da3..def90a0f7d 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5706,83 +5706,125 @@ qemuDomainDeviceDefValidateHostdev(const virDomain= HostdevDef *hostdev, =20 =20 static int -qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video) +qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video, + virQEMUCapsPtr qemuCaps) { - switch ((virDomainVideoType) video->type) { - case VIR_DOMAIN_VIDEO_TYPE_NONE: - return 0; - 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"), - virDomainVideoTypeToString(video->type)); - return -1; - case VIR_DOMAIN_VIDEO_TYPE_VGA: - case VIR_DOMAIN_VIDEO_TYPE_CIRRUS: - case VIR_DOMAIN_VIDEO_TYPE_VMVGA: - case VIR_DOMAIN_VIDEO_TYPE_QXL: - case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: - case VIR_DOMAIN_VIDEO_TYPE_BOCHS: - case VIR_DOMAIN_VIDEO_TYPE_RAMFB: - case VIR_DOMAIN_VIDEO_TYPE_LAST: - break; - } - - if (!video->primary && - video->type !=3D VIR_DOMAIN_VIDEO_TYPE_QXL && - video->type !=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("video type '%s' is only valid as primary " - "video device"), - virDomainVideoTypeToString(video->type)); - return -1; - } - - if (video->accel && video->accel->accel2d =3D=3D VIR_TRISTATE_SWITCH_O= N) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("qemu does not support the accel2d setting")); - return -1; - } - - if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_QXL) { - if (video->vram > (UINT_MAX / 1024)) { - virReportError(VIR_ERR_OVERFLOW, - _("value for 'vram' must be less than '%u'"), - UINT_MAX / 1024); + if (video->backend =3D=3D VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) { + if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_USER_GPU)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this QEMU does not support 'vhost-user' vide= o device")); + return -1; + } + } else { + switch ((virDomainVideoType) video->type) { + case VIR_DOMAIN_VIDEO_TYPE_NONE: + return 0; + 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 QE= MU"), + virDomainVideoTypeToString(video->type)); + return -1; + case VIR_DOMAIN_VIDEO_TYPE_VGA: + case VIR_DOMAIN_VIDEO_TYPE_CIRRUS: + case VIR_DOMAIN_VIDEO_TYPE_VMVGA: + case VIR_DOMAIN_VIDEO_TYPE_QXL: + case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: + case VIR_DOMAIN_VIDEO_TYPE_BOCHS: + case VIR_DOMAIN_VIDEO_TYPE_RAMFB: + case VIR_DOMAIN_VIDEO_TYPE_LAST: + break; + } + if ((video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VGA && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VGA)) || + (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_CIRRUS && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_CIRRUS_VGA)) || + (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VMVGA && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMWARE_SVGA)) || + (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_QXL && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL)) || + (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU)) || + (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && + video->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW)) || + (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_BOCHS && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_BOCHS_DISPLAY)) || + (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_RAMFB && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_RAMFB))) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("this QEMU does not support '%s' video device= "), + virDomainVideoTypeToString(video->type)); return -1; } - if (video->ram > (UINT_MAX / 1024)) { - virReportError(VIR_ERR_OVERFLOW, - _("value for 'ram' must be less than '%u'"), - UINT_MAX / 1024); + + if (!video->primary && + video->type !=3D VIR_DOMAIN_VIDEO_TYPE_QXL && + video->type !=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("video type '%s' is only valid as primary " + "video device"), + virDomainVideoTypeToString(video->type)); return -1; } - if (video->vgamem) { - if (video->vgamem < 1024) { + + if (video->accel) { + if (video->accel->accel3d =3D=3D VIR_TRISTATE_SWITCH_ON && + (video->type !=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO || + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_VIRGL))) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("%s 3d acceleration is not supported"), + virDomainVideoTypeToString(video->type)); + return -1; + } + if (video->accel->accel2d =3D=3D VIR_TRISTATE_SWITCH_ON) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("value for 'vgamem' must be at least 1 Mi= B " - "(1024 KiB)")); + _("qemu does not support the accel2d settin= g")); return -1; } + } =20 - if (video->vgamem !=3D VIR_ROUND_UP_POWER_OF_TWO(video->vgamem= )) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("value for 'vgamem' must be power of two"= )); + if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_QXL) { + if (video->vram > (UINT_MAX / 1024)) { + virReportError(VIR_ERR_OVERFLOW, + _("value for 'vram' must be less than '%u'"= ), + UINT_MAX / 1024); + return -1; + } + if (video->ram > (UINT_MAX / 1024)) { + virReportError(VIR_ERR_OVERFLOW, + _("value for 'ram' must be less than '%u'"), + UINT_MAX / 1024); return -1; } + if (video->vgamem) { + if (video->vgamem < 1024) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("value for 'vgamem' must be at least = 1 MiB " + "(1024 KiB)")); + return -1; + } + + if (video->vgamem !=3D VIR_ROUND_UP_POWER_OF_TWO(video->vg= amem)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("value for 'vgamem' must be power of = two")); + return -1; + } + } } - } =20 - if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VGA || - video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VMVGA) { - if (video->vram && video->vram < 1024) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", _("value for 'vram' must be at least " - "1 MiB (1024 KiB)")); - return -1; + if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VGA || + video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VMVGA) { + if (video->vram && video->vram < 1024) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", _("value for 'vram' must be at least " + "1 MiB (1024 KiB)")); + return -1; + } } } =20 @@ -7247,7 +7289,7 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef = *dev, break; =20 case VIR_DOMAIN_DEVICE_VIDEO: - ret =3D qemuDomainDeviceDefValidateVideo(dev->data.video); + ret =3D qemuDomainDeviceDefValidateVideo(dev->data.video, qemuCaps= ); break; =20 case VIR_DOMAIN_DEVICE_DISK: diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c14c09da11..df7b7c2d3e 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5240,65 +5240,6 @@ qemuProcessStartValidateGraphics(virDomainObjPtr vm) return 0; } =20 - -static int -qemuProcessStartValidateVideo(virDomainObjPtr vm, - virQEMUCapsPtr qemuCaps) -{ - size_t i; - virDomainVideoDefPtr video; - - for (i =3D 0; i < vm->def->nvideos; i++) { - video =3D vm->def->videos[i]; - - if (video->backend =3D=3D VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER)= { - if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_USER_GPU)= ) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this QEMU does not support 'vhost-user' = video device")); - return -1; - } - } else { - if ((video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VGA && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VGA)) || - (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_CIRRUS && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_CIRRUS_VGA)) || - (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VMVGA && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMWARE_SVGA)) = || - (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_QXL && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL)) || - (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU)) || - (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && - video->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CC= W && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW= )) || - (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_BOCHS && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_BOCHS_DISPLAY))= || - (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_RAMFB && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_RAMFB))) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("this QEMU does not support '%s' video de= vice"), - virDomainVideoTypeToString(video->type)); - return -1; - } - - if (video->accel) { - if (video->accel->accel3d =3D=3D VIR_TRISTATE_SWITCH_ON && - (video->type !=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO || - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_VIRGL)= )) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("%s 3d acceleration is not supported"= ), - virDomainVideoTypeToString(video->type)= ); - return -1; - } - } - } - } - - return 0; -} - - static int qemuProcessStartValidateIOThreads(virDomainObjPtr vm, virQEMUCapsPtr qemuCaps) @@ -5483,9 +5424,6 @@ qemuProcessStartValidate(virQEMUDriverPtr driver, if (qemuProcessStartValidateGraphics(vm) < 0) return -1; =20 - if (qemuProcessStartValidateVideo(vm, qemuCaps) < 0) - return -1; - if (qemuProcessStartValidateIOThreads(vm, qemuCaps) < 0) return -1; =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 15:23:01 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 ARC-Seal: i=1; a=rsa-sha256; t=1570829286; cv=none; d=zoho.com; s=zohoarc; b=jO2HA+mpGILtQ1yjjnLzR2cMz1jpx0ZcA8IFTmq2zcB4IGXCy7E7RCDA8rnwEj4cVkCz85r56kebuqvjObCkFX6vEdH5ySBRAKRihH9vNZ5bofFotM4WnaK59uTA6QYyGgNoVvtq6MqZFnkAh5pe2blvnZ/f3oc+AAKujvNQLpk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570829286; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tXrYS+cOYrYgrUXW3mhbJzERBvBDX1c8M/9MqLFvvCw=; b=MdXepOMBmu0U/kADgpOb2/MkH9vTtAzDDMcvR1PPJsEdQdQo8yF1ZVtCjUUkNTiiF42fyjd6NTKGOxxuj04WdKy3TIKjpG6cIzDa4hui7umKhxkp9NrFNoI2EzwW7d9dgzBpjrjN3bBuPiOSRkh/VsYNUo2T80x2iE311GKp+T8= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 157082928646513.181674773363284; Fri, 11 Oct 2019 14:28:06 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E8A70CCFE6; Fri, 11 Oct 2019 21:28:04 +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 C37445D713; Fri, 11 Oct 2019 21:28:04 +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 7E98D180BA96; Fri, 11 Oct 2019 21:28:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9BLRxMW007307 for ; Fri, 11 Oct 2019 17:27:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 93657601B7; Fri, 11 Oct 2019 21:27:59 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-118-45.phx2.redhat.com [10.3.118.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 58A38600CC; Fri, 11 Oct 2019 21:27:59 +0000 (UTC) From: Jonathon Jongsma To: libvir-list@redhat.com Date: Fri, 11 Oct 2019 16:27:51 -0500 Message-Id: <20191011212752.27139-6-jjongsma@redhat.com> In-Reply-To: <20191011212752.27139-1-jjongsma@redhat.com> References: <20191011212752.27139-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 5/6] qemu: unify domain caps validation for video devices 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: , 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 11 Oct 2019 21:28:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" As suggested by Cole, this patch uses the domain capabilities to validate the supported video model types. By using the domain capabilities, the validation will automatically adjust when new enum members are added. Signed-off-by: Jonathon Jongsma --- src/conf/domain_capabilities.c | 17 ++++++++++++- src/qemu/qemu_domain.c | 45 ---------------------------------- 2 files changed, 16 insertions(+), 46 deletions(-) diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index fe93388cce..baf33b4722 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -686,6 +686,19 @@ virDomainCapsDeviceRNGDefValidate(virDomainCapsPtr con= st caps, return 0; } =20 +static int +virDomainCapsDeviceVideoDefValidate(virDomainCapsPtr const caps, + const virDomainVideoDefPtr dev) +{ + if (ENUM_VALUE_MISSING(caps->video.modelType, dev->type)) { + ENUM_VALUE_ERROR("video model", + virDomainVideoTypeToString(dev->type)); + return -1; + } + + return 0; +} + =20 int virDomainCapsDeviceDefValidate(virDomainCapsPtr const caps, @@ -698,6 +711,9 @@ virDomainCapsDeviceDefValidate(virDomainCapsPtr const c= aps, case VIR_DOMAIN_DEVICE_RNG: ret =3D virDomainCapsDeviceRNGDefValidate(caps, dev->data.rng); break; + case VIR_DOMAIN_DEVICE_VIDEO: + ret =3D virDomainCapsDeviceVideoDefValidate(caps, dev->data.video); + break; =20 case VIR_DOMAIN_DEVICE_DISK: case VIR_DOMAIN_DEVICE_REDIRDEV: @@ -706,7 +722,6 @@ virDomainCapsDeviceDefValidate(virDomainCapsPtr const c= aps, case VIR_DOMAIN_DEVICE_CHR: case VIR_DOMAIN_DEVICE_SMARTCARD: case VIR_DOMAIN_DEVICE_HOSTDEV: - case VIR_DOMAIN_DEVICE_VIDEO: case VIR_DOMAIN_DEVICE_MEMORY: case VIR_DOMAIN_DEVICE_VSOCK: case VIR_DOMAIN_DEVICE_INPUT: diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index def90a0f7d..bb34638427 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5717,51 +5717,6 @@ qemuDomainDeviceDefValidateVideo(const virDomainVide= oDef *video, return -1; } } else { - switch ((virDomainVideoType) video->type) { - case VIR_DOMAIN_VIDEO_TYPE_NONE: - return 0; - 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 QE= MU"), - virDomainVideoTypeToString(video->type)); - return -1; - case VIR_DOMAIN_VIDEO_TYPE_VGA: - case VIR_DOMAIN_VIDEO_TYPE_CIRRUS: - case VIR_DOMAIN_VIDEO_TYPE_VMVGA: - case VIR_DOMAIN_VIDEO_TYPE_QXL: - case VIR_DOMAIN_VIDEO_TYPE_VIRTIO: - case VIR_DOMAIN_VIDEO_TYPE_BOCHS: - case VIR_DOMAIN_VIDEO_TYPE_RAMFB: - case VIR_DOMAIN_VIDEO_TYPE_LAST: - break; - } - if ((video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VGA && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VGA)) || - (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_CIRRUS && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_CIRRUS_VGA)) || - (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VMVGA && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMWARE_SVGA)) || - (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_QXL && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL)) || - (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU)) || - (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && - video->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW)) || - (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_BOCHS && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_BOCHS_DISPLAY)) || - (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_RAMFB && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_RAMFB))) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("this QEMU does not support '%s' video device= "), - virDomainVideoTypeToString(video->type)); - return -1; - } - if (!video->primary && video->type !=3D VIR_DOMAIN_VIDEO_TYPE_QXL && video->type !=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO) { --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 15:23:01 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 ARC-Seal: i=1; a=rsa-sha256; t=1570829286; cv=none; d=zoho.com; s=zohoarc; b=UK1F7iJypAuYEXq8LCP6E+PXYpz1I99nOuc744fdDUlNLZRW3HTL9Cvtgoyb1yxInRzsH4Br8OTzVAaZo9JZFjuOXYqttZwHjsMRsK6hYPaE9k/I8uze1hrTkWCb7Neea2nLzRa+HbSdPY3ko1mV3I3J9ccH/Y8ijqeVKxfpC34= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570829286; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=camRJ9PXziS+dAEHFnaQlu7Q/AL6nYIZsOd6lJmxar8=; b=BRCYKyl4FbGen47zNKpFb+m7lgfv7wbDuT6t1Y4qFddgNXcnVgdAQ0siWhLfOdfueAdmEhqFE5pSMk/EQG+zQ7Ew1x+YdkzXMxbcYqUkrng+LixajCOYFjFJ3Q/w5tsi8vs6piYl/aGrZWe/mydXDEeYney0rqDkHJNOcv/iTQc= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 157082928618178.41957040849786; Fri, 11 Oct 2019 14:28:06 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A724980F83; Fri, 11 Oct 2019 21:28:04 +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 7DC46601A3; Fri, 11 Oct 2019 21:28:04 +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 4060A180B536; Fri, 11 Oct 2019 21:28:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9BLRxK6007312 for ; Fri, 11 Oct 2019 17:27:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id E8DB26031D; Fri, 11 Oct 2019 21:27:59 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-118-45.phx2.redhat.com [10.3.118.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AE667600CC; Fri, 11 Oct 2019 21:27:59 +0000 (UTC) From: Jonathon Jongsma To: libvir-list@redhat.com Date: Fri, 11 Oct 2019 16:27:52 -0500 Message-Id: <20191011212752.27139-7-jjongsma@redhat.com> In-Reply-To: <20191011212752.27139-1-jjongsma@redhat.com> References: <20191011212752.27139-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 6/6] qemu: add 'ramfb' attribute for mediated devices 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: , 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 11 Oct 2019 21:28:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The 'ramfb' attribute provides a framebuffer to the guest that can be used as a boot display for the vgpu For example, the following configuration can be used to provide a vgpu with a boot display:
Signed-off-by: Jonathon Jongsma --- docs/formatdomain.html.in | 8 ++++ docs/schemas/domaincommon.rng | 5 +++ src/conf/domain_conf.c | 11 ++++++ src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 17 ++++++++- ...tdev-mdev-display-ramfb.x86_64-latest.args | 37 +++++++++++++++++++ .../hostdev-mdev-display-ramfb.xml | 33 +++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 8 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-ramfb.x86_6= 4-latest.args create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-ramfb.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 7ec57135f6..81e8cafe87 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4846,6 +4846,14 @@ graphical framebuffer in order= to use this attribute, currently only supported with VNC, Spice and egl-headless graphics devices. + + Since version 5.9.0, there is an op= tional + ramfb attribute for devices with + model=3D'vfio-pci'. Supported values are either + on or off (default is 'off'). When + enabled, this attribute provides a memory framebuffer device to = the + guest. This framebuffer will be used as a boot display when a v= gpu + device is the primary display.

Note: There are also some implications on the usage of guest's address type depending on the model attribute, diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index ead5a25068..57e0dcf6ed 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4769,6 +4769,11 @@ vfio-ap + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c1705a07b6..d6cf2132d7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8161,6 +8161,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, VIR_AUTOFREE(char *) backendStr =3D NULL; VIR_AUTOFREE(char *) model =3D NULL; VIR_AUTOFREE(char *) display =3D NULL; + VIR_AUTOFREE(char *) ramfb =3D NULL; =20 /* @managed can be read from the xml document - it is always an * attribute of the toplevel element, no matter what type of @@ -8176,6 +8177,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, rawio =3D virXMLPropString(node, "rawio"); model =3D virXMLPropString(node, "model"); display =3D virXMLPropString(node, "display"); + ramfb =3D virXMLPropString(node, "ramfb"); =20 /* @type is passed in from the caller rather than read from the * xml document, because it is specified in different places for @@ -8284,6 +8286,15 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, display); return -1; } + + if (ramfb && + (mdevsrc->ramfb =3D virTristateSwitchTypeFromString(ramfb)) <= =3D 0) { + virReportError(VIR_ERR_XML_ERROR, + _("unknown value '%s' for attribute " + "'ramfb'"), + ramfb); + return -1; + } } =20 switch (def->source.subsys.type) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index b7ae57aa9d..c73034b5a7 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -262,6 +262,7 @@ struct _virDomainHostdevSubsysMediatedDev { int model; /* enum virMediatedDeviceModelType= */ int display; /* virTristateSwitch */ char uuidstr[VIR_UUID_STRING_BUFLEN]; /* mediated device's uuid stri= ng */ + int ramfb; /* virTristateSwitch */ }; =20 typedef enum { diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 50cc3bdf7c..049a5b54d9 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5417,6 +5417,17 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager, return virBufferContentAndReset(&buf); } =20 +static const char * +qemuBuildHostdevMdevModelTypeString(virDomainHostdevSubsysMediatedDevPtr m= dev) +{ + /* when the 'ramfb' attribute is set, we must use the nohotplug variant + * rather than 'vfio-pci' */ + if (mdev->model =3D=3D VIR_MDEV_MODEL_TYPE_VFIO_PCI && + mdev->ramfb =3D=3D VIR_TRISTATE_SWITCH_ON) + return "vfio-pci-nohotplug"; + + return virMediatedDeviceModelTypeToString(mdev->model); +} =20 char * qemuBuildHostdevMediatedDevStr(const virDomainDef *def, @@ -5431,7 +5442,7 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *de= f, if (!(mdevPath =3D virMediatedDeviceGetSysfsPath(mdevsrc->uuidstr))) return NULL; =20 - dev_str =3D virMediatedDeviceModelTypeToString(mdevsrc->model); + dev_str =3D qemuBuildHostdevMdevModelTypeString(mdevsrc); =20 if (!dev_str) return NULL; @@ -5449,6 +5460,10 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *d= ef, if (dev->info->bootIndex) virBufferAsprintf(&buf, ",bootindex=3D%u", dev->info->bootIndex); =20 + if (mdevsrc->ramfb =3D=3D VIR_TRISTATE_SWITCH_ON) + virBufferAsprintf(&buf, ",ramfb=3D%s", + virTristateSwitchTypeToString(mdevsrc->ramfb)); + if (virBufferCheckError(&buf) < 0) return NULL; =20 diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-ramfb.x86_64-lates= t.args b/tests/qemuxml2argvdata/hostdev-mdev-display-ramfb.x86_64-latest.ar= gs new file mode 100644 index 0000000000..30d2f83318 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-mdev-display-ramfb.x86_64-latest.args @@ -0,0 +1,37 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest2 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest2/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest2/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest2/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i686 \ +-name guest=3DQEMUGuest2,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest2/master-key.aes \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-m 214 \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ +-vnc 127.0.0.1:0 \ +-device qxl-vga,id=3Dvideo0,ram_size=3D67108864,vram_size=3D67108864,\ +vram64_size_mb=3D0,vgamem_mb=3D16,max_outputs=3D1,bus=3Dpci.0,addr=3D0x2 \ +-device vfio-pci-nohotplug,id=3Dhostdev0,\ +sysfsdev=3D/sys/bus/mdev/devices/53764d0e-85a0-42b4-af5c-2046b460b1dc,disp= lay=3Don,\ +bus=3Dpci.0,addr=3D0x3,ramfb=3Don \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-ramfb.xml b/tests/= qemuxml2argvdata/hostdev-mdev-display-ramfb.xml new file mode 100644 index 0000000000..2e7851b2b0 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-mdev-display-ramfb.xml @@ -0,0 +1,33 @@ + + QEMUGuest2 + 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 834a289532..cd51754260 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1638,6 +1638,7 @@ mymain(void) DO_TEST_PARSE_ERROR("hostdev-mdev-display-missing-graphics", QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_VFIO_PCI_DISPLAY); + DO_TEST_CAPS_LATEST("hostdev-mdev-display-ramfb"); DO_TEST_PARSE_ERROR("hostdev-vfio-zpci-wrong-arch", QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST("hostdev-vfio-zpci", --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list