[PATCH 16/17] qemu: zap QEMU_CAPS_PCIDEVICE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All code paths that use it are !QEMU_CAPS_DEVICE code paths, so they
will never be hit. This means we can drop it entirely.
---
 src/qemu/qemu_capabilities.c |  6 +---
 src/qemu/qemu_capabilities.h |  2 +-
 src/qemu/qemu_command.c      | 70 ++++++++++++++++++--------------------------
 src/qemu/qemu_hostdev.c      |  4 +--
 tests/qemuhelptest.c         |  5 ----
 tests/qemuxml2argvtest.c     | 31 +++++++++-----------
 6 files changed, 46 insertions(+), 72 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 8c29165..b5ed30c 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1143,8 +1143,6 @@ virQEMUCapsComputeCmdFlags(const char *help,
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_BOOT);
     if (strstr(help, "serial=s"))
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_DRIVE_SERIAL);
-    if (strstr(help, "-pcidevice"))
-        virQEMUCapsSet(qemuCaps, QEMU_CAPS_PCIDEVICE);
     if (strstr(help, "host=[seg:]bus"))
         virQEMUCapsSet(qemuCaps, QEMU_CAPS_HOST_PCI_MULTIDOMAIN);
     if (strstr(help, "-mem-path"))
@@ -4016,9 +4014,7 @@ virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps,
                                  VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO);
     }
 
-    if (supportsPassthroughKVM &&
-        (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCIDEVICE) ||
-         virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))) {
+    if (supportsPassthroughKVM) {
         VIR_DOMAIN_CAPS_ENUM_SET(hostdev->pciBackend,
                                  VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT,
                                  VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM);
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index bca4ef4..6ea8a78 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -69,7 +69,7 @@ typedef enum {
     /* 15 */
     X_QEMU_CAPS_VGA, /* Is -vga avail */
     X_QEMU_CAPS_0_10, /* features added in qemu-0.10.0 or later */
-    QEMU_CAPS_PCIDEVICE, /* PCI device assignment supported */
+    X_QEMU_CAPS_PCIDEVICE, /* -pcidevice supported */
     QEMU_CAPS_MEM_PATH, /* mmap'ped guest backing supported */
     QEMU_CAPS_DRIVE_SERIAL, /* -driver serial=  available */
 
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 4007621..1258ad4 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -10866,51 +10866,39 @@ qemuBuildCommandLine(virConnectPtr conn,
                 }
             }
 
-            if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
-                char *configfd_name = NULL;
-                int bootIndex = hostdev->info->bootIndex;
+            char *configfd_name = NULL;
+            int bootIndex = hostdev->info->bootIndex;
 
-                /* bootNet will be non-0 if boot order was set and no other
-                 * net devices were encountered
-                 */
-                if (hostdev->parent.type == VIR_DOMAIN_DEVICE_NET &&
-                    bootIndex == 0) {
-                    bootIndex = bootHostdevNet;
-                    bootHostdevNet = 0;
-                }
-                if ((backend != VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) &&
-                    virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_CONFIGFD)) {
-                    int configfd = qemuOpenPCIConfig(hostdev);
-
-                    if (configfd >= 0) {
-                        if (virAsprintf(&configfd_name, "%d", configfd) < 0) {
-                            VIR_FORCE_CLOSE(configfd);
-                            goto error;
-                        }
-
-                        virCommandPassFD(cmd, configfd,
-                                         VIR_COMMAND_PASS_FD_CLOSE_PARENT);
+            /* bootNet will be non-0 if boot order was set and no other
+             * net devices were encountered
+             */
+            if (hostdev->parent.type == VIR_DOMAIN_DEVICE_NET &&
+                bootIndex == 0) {
+                bootIndex = bootHostdevNet;
+                bootHostdevNet = 0;
+            }
+            if ((backend != VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) &&
+                virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCI_CONFIGFD)) {
+                int configfd = qemuOpenPCIConfig(hostdev);
+
+                if (configfd >= 0) {
+                    if (virAsprintf(&configfd_name, "%d", configfd) < 0) {
+                        VIR_FORCE_CLOSE(configfd);
+                        goto error;
                     }
+
+                    virCommandPassFD(cmd, configfd,
+                                     VIR_COMMAND_PASS_FD_CLOSE_PARENT);
                 }
-                virCommandAddArg(cmd, "-device");
-                devstr = qemuBuildPCIHostdevDevStr(def, hostdev, bootIndex,
-                                                   configfd_name, qemuCaps);
-                VIR_FREE(configfd_name);
-                if (!devstr)
-                    goto error;
-                virCommandAddArg(cmd, devstr);
-                VIR_FREE(devstr);
-            } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCIDEVICE)) {
-                virCommandAddArg(cmd, "-pcidevice");
-                if (!(devstr = qemuBuildPCIHostdevPCIDevStr(hostdev, qemuCaps)))
-                    goto error;
-                virCommandAddArg(cmd, devstr);
-                VIR_FREE(devstr);
-            } else {
-                virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                               _("PCI device assignment is not supported by this version of qemu"));
-                goto error;
             }
+            virCommandAddArg(cmd, "-device");
+            devstr = qemuBuildPCIHostdevDevStr(def, hostdev, bootIndex,
+                                               configfd_name, qemuCaps);
+            VIR_FREE(configfd_name);
+            if (!devstr)
+                goto error;
+            virCommandAddArg(cmd, devstr);
+            VIR_FREE(devstr);
         }
 
         /* SCSI */
diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c
index ca38a06..e16d5fd 100644
--- a/src/qemu/qemu_hostdev.c
+++ b/src/qemu/qemu_hostdev.c
@@ -197,9 +197,7 @@ qemuHostdevPreparePCIDevicesCheckSupport(virDomainHostdevDefPtr *hostdevs,
             if (supportsPassthroughVFIO &&
                 virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) {
                 *backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO;
-            } else if (supportsPassthroughKVM &&
-                       (virQEMUCapsGet(qemuCaps, QEMU_CAPS_PCIDEVICE) ||
-                        virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE))) {
+            } else if (supportsPassthroughKVM) {
                 *backend = VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM;
             } else {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 26455d5..73b813e 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -177,7 +177,6 @@ mymain(void)
             QEMU_CAPS_KVM,
             QEMU_CAPS_DRIVE_SERIAL,
             QEMU_CAPS_DRIVE_READONLY,
-            QEMU_CAPS_PCIDEVICE,
             QEMU_CAPS_MEM_PATH,
             QEMU_CAPS_CHARDEV,
             QEMU_CAPS_ENABLE_KVM,
@@ -225,7 +224,6 @@ mymain(void)
             QEMU_CAPS_KVM,
             QEMU_CAPS_DRIVE_SERIAL,
             QEMU_CAPS_DRIVE_READONLY,
-            QEMU_CAPS_PCIDEVICE,
             QEMU_CAPS_MEM_PATH,
             QEMU_CAPS_SDL,
             QEMU_CAPS_CHARDEV,
@@ -254,7 +252,6 @@ mymain(void)
             QEMU_CAPS_KVM,
             QEMU_CAPS_DRIVE_SERIAL,
             QEMU_CAPS_DRIVE_READONLY,
-            QEMU_CAPS_PCIDEVICE,
             QEMU_CAPS_MEM_PATH,
             QEMU_CAPS_SDL,
             QEMU_CAPS_CHARDEV,
@@ -312,7 +309,6 @@ mymain(void)
             QEMU_CAPS_KVM,
             QEMU_CAPS_DRIVE_SERIAL,
             QEMU_CAPS_DRIVE_READONLY,
-            QEMU_CAPS_PCIDEVICE,
             QEMU_CAPS_MEM_PATH,
             QEMU_CAPS_CHARDEV,
             QEMU_CAPS_ENABLE_KVM,
@@ -367,7 +363,6 @@ mymain(void)
             QEMU_CAPS_KVM,
             QEMU_CAPS_DRIVE_SERIAL,
             QEMU_CAPS_DRIVE_READONLY,
-            QEMU_CAPS_PCIDEVICE,
             QEMU_CAPS_MEM_PATH,
             QEMU_CAPS_CHARDEV,
             QEMU_CAPS_ENABLE_KVM,
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index d3454db..1c73e3f 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -676,7 +676,7 @@ mymain(void)
 
     DO_TEST("cpu-eoi-disabled", QEMU_CAPS_ENABLE_KVM);
     DO_TEST("cpu-eoi-enabled", QEMU_CAPS_ENABLE_KVM);
-    DO_TEST("controller-order", QEMU_CAPS_PCIDEVICE,
+    DO_TEST("controller-order",
             QEMU_CAPS_KVM, QEMU_CAPS_ENABLE_KVM,
             QEMU_CAPS_BOOT_MENU, QEMU_CAPS_PIIX3_USB_UHCI,
             QEMU_CAPS_PCI_MULTIFUNCTION, QEMU_CAPS_DRIVE_AIO,
@@ -990,21 +990,19 @@ mymain(void)
     DO_TEST("net-mcast", NONE);
     DO_TEST("net-udp", NONE);
     DO_TEST("net-hostdev",
-            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_NODEFCONFIG);
+            QEMU_CAPS_NODEFCONFIG);
     DO_TEST("net-hostdev-multidomain",
-            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_NODEFCONFIG,
             QEMU_CAPS_HOST_PCI_MULTIDOMAIN);
     DO_TEST_FAILURE("net-hostdev-multidomain",
-                    QEMU_CAPS_PCIDEVICE,
                     QEMU_CAPS_NODEFCONFIG);
     DO_TEST("net-hostdev-vfio",
-            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_NODEFCONFIG,
             QEMU_CAPS_DEVICE_VFIO_PCI);
     DO_TEST("net-hostdev-vfio-multidomain",
-            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_NODEFCONFIG,
             QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_HOST_PCI_MULTIDOMAIN);
     DO_TEST_FAILURE("net-hostdev-vfio-multidomain",
-                    QEMU_CAPS_PCIDEVICE,
                     QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VFIO_PCI);
 
     DO_TEST("serial-vc", NONE);
@@ -1231,20 +1229,19 @@ mymain(void)
     DO_TEST("hostdev-usb-address-device-boot",
             QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_BOOTINDEX,
             QEMU_CAPS_USB_HOST_BOOTINDEX);
-    DO_TEST("hostdev-pci-address", QEMU_CAPS_PCIDEVICE);
+    DO_TEST("hostdev-pci-address", NONE);
     DO_TEST("hostdev-pci-address-device",
-            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_NODEFCONFIG);
+            QEMU_CAPS_NODEFCONFIG);
     DO_TEST("hostdev-vfio",
-            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_NODEFCONFIG,
             QEMU_CAPS_DEVICE_VFIO_PCI);
     DO_TEST("hostdev-vfio-multidomain",
-            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_NODEFCONFIG,
             QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_HOST_PCI_MULTIDOMAIN);
     DO_TEST_FAILURE("hostdev-vfio-multidomain",
-                    QEMU_CAPS_PCIDEVICE,
                     QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_DEVICE_VFIO_PCI);
     DO_TEST("pci-rom",
-            QEMU_CAPS_PCIDEVICE, QEMU_CAPS_NODEFCONFIG,
+            QEMU_CAPS_NODEFCONFIG,
             QEMU_CAPS_PCI_ROMBAR);
 
     DO_TEST_FULL("restore-v2", "exec:cat", 7, 0, NONE);
@@ -1693,14 +1690,14 @@ mymain(void)
 
     DO_TEST("fips-enabled", QEMU_CAPS_ENABLE_FIPS);
 
-    DO_TEST("shmem", QEMU_CAPS_PCIDEVICE,
+    DO_TEST("shmem",
             QEMU_CAPS_DEVICE_IVSHMEM);
     DO_TEST_FAILURE("shmem", NONE);
-    DO_TEST_FAILURE("shmem-invalid-size", QEMU_CAPS_PCIDEVICE,
+    DO_TEST_FAILURE("shmem-invalid-size",
                     QEMU_CAPS_DEVICE_IVSHMEM);
-    DO_TEST_FAILURE("shmem-invalid-address", QEMU_CAPS_PCIDEVICE,
+    DO_TEST_FAILURE("shmem-invalid-address",
                     QEMU_CAPS_DEVICE_IVSHMEM);
-    DO_TEST_FAILURE("shmem-small-size", QEMU_CAPS_PCIDEVICE,
+    DO_TEST_FAILURE("shmem-small-size",
                     QEMU_CAPS_DEVICE_IVSHMEM);
     DO_TEST_PARSE_ERROR("shmem-msi-only", NONE);
     DO_TEST("cpu-host-passthrough-features", QEMU_CAPS_KVM, QEMU_CAPS_CPU_HOST);
-- 
2.5.0

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



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]