Changeset
src/qemu/qemu_capabilities.c                       | 115 +++++++--------------
.../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, 838 insertions(+), 1795 deletions(-)
Git apply log
Switched to a new branch '20180306152915.8518-1-abologna@redhat.com'
Applying: qemu: Take full advantage of conditional device property probing
Applying: qemu: Ignore subsequent attempts to probe device properties
Applying: qemu: Remove virQEMUCapsProcessProps()
To https://github.com/patchew-project/libvirt
 * [new tag]             patchew/20180306152915.8518-1-abologna@redhat.com -> patchew/20180306152915.8518-1-abologna@redhat.com
Test passed: syntax-check

loading

[libvirt] [PATCH 0/3] qemu: Misc capabilities cleanups
Posted by Andrea Bolognani, 15 weeks ago
Please take a deep breath, concentrate and try to visualize a
blurb right below this sentence.


  ...


Did it work?


Andrea Bolognani (3):
  qemu: Take full advantage of conditional device property probing
  qemu: Ignore subsequent attempts to probe device properties
  qemu: Remove virQEMUCapsProcessProps()

 src/qemu/qemu_capabilities.c                       | 115 +++++++--------------
 .../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, 838 insertions(+), 1795 deletions(-)

-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 0/3] qemu: Misc capabilities cleanups
Posted by Ján Tomko, 15 weeks ago
On Tue, Mar 06, 2018 at 04:29:12PM +0100, Andrea Bolognani wrote:
>Please take a deep breath, concentrate and try to visualize a
>blurb right below this sentence.
>
>
>  ...
>
>
>Did it work?
>

Nah,

>
>Andrea Bolognani (3):
>  qemu: Take full advantage of conditional device property probing
>  qemu: Ignore subsequent attempts to probe device properties
>  qemu: Remove virQEMUCapsProcessProps()
>

ACK series

Jan
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 1/3] qemu: Take full advantage of conditional device property probing
Posted by Andrea Bolognani, 15 weeks ago
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 <abologna@redhat.com>
---
"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 virQEMUCapsObjectProps[] = {
       -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 virQEMUCapsObjectProps[] = {
       -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 virQEMUCapsObjectProps[] = {
       -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 virQEMUCapsObjectProps[] = {
       -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 virQEMUCapsObjectProps[] = {
       -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 },
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 2/3] qemu: Ignore subsequent attempts to probe device properties
Posted by Andrea Bolognani, 15 weeks ago
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 <abologna@redhat.com>
---
 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 = 0; i < nflags; i++) {
+        if (virQEMUCapsGet(qemuCaps, flags[i].flag))
+            continue;
+
         for (j = 0; j < nvalues; j++) {
             if (STREQ(values[j], flags[i].value)) {
                 virQEMUCapsSet(qemuCaps, flags[i].flag);
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
[libvirt] [PATCH 3/3] qemu: Remove virQEMUCapsProcessProps()
Posted by Andrea Bolognani, 15 weeks ago
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 <abologna@redhat.com>
---
 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[] = {
 
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[] = {
     { "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 },
 };
 
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
@@ -1709,6 +1712,9 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
     { "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 },
 };
 
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioNet[] = {
@@ -1717,6 +1723,9 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioNet[] = {
     { "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 },
 };
 
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsSpaprPCIHostBridge[] = {
@@ -1725,6 +1734,9 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsSpaprPCIHostBridge[]
 
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioSCSI[] = {
     { "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 },
 };
 
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsPCIAssign[] = {
@@ -1799,6 +1811,9 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsQxl[] = {
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioGpu[] = {
     { "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 },
 };
 
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsICH9[] = {
@@ -1934,40 +1949,6 @@ static struct virQEMUCapsObjectTypeProps virQEMUCapsObjectProps[] = {
       QEMU_CAPS_DEVICE_SPAPR_PCI_HOST_BRIDGE },
 };
 
-struct virQEMUCapsPropTypeObjects {
-    const char *prop;
-    int flag;
-    const char **objects;
-};
-
-static const char *virQEMUCapsVirtioPCIObjects[] = {
-     "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[] = {
-    { "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 },
-};
-
 
 static void
 virQEMUCapsProcessStringFlags(virQEMUCapsPtr qemuCaps,
@@ -1991,31 +1972,6 @@ virQEMUCapsProcessStringFlags(virQEMUCapsPtr qemuCaps,
 }
 
 
-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 = 0; i < nprops; i++) {
-        if (virQEMUCapsGet(qemuCaps, props[i].flag))
-            continue;
-
-        for (j = 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 \""
 
 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);
     }
 
-- 
2.14.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list