From patchwork Fri Jan 22 19:30:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 60203 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp51621lbb; Fri, 22 Jan 2016 11:33:49 -0800 (PST) X-Received: by 10.194.184.210 with SMTP id ew18mr4847713wjc.79.1453491210975; Fri, 22 Jan 2016 11:33:30 -0800 (PST) Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com. [209.132.183.24]) by mx.google.com with ESMTPS id 70si6005659wmv.76.2016.01.22.11.33.30 (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 22 Jan 2016 11:33:30 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u0MJUxbl010390; Fri, 22 Jan 2016 14:30:59 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u0MJUoJJ020000 for ; Fri, 22 Jan 2016 14:30:50 -0500 Received: from colepc.redhat.com (ovpn-113-198.phx2.redhat.com [10.3.113.198]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u0MJUaPd002518; Fri, 22 Jan 2016 14:30:49 -0500 From: Cole Robinson To: libvirt-list@redhat.com Date: Fri, 22 Jan 2016 14:30:31 -0500 Message-Id: <50f076c0068fc4f1b7faa9beca8a3c82e0d4cd06.1453489952.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 16/17] qemu: zap QEMU_CAPS_PCIDEVICE 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 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com 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(-) -- 2.5.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list 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);