From nobody Thu Apr 25 22:04:07 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 1520350164577895.9905815820839; Tue, 6 Mar 2018 07:29:24 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A4B736E761; Tue, 6 Mar 2018 15:29:22 +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 E6B8E60851; Tue, 6 Mar 2018 15:29:21 +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 7B4EA181A875; Tue, 6 Mar 2018 15:29:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w26FTJ8w003449 for ; Tue, 6 Mar 2018 10:29:19 -0500 Received: by smtp.corp.redhat.com (Postfix) id 96DCE213AEFA; Tue, 6 Mar 2018 15:29:19 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3DB7A213AEF8 for ; Tue, 6 Mar 2018 15:29:19 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 6 Mar 2018 16:29:13 +0100 Message-Id: <20180306152915.8518-2-abologna@redhat.com> In-Reply-To: <20180306152915.8518-1-abologna@redhat.com> References: <20180306152915.8518-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/3] qemu: Take full advantage of conditional device property probing 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 06 Mar 2018 15:29:23 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Commit 4ae59411fa3f introduced the ability to make probing for device properties conditional on a capability being set, but didn't extend the use of this feature to existing devices. This commit does the last bit of work, which results in a lot of pointless QMP chatter no longer happening and our test suite shrinking a fair bit. Signed-off-by: Andrea Bolognani --- "I have discovered a truly marvelous diff for this, which this mailing list is too narrow to contain." - Pierre de Fermat, 1637 The full version can be fetched from https://github.com/andreabolognani/libvirt/tree/caps-cleanup src/qemu/qemu_capabilities.c | 34 +++---- .../qemucapabilitiesdata/caps_1.2.2.x86_64.replies | 102 ++++++-----------= -- tests/qemucapabilitiesdata/caps_1.2.2.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_1.3.1.x86_64.replies | 90 ++++++----------- tests/qemucapabilitiesdata/caps_1.3.1.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_1.4.2.x86_64.replies | 90 ++++++----------- tests/qemucapabilitiesdata/caps_1.4.2.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_1.5.3.x86_64.replies | 90 ++++++----------- tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_1.6.0.x86_64.replies | 90 ++++++----------- tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_1.7.0.x86_64.replies | 90 ++++++----------- tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.1.1.x86_64.replies | 90 ++++++----------- tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml | 2 +- .../caps_2.10.0-gicv2.aarch64.replies | 100 ++++++-----------= -- .../caps_2.10.0-gicv2.aarch64.xml | 2 +- .../caps_2.10.0-gicv3.aarch64.replies | 100 ++++++-----------= -- .../caps_2.10.0-gicv3.aarch64.xml | 2 +- .../qemucapabilitiesdata/caps_2.10.0.ppc64.replies | 100 ++++++-----------= -- tests/qemucapabilitiesdata/caps_2.10.0.ppc64.xml | 2 +- .../qemucapabilitiesdata/caps_2.10.0.s390x.replies | 108 +++++------------= ---- tests/qemucapabilitiesdata/caps_2.10.0.s390x.xml | 2 +- .../caps_2.10.0.x86_64.replies | 90 +++++++---------- tests/qemucapabilitiesdata/caps_2.10.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.11.0.s390x.replies | 108 +++++------------= ---- tests/qemucapabilitiesdata/caps_2.11.0.s390x.xml | 2 +- .../qemucapabilitiesdata/caps_2.4.0.x86_64.replies | 80 ++++++--------- tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.5.0.x86_64.replies | 82 +++++++--------- tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 2 +- .../caps_2.6.0-gicv2.aarch64.replies | 100 ++++++-----------= -- .../caps_2.6.0-gicv2.aarch64.xml | 2 +- .../caps_2.6.0-gicv3.aarch64.replies | 100 ++++++-----------= -- .../caps_2.6.0-gicv3.aarch64.xml | 2 +- .../qemucapabilitiesdata/caps_2.6.0.ppc64.replies | 100 ++++++-----------= -- tests/qemucapabilitiesdata/caps_2.6.0.ppc64.xml | 2 +- .../qemucapabilitiesdata/caps_2.6.0.x86_64.replies | 82 +++++++--------- tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.7.0.s390x.replies | 104 +++++------------= --- tests/qemucapabilitiesdata/caps_2.7.0.s390x.xml | 2 +- .../qemucapabilitiesdata/caps_2.7.0.x86_64.replies | 82 +++++++--------- tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.8.0.s390x.replies | 108 +++++------------= ---- tests/qemucapabilitiesdata/caps_2.8.0.s390x.xml | 2 +- .../qemucapabilitiesdata/caps_2.8.0.x86_64.replies | 82 +++++++--------- tests/qemucapabilitiesdata/caps_2.8.0.x86_64.xml | 2 +- .../qemucapabilitiesdata/caps_2.9.0.ppc64.replies | 100 ++++++-----------= -- tests/qemucapabilitiesdata/caps_2.9.0.ppc64.xml | 2 +- .../qemucapabilitiesdata/caps_2.9.0.s390x.replies | 108 +++++------------= ---- tests/qemucapabilitiesdata/caps_2.9.0.s390x.xml | 2 +- .../qemucapabilitiesdata/caps_2.9.0.x86_64.replies | 90 +++++++---------- tests/qemucapabilitiesdata/caps_2.9.0.x86_64.xml | 2 +- 53 files changed, 820 insertions(+), 1732 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index b5eb8cf46a..4dec0046df 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1838,25 +1838,25 @@ static struct virQEMUCapsObjectTypeProps virQEMUCap= sObjectProps[] =3D { -1 }, { "virtio-net-pci", virQEMUCapsObjectPropsVirtioNet, ARRAY_CARDINALITY(virQEMUCapsObjectPropsVirtioNet), - -1 }, + QEMU_CAPS_DEVICE_VIRTIO_NET }, { "virtio-scsi-pci", virQEMUCapsObjectPropsVirtioSCSI, ARRAY_CARDINALITY(virQEMUCapsObjectPropsVirtioSCSI), - -1 }, + QEMU_CAPS_VIRTIO_SCSI }, { "virtio-blk-ccw", virQEMUCapsObjectPropsVirtioBlk, ARRAY_CARDINALITY(virQEMUCapsObjectPropsVirtioBlk), - -1 }, + QEMU_CAPS_VIRTIO_CCW }, { "virtio-net-ccw", virQEMUCapsObjectPropsVirtioNet, ARRAY_CARDINALITY(virQEMUCapsObjectPropsVirtioNet), - -1 }, + QEMU_CAPS_DEVICE_VIRTIO_NET }, { "virtio-scsi-ccw", virQEMUCapsObjectPropsVirtioSCSI, ARRAY_CARDINALITY(virQEMUCapsObjectPropsVirtioSCSI), - -1 }, + QEMU_CAPS_VIRTIO_SCSI }, { "virtio-blk-s390", virQEMUCapsObjectPropsVirtioBlk, ARRAY_CARDINALITY(virQEMUCapsObjectPropsVirtioBlk), - -1 }, + QEMU_CAPS_VIRTIO_S390 }, { "virtio-net-s390", virQEMUCapsObjectPropsVirtioNet, ARRAY_CARDINALITY(virQEMUCapsObjectPropsVirtioNet), - -1 }, + QEMU_CAPS_DEVICE_VIRTIO_NET }, { "pci-assign", virQEMUCapsObjectPropsPCIAssign, ARRAY_CARDINALITY(virQEMUCapsObjectPropsPCIAssign), -1 }, @@ -1865,7 +1865,7 @@ static struct virQEMUCapsObjectTypeProps virQEMUCapsO= bjectProps[] =3D { -1 }, { "vfio-pci", virQEMUCapsObjectPropsVfioPCI, ARRAY_CARDINALITY(virQEMUCapsObjectPropsVfioPCI), - -1 }, + QEMU_CAPS_DEVICE_VFIO_PCI }, { "scsi-disk", virQEMUCapsObjectPropsSCSIDisk, ARRAY_CARDINALITY(virQEMUCapsObjectPropsSCSIDisk), -1 }, @@ -1877,13 +1877,13 @@ static struct virQEMUCapsObjectTypeProps virQEMUCap= sObjectProps[] =3D { -1 }, { "usb-redir", virQEMUCapsObjectPropsUSBRedir, ARRAY_CARDINALITY(virQEMUCapsObjectPropsUSBRedir), - -1 }, + QEMU_CAPS_USB_REDIR }, { "usb-host", virQEMUCapsObjectPropsUSBHost, ARRAY_CARDINALITY(virQEMUCapsObjectPropsUSBHost), -1 }, { "scsi-generic", virQEMUCapsObjectPropsSCSIGeneric, ARRAY_CARDINALITY(virQEMUCapsObjectPropsSCSIGeneric), - -1 }, + QEMU_CAPS_DEVICE_SCSI_GENERIC }, { "i440FX-pcihost", virQEMUCapsObjectPropsI440FXPCIHost, ARRAY_CARDINALITY(virQEMUCapsObjectPropsI440FXPCIHost), -1 }, @@ -1892,25 +1892,25 @@ static struct virQEMUCapsObjectTypeProps virQEMUCap= sObjectProps[] =3D { -1 }, { "usb-storage", virQEMUCapsObjectPropsUSBStorage, ARRAY_CARDINALITY(virQEMUCapsObjectPropsUSBStorage), - -1 }, + QEMU_CAPS_DEVICE_USB_STORAGE }, { "kvm-pit", virQEMUCapsObjectPropsKVMPit, ARRAY_CARDINALITY(virQEMUCapsObjectPropsKVMPit), -1 }, { "VGA", virQEMUCapsObjectPropsVGA, ARRAY_CARDINALITY(virQEMUCapsObjectPropsVGA), - -1 }, + QEMU_CAPS_DEVICE_VGA }, { "vmware-svga", virQEMUCapsObjectPropsVmwareSvga, ARRAY_CARDINALITY(virQEMUCapsObjectPropsVmwareSvga), - -1 }, + QEMU_CAPS_DEVICE_VMWARE_SVGA }, { "qxl", virQEMUCapsObjectPropsQxl, ARRAY_CARDINALITY(virQEMUCapsObjectPropsQxl), - -1 }, + QEMU_CAPS_DEVICE_QXL }, { "virtio-gpu-pci", virQEMUCapsObjectPropsVirtioGpu, ARRAY_CARDINALITY(virQEMUCapsObjectPropsVirtioGpu), - -1 }, + QEMU_CAPS_DEVICE_VIRTIO_GPU }, { "virtio-gpu-device", virQEMUCapsObjectPropsVirtioGpu, ARRAY_CARDINALITY(virQEMUCapsObjectPropsVirtioGpu), - -1 }, + QEMU_CAPS_DEVICE_VIRTIO_GPU }, { "ICH9-LPC", virQEMUCapsObjectPropsICH9, ARRAY_CARDINALITY(virQEMUCapsObjectPropsICH9), -1 }, @@ -1925,7 +1925,7 @@ static struct virQEMUCapsObjectTypeProps virQEMUCapsO= bjectProps[] =3D { -1 }, { "nec-usb-xhci", virQEMUCapsObjectPropsUSBNECXHCI, ARRAY_CARDINALITY(virQEMUCapsObjectPropsUSBNECXHCI), - -1 }, + QEMU_CAPS_NEC_USB_XHCI }, { "intel-iommu", virQEMUCapsObjectPropsIntelIOMMU, ARRAY_CARDINALITY(virQEMUCapsObjectPropsIntelIOMMU), QEMU_CAPS_DEVICE_INTEL_IOMMU }, --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 22:04:07 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 1520350173872866.700359261154; Tue, 6 Mar 2018 07:29:33 -0800 (PST) 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 576EC41A22; Tue, 6 Mar 2018 15:29:32 +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 213825D72F; Tue, 6 Mar 2018 15:29:32 +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 B9E2E4A473; Tue, 6 Mar 2018 15:29:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w26FTKdK003455 for ; Tue, 6 Mar 2018 10:29:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id 35F2E213AEFA; Tue, 6 Mar 2018 15:29:20 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D16BD213AEF8 for ; Tue, 6 Mar 2018 15:29:19 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 6 Mar 2018 16:29:14 +0100 Message-Id: <20180306152915.8518-3-abologna@redhat.com> In-Reply-To: <20180306152915.8518-1-abologna@redhat.com> References: <20180306152915.8518-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/3] qemu: Ignore subsequent attempts to probe device properties 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.30]); Tue, 06 Mar 2018 15:29:32 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In some cases, we are probing multiple devices for the same property and setting the corresponding capability if it's found on any of the devices: when that happens, we can quit early after finding the first property and avoiding a bunch of string comparisons. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 4dec0046df..853e8cefcf 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1978,6 +1978,9 @@ virQEMUCapsProcessStringFlags(virQEMUCapsPtr qemuCaps, { size_t i, j; for (i =3D 0; i < nflags; i++) { + if (virQEMUCapsGet(qemuCaps, flags[i].flag)) + continue; + for (j =3D 0; j < nvalues; j++) { if (STREQ(values[j], flags[i].value)) { virQEMUCapsSet(qemuCaps, flags[i].flag); --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 22:04:07 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 1520350180454243.6958240459794; Tue, 6 Mar 2018 07:29:40 -0800 (PST) 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 10CB290C99; Tue, 6 Mar 2018 15:29:39 +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 D5843605FB; Tue, 6 Mar 2018 15:29:37 +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 35330181A87E; Tue, 6 Mar 2018 15:29:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w26FTKnK003465 for ; Tue, 6 Mar 2018 10:29:20 -0500 Received: by smtp.corp.redhat.com (Postfix) id C8232213AEFA; Tue, 6 Mar 2018 15:29:20 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6F8F2213AEF8 for ; Tue, 6 Mar 2018 15:29:20 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 6 Mar 2018 16:29:15 +0100 Message-Id: <20180306152915.8518-4-abologna@redhat.com> In-Reply-To: <20180306152915.8518-1-abologna@redhat.com> References: <20180306152915.8518-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/3] qemu: Remove virQEMUCapsProcessProps() 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 06 Mar 2018 15:29:39 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This function was introduced in commit 41f5c2ca2776 as a way to probe the same property for multiple devices at once. Although the resulting representation is very compact, it doesn't provide any extra features compared to the existing virQEMUCapsProcessStringFlags() mechanism, which is already used for pretty much all device properties. Drop the custom function and datatypes and start using the standard ones instead. Note that, in theory, the end result is not identical because we're no longer probing properties for virtio-serial-pci virtio-9p-pci virtio-rng-pci virtio-input-host-pci virtio-keyboard-pci virtio-mouse-pci virtio-tablet-pci However, chances of any of those devices being compiled into a QEMU binary where virtio-balloon-pci virtio-blk-pci virtio-scsi-pci virtio-net-pci virtio-gpu-pci are compiled out are slim enough that it doesn't make any difference in practice, as the lack of test suite churn shows. Signed-off-by: Andrea Bolognani --- src/qemu/qemu_capabilities.c | 78 +++++++++-------------------------------= ---- 1 file changed, 15 insertions(+), 63 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 853e8cefcf..3eb5ed6d1a 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -1698,6 +1698,9 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[= ] =3D { =20 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[]= =3D { { "deflate-on-oom", QEMU_CAPS_VIRTIO_BALLOON_AUTODEFLATE }, + { "disable-legacy", QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY }, + { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM }, + { "ats", QEMU_CAPS_VIRTIO_PCI_ATS }, }; =20 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] =3D= { @@ -1709,6 +1712,9 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjec= tPropsVirtioBlk[] =3D { { "logical_block_size", QEMU_CAPS_BLOCKIO }, { "num-queues", QEMU_CAPS_VIRTIO_BLK_NUM_QUEUES }, { "share-rw", QEMU_CAPS_DISK_SHARE_RW }, + { "disable-legacy", QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY }, + { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM }, + { "ats", QEMU_CAPS_VIRTIO_PCI_ATS }, }; =20 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioNet[] =3D= { @@ -1717,6 +1723,9 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjec= tPropsVirtioNet[] =3D { { "rx_queue_size", QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE }, { "tx_queue_size", QEMU_CAPS_VIRTIO_NET_TX_QUEUE_SIZE }, { "host_mtu", QEMU_CAPS_VIRTIO_NET_HOST_MTU }, + { "disable-legacy", QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY }, + { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM }, + { "ats", QEMU_CAPS_VIRTIO_PCI_ATS }, }; =20 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsSpaprPCIHostBri= dge[] =3D { @@ -1725,6 +1734,9 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjec= tPropsSpaprPCIHostBridge[] =20 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioSCSI[] = =3D { { "iothread", QEMU_CAPS_VIRTIO_SCSI_IOTHREAD }, + { "disable-legacy", QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY }, + { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM }, + { "ats", QEMU_CAPS_VIRTIO_PCI_ATS }, }; =20 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsPCIAssign[] =3D= { @@ -1799,6 +1811,9 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjec= tPropsQxl[] =3D { static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioGpu[] =3D= { { "virgl", QEMU_CAPS_VIRTIO_GPU_VIRGL }, { "max_outputs", QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS }, + { "disable-legacy", QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY }, + { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM }, + { "ats", QEMU_CAPS_VIRTIO_PCI_ATS }, }; =20 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsICH9[] =3D { @@ -1934,40 +1949,6 @@ static struct virQEMUCapsObjectTypeProps virQEMUCaps= ObjectProps[] =3D { QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE }, }; =20 -struct virQEMUCapsPropTypeObjects { - const char *prop; - int flag; - const char **objects; -}; - -static const char *virQEMUCapsVirtioPCIObjects[] =3D { - "virtio-balloon-pci", - "virtio-blk-pci", - "virtio-scsi-pci", - "virtio-serial-pci", - "virtio-9p-pci", - "virtio-net-pci", - "virtio-rng-pci", - "virtio-gpu-pci", - "virtio-input-host-pci", - "virtio-keyboard-pci", - "virtio-mouse-pci", - "virtio-tablet-pci", - NULL -}; - -static struct virQEMUCapsPropTypeObjects virQEMUCapsPropObjects[] =3D { - { "disable-legacy", - QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, - virQEMUCapsVirtioPCIObjects }, - { "iommu_platform", - QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM, - virQEMUCapsVirtioPCIObjects }, - { "ats", - QEMU_CAPS_VIRTIO_PCI_ATS, - virQEMUCapsVirtioPCIObjects }, -}; - =20 static void virQEMUCapsProcessStringFlags(virQEMUCapsPtr qemuCaps, @@ -1991,31 +1972,6 @@ virQEMUCapsProcessStringFlags(virQEMUCapsPtr qemuCap= s, } =20 =20 -static void -virQEMUCapsProcessProps(virQEMUCapsPtr qemuCaps, - size_t nprops, - struct virQEMUCapsPropTypeObjects *props, - const char *object, - size_t nvalues, - char *const*values) -{ - size_t i, j; - - for (i =3D 0; i < nprops; i++) { - if (virQEMUCapsGet(qemuCaps, props[i].flag)) - continue; - - for (j =3D 0; j < nvalues; j++) { - if (STREQ(values[j], props[i].prop)) { - if (virStringListHasString(props[i].objects, object)) - virQEMUCapsSet(qemuCaps, props[i].flag); - break; - } - } - } -} - - #define OBJECT_TYPE_PREFIX "name \"" =20 static int @@ -2908,10 +2864,6 @@ virQEMUCapsProbeQMPObjects(virQEMUCapsPtr qemuCaps, virQEMUCapsObjectProps[i].nprops, virQEMUCapsObjectProps[i].props, nvalues, values); - virQEMUCapsProcessProps(qemuCaps, - ARRAY_CARDINALITY(virQEMUCapsPropObjects), - virQEMUCapsPropObjects, type, - nvalues, values); virStringListFreeCount(values, nvalues); } =20 --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list