From nobody Tue Feb 10 04:29:41 2026 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