From nobody Thu May 2 21:07:22 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 ARC-Seal: i=1; a=rsa-sha256; t=1566311452; cv=none; d=zoho.com; s=zohoarc; b=aB1e9PBCp+BxVYF+RANxEFBVZKm8ElMZZZru0g8Bbvc1vPn+K2vgsbIeAXqBl34eUhM35C+i4iSpOyrQHW68CvdBKn78auvk7vD17VC9S2C1IgQiVVXXfAk3wYkcHiU3k7MV/Qia0yLle/p+XY+zgFpXzw1f/L69z05KGzXV/wQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566311452; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=KbN78w9TxT3i038o/FdJQSw3SNrDFHa+Kdi+1ysbEEk=; b=WPa2hQKjUvTyJEiO9+xl7gSmoMhsAxvq4a57aIGubosY4MJFI26YOv/tY73ciMP7O+/dVnH032jJSgnaxMLK37wcF2OzjfX428dKdnyb73bmwM3zoMxfQlOmPYMMNAm3wfChtqDiovr0vRY30P2W2MKgT+3gqye5P6OUZ9uHe9k= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15663114529421001.4305967457226; Tue, 20 Aug 2019 07:30:52 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B6C5A195DB84; Tue, 20 Aug 2019 14:30:51 +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 8B3045FCA6; Tue, 20 Aug 2019 14:30:51 +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 53D0824F31; Tue, 20 Aug 2019 14:30:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7KEUjjk028775 for ; Tue, 20 Aug 2019 10:30:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id E1BB66092F; Tue, 20 Aug 2019 14:30:45 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6916217AB5 for ; Tue, 20 Aug 2019 14:30:45 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 20 Aug 2019 16:30:21 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/12] qemu: Drop KVM assignment 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: , 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.62]); Tue, 20 Aug 2019 14:30:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" KVM style of PCI devices assignment was dropped in kernel in favor of vfio pci (see kernel commit v4.12-rc1~68^2~65). Since vfio is around for quite some time now and is far superior discourage people in using KVM style. Ideally, I'd make QEMU_CAPS_VFIO_PCI implicitly assumed but turns out qemu-3.0.0 doesn't support vfio-pci device for RISC-V. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko Tested-by: Daniel Henrique Barboza --- src/qemu/qemu_capabilities.c | 6 ----- src/qemu/qemu_command.c | 26 ++------------------- src/qemu/qemu_command.h | 1 - src/qemu/qemu_driver.c | 14 ++++-------- src/qemu/qemu_hostdev.c | 44 +++--------------------------------- src/qemu/qemu_hostdev.h | 1 - src/qemu/qemu_hotplug.c | 20 ++-------------- tests/domaincapstest.c | 3 +-- 8 files changed, 12 insertions(+), 103 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index c9677315ab..73300128ea 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5338,7 +5338,6 @@ static int virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPtr qemuCaps, virDomainCapsDeviceHostdevPtr hostd= ev) { - bool supportsPassthroughKVM =3D qemuHostdevHostSupportsPassthroughLega= cy(); bool supportsPassthroughVFIO =3D qemuHostdevHostSupportsPassthroughVFI= O(); =20 hostdev->supported =3D VIR_TRISTATE_BOOL_YES; @@ -5374,11 +5373,6 @@ virQEMUCapsFillDomainDeviceHostdevCaps(virQEMUCapsPt= r qemuCaps, VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO); } =20 - if (supportsPassthroughKVM) { - VIR_DOMAIN_CAPS_ENUM_SET(hostdev->pciBackend, - VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT, - VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM); - } return 0; } =20 diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index e3f4ef624b..f7b5430db8 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4904,7 +4904,6 @@ char * qemuBuildPCIHostdevDevStr(const virDomainDef *def, virDomainHostdevDefPtr dev, unsigned int bootIndex, /* used iff dev->info->b= ootIndex =3D=3D 0 */ - const char *configfd, virQEMUCapsPtr qemuCaps) { virBuffer buf =3D VIR_BUFFER_INITIALIZER; @@ -4913,16 +4912,11 @@ qemuBuildPCIHostdevDevStr(const virDomainDef *def, =20 /* caller has to assign proper passthrough backend type */ switch ((virDomainHostdevSubsysPCIBackendType)backend) { - case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM: - virBufferAddLit(&buf, "pci-assign"); - if (configfd && *configfd) - virBufferAsprintf(&buf, ",configfd=3D%s", configfd); - break; - case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO: virBufferAddLit(&buf, "vfio-pci"); break; =20 + case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM: case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT: case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN: case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST: @@ -5676,7 +5670,6 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd, } } =20 - char *configfd_name =3D NULL; unsigned int bootIndex =3D hostdev->info->bootIndex; =20 /* bootNet will be non-0 if boot order was set and no other @@ -5686,27 +5679,12 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd, bootIndex =3D *bootHostdevNet; *bootHostdevNet =3D 0; } - if (backend !=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) { - int configfd =3D qemuOpenPCIConfig(hostdev); - - if (configfd >=3D 0) { - if (virAsprintf(&configfd_name, "%d", configfd) < 0) { - VIR_FORCE_CLOSE(configfd); - return -1; - } - - virCommandPassFD(cmd, configfd, - VIR_COMMAND_PASS_FD_CLOSE_PARENT); - } - } =20 if (qemuCommandAddExtDevice(cmd, hostdev->info) < 0) return -1; =20 virCommandAddArg(cmd, "-device"); - devstr =3D qemuBuildPCIHostdevDevStr(def, hostdev, bootIndex, - configfd_name, qemuCaps); - VIR_FREE(configfd_name); + devstr =3D qemuBuildPCIHostdevDevStr(def, hostdev, bootIndex, = qemuCaps); if (!devstr) return -1; virCommandAddArg(cmd, devstr); diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index 7e2dc5a60a..e3983bedb2 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -148,7 +148,6 @@ char *qemuBuildMemoryDeviceStr(virDomainMemoryDefPtr me= m, char *qemuBuildPCIHostdevDevStr(const virDomainDef *def, virDomainHostdevDefPtr dev, unsigned int bootIndex, - const char *configfd, virQEMUCapsPtr qemuCaps); =20 char *qemuBuildRNGDevStr(const virDomainDef *def, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 11f97dbc65..eb373c14d7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -13517,7 +13517,6 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev, int ret =3D -1; virNodeDeviceDefPtr def =3D NULL; char *xml =3D NULL; - bool legacy =3D qemuHostdevHostSupportsPassthroughLegacy(); bool vfio =3D qemuHostdevHostSupportsPassthroughVFIO(); virHostdevManagerPtr hostdev_mgr =3D driver->hostdevMgr; =20 @@ -13544,8 +13543,6 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev, if (!driverName) { if (vfio) { driverName =3D "vfio"; - } else if (legacy) { - driverName =3D "kvm"; } else { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("neither VFIO nor KVM device assignment is " @@ -13563,13 +13560,10 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev, } virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_VFIO); } else if (STREQ(driverName, "kvm")) { - if (!legacy) { - virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("KVM device assignment is currently not " - "supported on this system")); - goto cleanup; - } - virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_KVM); + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", + _("KVM device assignment is currently not " + "supported on this system")); + goto cleanup; } else { virReportError(VIR_ERR_INVALID_ARG, _("unknown driver name '%s'"), driverName); diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index 92b037e1ed..af41c32679 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -133,44 +133,11 @@ qemuHostdevHostSupportsPassthroughVFIO(void) } =20 =20 -#if HAVE_LINUX_KVM_H -# include -bool -qemuHostdevHostSupportsPassthroughLegacy(void) -{ - int kvmfd =3D -1; - bool ret =3D false; - - if ((kvmfd =3D open("/dev/kvm", O_RDONLY)) < 0) - goto cleanup; - -# ifdef KVM_CAP_IOMMU - if ((ioctl(kvmfd, KVM_CHECK_EXTENSION, KVM_CAP_IOMMU)) <=3D 0) - goto cleanup; - - ret =3D true; -# endif - - cleanup: - VIR_FORCE_CLOSE(kvmfd); - - return ret; -} -#else -bool -qemuHostdevHostSupportsPassthroughLegacy(void) -{ - return false; -} -#endif - - static bool qemuHostdevPreparePCIDevicesCheckSupport(virDomainHostdevDefPtr *hostdevs, size_t nhostdevs, virQEMUCapsPtr qemuCaps) { - bool supportsPassthroughKVM =3D qemuHostdevHostSupportsPassthroughLega= cy(); bool supportsPassthroughVFIO =3D qemuHostdevHostSupportsPassthroughVFI= O(); size_t i; =20 @@ -189,8 +156,6 @@ qemuHostdevPreparePCIDevicesCheckSupport(virDomainHostd= evDefPtr *hostdevs, if (supportsPassthroughVFIO && virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VFIO_PCI)) { *backend =3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO; - } else if (supportsPassthroughKVM) { - *backend =3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM; } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("host doesn't support passthrough of " @@ -209,12 +174,9 @@ qemuHostdevPreparePCIDevicesCheckSupport(virDomainHost= devDefPtr *hostdevs, break; =20 case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM: - if (!supportsPassthroughKVM) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("host doesn't support legacy PCI passthro= ugh")); - return false; - } - + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("host doesn't support legacy PCI passthrough"= )); + return false; break; =20 case VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN: diff --git a/src/qemu/qemu_hostdev.h b/src/qemu/qemu_hostdev.h index f6d76c1c2a..e99c204961 100644 --- a/src/qemu/qemu_hostdev.h +++ b/src/qemu/qemu_hostdev.h @@ -24,7 +24,6 @@ #include "qemu_conf.h" #include "domain_conf.h" =20 -bool qemuHostdevHostSupportsPassthroughLegacy(void); bool qemuHostdevHostSupportsPassthroughVFIO(void); =20 int qemuHostdevUpdateActiveMediatedDevices(virQEMUDriverPtr driver, diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index d8be63b71c..63acb9c451 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1465,8 +1465,6 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, virDomainDeviceInfoPtr info =3D hostdev->info; int ret; char *devstr =3D NULL; - int configfd =3D -1; - char *configfd_name =3D NULL; bool releaseaddr =3D false; bool teardowncgroup =3D false; bool teardownlabel =3D false; @@ -1547,13 +1545,6 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr drive= r, if (qemuDomainEnsurePCIAddress(vm, &dev, driver) < 0) goto error; releaseaddr =3D true; - if (backend !=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) { - configfd =3D qemuOpenPCIConfig(hostdev); - if (configfd >=3D 0) { - if (virAsprintf(&configfd_name, "fd-%s", info->alias) < 0) - goto error; - } - } =20 if (!virDomainObjIsActive(vm)) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -1561,8 +1552,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, goto error; } =20 - if (!(devstr =3D qemuBuildPCIHostdevDevStr(vm->def, hostdev, 0, - configfd_name, priv->qemuCaps= ))) + if (!(devstr =3D qemuBuildPCIHostdevDevStr(vm->def, hostdev, 0, priv->= qemuCaps))) goto error; =20 qemuDomainObjEnterMonitor(driver, vm); @@ -1570,10 +1560,8 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr drive= r, if ((ret =3D qemuDomainAttachExtensionDevice(priv->mon, hostdev->info)= ) < 0) goto exit_monitor; =20 - if ((ret =3D qemuMonitorAddDeviceWithFd(priv->mon, devstr, - configfd, configfd_name)) < 0) { + if ((ret =3D qemuMonitorAddDevice(priv->mon, devstr)) < 0) ignore_value(qemuDomainDetachExtensionDevice(priv->mon, hostdev->i= nfo)); - } =20 exit_monitor: if (qemuDomainObjExitMonitor(driver, vm) < 0) @@ -1586,8 +1574,6 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, vm->def->hostdevs[vm->def->nhostdevs++] =3D hostdev; =20 VIR_FREE(devstr); - VIR_FREE(configfd_name); - VIR_FORCE_CLOSE(configfd); =20 return 0; =20 @@ -1607,8 +1593,6 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver, qemuHostdevReAttachPCIDevices(driver, vm->def->name, &hostdev, 1); =20 VIR_FREE(devstr); - VIR_FREE(configfd_name); - VIR_FORCE_CLOSE(configfd); =20 cleanup: return -1; diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index 45ecfe61ac..77acefa6b0 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -111,8 +111,7 @@ fillQemuCaps(virDomainCapsPtr domCaps, cfg->nfirmwares) < 0) goto cleanup; =20 - /* The function above tries to query host's KVM & VFIO capabilities by - * calling qemuHostdevHostSupportsPassthroughLegacy() and + /* The function above tries to query host's VFIO capabilities by calli= ng * qemuHostdevHostSupportsPassthroughVFIO() which, however, can't be * successfully mocked as they are not exposed as internal APIs. There= fore, * instead of mocking set the expected values here by hand. */ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 21:07:22 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 ARC-Seal: i=1; a=rsa-sha256; t=1566311456; cv=none; d=zoho.com; s=zohoarc; b=c5HirG39IqUCPJEEaS14IV9eJh0tD9NW6EJH8YbG1iAEOdXAMZnMKqst69VNp1PRU6VuOTdG7Z9zPTNT0yn1Pj+rFyPuDaYryDLFgd1//T1OTRCWc+qiE/mYz25GnBremV5GPtrJ8cTqk+2nNS8edkMzrTAWLSdy0ffmR1ypjBk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566311456; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=euYWkK+FQgRdtLdPQgxGa7SU62UJQgYzsVRIIq//Fvs=; b=mE/Ha72EsWdxBeDn0QfbEx/uKKhzzeN35XWApulYYoSlEy+9O/wI7RHnEsSoVCVDkAmKi6HNlMUmFpbzw7q+9z0eMDUIbyCV6dCnuPNHhTJprW2iHWxlALjhsj3MfTNsE7TbsUzFukVJETCG9WEmmYl+FvP8swHlKfGH+AoOwMM= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1566311456629537.1885842177049; Tue, 20 Aug 2019 07:30:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 774EC300BEB0; Tue, 20 Aug 2019 14:30:55 +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 492341690F; Tue, 20 Aug 2019 14:30:55 +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 F174F180BA9B; Tue, 20 Aug 2019 14:30:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7KEUkNK028783 for ; Tue, 20 Aug 2019 10:30:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id B050517AB5; Tue, 20 Aug 2019 14:30:46 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 399436092F for ; Tue, 20 Aug 2019 14:30:46 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 20 Aug 2019 16:30:22 +0200 Message-Id: <725ade79d1ccddbca65af93f339f6a0197523a32.1566311075.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/12] tests: Remove 'kvm' PCI backend from domaincapstest 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: , 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 20 Aug 2019 14:30:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The KVM assignment was removed in qemu driver in previous commit. Remove it from domaincapstest too which is hard coding it. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko Tested-by: Daniel Henrique Barboza --- tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml | 1 - tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml | 1 - tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml | 1 - tests/domaincapsschemadata/qemu_2.12.0.s390x.xml | 1 - tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml | 1 - tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml | 1 - tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml | 1 - tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml | 1 - tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml | 1 - tests/domaincapsschemadata/qemu_2.7.0.s390x.xml | 1 - tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml | 1 - tests/domaincapsschemadata/qemu_2.8.0.s390x.xml | 1 - tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml | 1 - tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml | 1 - tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml | 1 - tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml | 1 - tests/domaincapsschemadata/qemu_3.0.0.s390x.xml | 1 - tests/domaincapsschemadata/qemu_3.1.0.x86_64.xml | 1 - tests/domaincapsschemadata/qemu_4.0.0.s390x.xml | 1 - tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml | 1 - tests/domaincapsschemadata/qemu_4.1.0.x86_64.xml | 1 - tests/domaincapstest.c | 1 - 22 files changed, 22 deletions(-) diff --git a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml b/tests/domai= ncapsschemadata/qemu_1.7.0.x86_64.xml index f14f245007..a2df336833 100644 --- a/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_1.7.0.x86_64.xml @@ -112,7 +112,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml b/test= s/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml index cc65977f03..ed1af3224b 100644 --- a/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml +++ b/tests/domaincapsschemadata/qemu_2.12.0-virt.aarch64.xml @@ -116,7 +116,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml b/tests/domai= ncapsschemadata/qemu_2.12.0.ppc64.xml index 8c490fa4d1..99de2b0a8e 100644 --- a/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml +++ b/tests/domaincapsschemadata/qemu_2.12.0.ppc64.xml @@ -80,7 +80,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml b/tests/domai= ncapsschemadata/qemu_2.12.0.s390x.xml index 18171f0db4..8d039f3514 100644 --- a/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml +++ b/tests/domaincapsschemadata/qemu_2.12.0.s390x.xml @@ -172,7 +172,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml b/tests/doma= incapsschemadata/qemu_2.12.0.x86_64.xml index 146041a6c1..109162ffd8 100644 --- a/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.12.0.x86_64.xml @@ -145,7 +145,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml b/tests= /domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml index 778e27582f..13441b9923 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0-virt.aarch64.xml @@ -113,7 +113,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml b/tests/doma= incapsschemadata/qemu_2.6.0.aarch64.xml index a01f5ef72f..974739c38e 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0.aarch64.xml @@ -111,7 +111,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml b/tests/domain= capsschemadata/qemu_2.6.0.ppc64.xml index a74cece8b6..9f628a3652 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0.ppc64.xml @@ -84,7 +84,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml b/tests/domai= ncapsschemadata/qemu_2.6.0.x86_64.xml index 949c5f8723..bb1f784328 100644 --- a/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.6.0.x86_64.xml @@ -119,7 +119,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml b/tests/domain= capsschemadata/qemu_2.7.0.s390x.xml index 8c66d6582a..322d12c719 100644 --- a/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml +++ b/tests/domaincapsschemadata/qemu_2.7.0.s390x.xml @@ -77,7 +77,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml b/tests/d= omaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml index 6fa74e29b0..b6679a6e64 100644 --- a/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.8.0-tcg.x86_64.xml @@ -120,7 +120,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml b/tests/domain= capsschemadata/qemu_2.8.0.s390x.xml index d27977242a..c7a4578f61 100644 --- a/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml +++ b/tests/domaincapsschemadata/qemu_2.8.0.s390x.xml @@ -158,7 +158,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml b/tests/domai= ncapsschemadata/qemu_2.8.0.x86_64.xml index b39aecb52b..3af3fcc4a9 100644 --- a/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.8.0.x86_64.xml @@ -120,7 +120,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml b/tests/d= omaincapsschemadata/qemu_2.9.0-q35.x86_64.xml index 66b4a84c3f..aac295a20d 100644 --- a/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.9.0-q35.x86_64.xml @@ -129,7 +129,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml b/tests/d= omaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml index e41571e11a..12537c039b 100644 --- a/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.9.0-tcg.x86_64.xml @@ -152,7 +152,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml b/tests/domai= ncapsschemadata/qemu_2.9.0.x86_64.xml index f9a8c490aa..80fc7e1657 100644 --- a/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_2.9.0.x86_64.xml @@ -129,7 +129,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml b/tests/domain= capsschemadata/qemu_3.0.0.s390x.xml index 6dd5da07a5..0e81e2ea33 100644 --- a/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml +++ b/tests/domaincapsschemadata/qemu_3.0.0.s390x.xml @@ -178,7 +178,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_3.1.0.x86_64.xml b/tests/domai= ncapsschemadata/qemu_3.1.0.x86_64.xml index 1958eb9beb..402848442f 100644 --- a/tests/domaincapsschemadata/qemu_3.1.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_3.1.0.x86_64.xml @@ -147,7 +147,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_4.0.0.s390x.xml b/tests/domain= capsschemadata/qemu_4.0.0.s390x.xml index 30062a2b23..e68f8e8d9a 100644 --- a/tests/domaincapsschemadata/qemu_4.0.0.s390x.xml +++ b/tests/domaincapsschemadata/qemu_4.0.0.s390x.xml @@ -184,7 +184,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml b/tests/domai= ncapsschemadata/qemu_4.0.0.x86_64.xml index 8c6a622afe..1ffd5e3cc0 100644 --- a/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_4.0.0.x86_64.xml @@ -147,7 +147,6 @@ default - kvm vfio diff --git a/tests/domaincapsschemadata/qemu_4.1.0.x86_64.xml b/tests/domai= ncapsschemadata/qemu_4.1.0.x86_64.xml index 80ce931fbf..79b41ef6da 100644 --- a/tests/domaincapsschemadata/qemu_4.1.0.x86_64.xml +++ b/tests/domaincapsschemadata/qemu_4.1.0.x86_64.xml @@ -151,7 +151,6 @@ default - kvm vfio diff --git a/tests/domaincapstest.c b/tests/domaincapstest.c index 77acefa6b0..dc50b326f3 100644 --- a/tests/domaincapstest.c +++ b/tests/domaincapstest.c @@ -117,7 +117,6 @@ fillQemuCaps(virDomainCapsPtr domCaps, * instead of mocking set the expected values here by hand. */ VIR_DOMAIN_CAPS_ENUM_SET(domCaps->hostdev.pciBackend, VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT, - VIR_DOMAIN_HOSTDEV_PCI_BACKEND_KVM, VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO); =20 /* As of f05b6a918e28 we are expecting to see OVMF_CODE.fd file which --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 21:07:22 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 ARC-Seal: i=1; a=rsa-sha256; t=1566311450; cv=none; d=zoho.com; s=zohoarc; b=F9Z390NwmuSEKvzNWesOiYjiiPJUYf9b2qLt0v1yVipPB3xrbgAICLquroMsXX+8k1gfos3UuQQurPeG1oT1+DeD82/cdBJ0ueG1xPHvUhMRBUSW4pIK3s1xwjYOQ+4i4opKHmMp3CPcAAAvc53RkX5ZYwX4RC4HX82mTc4sKBE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566311450; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=6K3Bp0fbuMWIU9ufuyTjlIfalPQ1l+bCBJCzV5pbJGU=; b=GJg67XiHpq8r4ib7dUOXmAqZABprvL5HzeKMtcUiITWdNv3BPNuzVmQY5FF/wYnT/CVrQ4iCPiQQjwjJ6JxVDQveXlLJvRleVeehI45TcNtwBw0SxyH97+aPcficsxIpYoZdzWPW0pA3S3lzU64k7NJQfBWd6bRqtOGKgpwvbJ0= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1566311450254407.39202933134845; Tue, 20 Aug 2019 07:30:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 10E47300183E; Tue, 20 Aug 2019 14:30:49 +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 C7AA43DE5; Tue, 20 Aug 2019 14:30:48 +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 889FF18005C7; Tue, 20 Aug 2019 14:30:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7KEUlm9028790 for ; Tue, 20 Aug 2019 10:30:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 806C657990; Tue, 20 Aug 2019 14:30:47 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0923617AB5 for ; Tue, 20 Aug 2019 14:30:46 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 20 Aug 2019 16:30:23 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/12] virhostdev: Unify virDomainHostdevDef to virPCIDevice translation 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 20 Aug 2019 14:30:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" There are two places where we need to create virPCIDevice from given virDomainHostdevDef. In both places the code is duplicated. Move them into a single function and call it from those two places. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko Tested-by: Daniel Henrique Barboza --- src/util/virhostdev.c | 93 +++++++++++++++++++++++++------------------ 1 file changed, 54 insertions(+), 39 deletions(-) diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index 6861b8a84e..e3f48a9a2e 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -212,6 +212,51 @@ virHostdevManagerGetDefault(void) return virObjectRef(manager); } =20 +/** + * virHostdevGetPCIHostDevice: + * @hostdev: domain hostdev definition + * @pci: returned PCI device + * + * For given @hostdev which represents a PCI device construct its + * virPCIDevice representation and returned it in @pci. If + * @hostdev does not represent a PCI device then @pci is set to + * NULL and 0 is returned. + * + * Returns: 0 on success (@pci might be NULL though), + * -1 otherwise (with error reported). + */ +static int +virHostdevGetPCIHostDevice(const virDomainHostdevDef *hostdev, + virPCIDevicePtr *pci) +{ + VIR_AUTOPTR(virPCIDevice) actual =3D NULL; + const virDomainHostdevSubsysPCI *pcisrc =3D &hostdev->source.subsys.u.= pci; + + *pci =3D NULL; + + if (hostdev->mode !=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS || + hostdev->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PC= I) + return 0; + + actual =3D virPCIDeviceNew(pcisrc->addr.domain, pcisrc->addr.bus, + pcisrc->addr.slot, pcisrc->addr.function); + + if (!actual) + return -1; + + virPCIDeviceSetManaged(actual, hostdev->managed); + + if (pcisrc->backend =3D=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) + virPCIDeviceSetStubDriver(actual, VIR_PCI_STUB_DRIVER_VFIO); + else if (pcisrc->backend =3D=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN) + virPCIDeviceSetStubDriver(actual, VIR_PCI_STUB_DRIVER_XEN); + else + virPCIDeviceSetStubDriver(actual, VIR_PCI_STUB_DRIVER_KVM); + + VIR_STEAL_PTR(*pci, actual); + return 0; +} + static virPCIDeviceListPtr virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *hostdevs, int nhost= devs) { @@ -223,27 +268,13 @@ virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr= *hostdevs, int nhostdevs) =20 for (i =3D 0; i < nhostdevs; i++) { virDomainHostdevDefPtr hostdev =3D hostdevs[i]; - virDomainHostdevSubsysPCIPtr pcisrc =3D &hostdev->source.subsys.u.= pci; VIR_AUTOPTR(virPCIDevice) pci =3D NULL; =20 - if (hostdev->mode !=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) - continue; - if (hostdev->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYP= E_PCI) - continue; + if (virHostdevGetPCIHostDevice(hostdev, &pci) < 0) + return NULL; =20 - pci =3D virPCIDeviceNew(pcisrc->addr.domain, pcisrc->addr.bus, - pcisrc->addr.slot, pcisrc->addr.function); if (!pci) - return NULL; - - virPCIDeviceSetManaged(pci, hostdev->managed); - - if (pcisrc->backend =3D=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) - virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_VFIO); - else if (pcisrc->backend =3D=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN) - virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_XEN); - else - virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_KVM); + continue; =20 if (virPCIDeviceListAdd(pcidevs, pci) < 0) return NULL; @@ -253,7 +284,6 @@ virHostdevGetPCIHostDeviceList(virDomainHostdevDefPtr *= hostdevs, int nhostdevs) VIR_RETURN_PTR(pcidevs); } =20 - static int virHostdevPCISysfsPath(virDomainHostdevDefPtr hostdev, char **sysfs_path) @@ -1067,7 +1097,6 @@ virHostdevUpdateActivePCIDevices(virHostdevManagerPtr= mgr, const char *drv_name, const char *dom_name) { - virDomainHostdevDefPtr hostdev =3D NULL; size_t i; int ret =3D -1; =20 @@ -1078,32 +1107,18 @@ virHostdevUpdateActivePCIDevices(virHostdevManagerP= tr mgr, virObjectLock(mgr->inactivePCIHostdevs); =20 for (i =3D 0; i < nhostdevs; i++) { + const virDomainHostdevDef *hostdev =3D hostdevs[i]; VIR_AUTOPTR(virPCIDevice) actual =3D NULL; - virDomainHostdevSubsysPCIPtr pcisrc; - hostdev =3D hostdevs[i]; - pcisrc =3D &hostdev->source.subsys.u.pci; =20 - if (hostdev->mode !=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) - continue; - if (hostdev->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYP= E_PCI) - continue; - - actual =3D virPCIDeviceNew(pcisrc->addr.domain, pcisrc->addr.bus, - pcisrc->addr.slot, pcisrc->addr.function); + if (virHostdevGetPCIHostDevice(hostdev, &actual) < 0) + goto cleanup; =20 if (!actual) + continue; + + if (virPCIDeviceSetUsedBy(actual, drv_name, dom_name) < 0) goto cleanup; =20 - virPCIDeviceSetManaged(actual, hostdev->managed); - virPCIDeviceSetUsedBy(actual, drv_name, dom_name); - - if (pcisrc->backend =3D=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) - virPCIDeviceSetStubDriver(actual, VIR_PCI_STUB_DRIVER_VFIO); - else if (pcisrc->backend =3D=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN) - virPCIDeviceSetStubDriver(actual, VIR_PCI_STUB_DRIVER_XEN); - else - virPCIDeviceSetStubDriver(actual, VIR_PCI_STUB_DRIVER_KVM); - /* Setup the original states for the PCI device */ virPCIDeviceSetUnbindFromStub(actual, hostdev->origstates.states.p= ci.unbind_from_stub); virPCIDeviceSetRemoveSlot(actual, hostdev->origstates.states.pci.r= emove_slot); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 21:07:22 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 ARC-Seal: i=1; a=rsa-sha256; t=1566311461; cv=none; d=zoho.com; s=zohoarc; b=f8f0UP9h5mXw1EyqQX0ARTSquMAnYTAaNHeHbd4vgkdg2Do7cy/qGLKGoxkngCc9abJozaNwNhkWhS9GITBtRFSDpb8XWkL/cTntjbaSyT0awj8cMMikvnFtZtClUbN7Q3noLAF6V0pVjX5M2dQcOY+4gV/Q0gPiEvhDTdcvXl4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566311461; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=aZMqj/P93V8ayqDrvv+p36QyYXHwVKGclff9Bf4Y/uo=; b=UvCtENS04fIpnsQoovgsbwC2v3anGrwNOWoyGvU17yhL7UkuFGtv9D0L84FAU1qyePw14QQ+MIvmprUazUBlS8XqmOC73GoXZMuvL0EPvNn+wxfNE17pO9hu3ywutOBDUgnGhAliBm3Nw88DDRq82j7HhR39VLlCCH8cAE6TqSY= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1566311461747489.20519095887437; Tue, 20 Aug 2019 07:31:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 801BD898102; Tue, 20 Aug 2019 14:31:00 +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 5546460C4E; Tue, 20 Aug 2019 14:31:00 +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 0F135180BA99; Tue, 20 Aug 2019 14:31:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7KEUmgN028795 for ; Tue, 20 Aug 2019 10:30:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4E90C1F0; Tue, 20 Aug 2019 14:30:48 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC58C17AB5 for ; Tue, 20 Aug 2019 14:30:47 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 20 Aug 2019 16:30:24 +0200 Message-Id: <31e31b25abbeba63a23215cf7e57a4bc6223f774.1566311075.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/12] qemu: Drop unused qemuOpenPCIConfig() 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: , 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.67]); Tue, 20 Aug 2019 14:31:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" After previous commits, the function is not used anymore. Remove it. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko Tested-by: Daniel Henrique Barboza --- src/qemu/qemu_command.c | 22 ---------------------- src/qemu/qemu_command.h | 2 -- 2 files changed, 24 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f7b5430db8..500ffff035 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4878,28 +4878,6 @@ qemuBuildVideoCommandLine(virCommandPtr cmd, } =20 =20 -int -qemuOpenPCIConfig(virDomainHostdevDefPtr dev) -{ - virDomainHostdevSubsysPCIPtr pcisrc =3D &dev->source.subsys.u.pci; - char *path =3D NULL; - int configfd =3D -1; - - if (virAsprintf(&path, "/sys/bus/pci/devices/%04x:%02x:%02x.%01x/confi= g", - pcisrc->addr.domain, pcisrc->addr.bus, - pcisrc->addr.slot, pcisrc->addr.function) < 0) - return -1; - - configfd =3D open(path, O_RDWR, 0); - - if (configfd < 0) - virReportSystemError(errno, _("Failed opening %s"), path); - - VIR_FREE(path); - - return configfd; -} - char * qemuBuildPCIHostdevDevStr(const virDomainDef *def, virDomainHostdevDefPtr dev, diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index e3983bedb2..6f97e7bc0c 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -157,8 +157,6 @@ int qemuBuildRNGBackendProps(virDomainRNGDefPtr rng, virQEMUCapsPtr qemuCaps, virJSONValuePtr *props); =20 -int qemuOpenPCIConfig(virDomainHostdevDefPtr dev); - /* Current, best practice */ char *qemuBuildUSBHostdevDevStr(const virDomainDef *def, virDomainHostdevDefPtr dev, --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 21:07:22 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 ARC-Seal: i=1; a=rsa-sha256; t=1566311453; cv=none; d=zoho.com; s=zohoarc; b=ocERX0WMsm7YVCb59/R8BwQwSOTWRMAqSFtKpyTBM7len5jgErb2jAdlxFWWM6tl4RVJbtWEqcB0+2eeWDvXWoCX0oPBaRzdU+1yn1x62AEpTnyaJAvS3DvaDzZ93HpRKg13/8zmfR0kmNl8crSmF1dYHftu3iMPKfxAyG9Bleg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566311453; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=mb3ViuRzIXV9IUrOrWe3ex7arRwQkn7U/GdZiQ+Xc5s=; b=VzEASAiR2c3U1aHX4MxISjS+4gEGtc0iWuSt4bkXwj7Mdvb2rHsdIxFkyuX/vxgG2kMlsFzPHhf1q/2xOGsrmWSr0jd4G/3yXUHXYGYl0foq0qrP4PgjJAyywOMN9TTIJ/6jACnIL1iASEwHHHhtQpIlMaCytusMNMGvpM2moRg= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1566311453238640.6314605542357; Tue, 20 Aug 2019 07:30:53 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D644F3001A9A; Tue, 20 Aug 2019 14:30:51 +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 AED6410016EA; Tue, 20 Aug 2019 14:30:51 +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 73773180B536; Tue, 20 Aug 2019 14:30:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7KEUnVT028803 for ; Tue, 20 Aug 2019 10:30:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1E0B11F0; Tue, 20 Aug 2019 14:30:49 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9BBB717AB5 for ; Tue, 20 Aug 2019 14:30:48 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 20 Aug 2019 16:30:25 +0200 Message-Id: <65a4c7140f130cac3e3fe75cbc3d7911728d74b0.1566311075.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/12] virhostdev: Disable legacy kvm assignment 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 20 Aug 2019 14:30:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The KVM assignment is going to be removed shortly. Don't let the hostdev module configure it. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko Tested-by: Daniel Henrique Barboza --- src/util/virhostdev.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index e3f48a9a2e..29e75ffc84 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -246,12 +246,16 @@ virHostdevGetPCIHostDevice(const virDomainHostdevDef = *hostdev, =20 virPCIDeviceSetManaged(actual, hostdev->managed); =20 - if (pcisrc->backend =3D=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) + if (pcisrc->backend =3D=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) { virPCIDeviceSetStubDriver(actual, VIR_PCI_STUB_DRIVER_VFIO); - else if (pcisrc->backend =3D=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN) + } else if (pcisrc->backend =3D=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_XEN) { virPCIDeviceSetStubDriver(actual, VIR_PCI_STUB_DRIVER_XEN); - else - virPCIDeviceSetStubDriver(actual, VIR_PCI_STUB_DRIVER_KVM); + } else { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("pci backend driver '%s' is not supported"), + virDomainHostdevSubsysPCIBackendTypeToString(pcisrc= ->backend)); + return -1; + } =20 VIR_STEAL_PTR(*pci, actual); return 0; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 21:07:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1566311465; cv=none; d=zoho.com; s=zohoarc; b=ALH+g21xM6LTNt3Pb7uEZFZSxrvNuklUQkRYF1DtjF1IrtoNVI4K2b5vnCnlvKJExMMTKg6ppFwt19cvpx8QljA/APtO6FFqViPLfOMgI/ePR/BAPGodXR7radOWuUY1Ugnb3VOkLQ8CuMhAfeGn2sQF/wkrdz4UJ/wbL8dNdHE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566311465; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=P945ufqmh1HQQwjq9d5tt5zw0DzwITBxTCoNjBAwKik=; b=TX0J0h/L0kkUF/OgDIfjn2KUmDXjv6GaGFxQM5Y+zIFa4JJu4nsof8zh0S1BRrnnUHSqKRMvqG5AAORYxFzD+3Q9ZljDYM69+qN/em2hH+vzoB4RMetcjBpm+8ZojhMYYn0xQQvNGiWbtNJ4Cud9XUgrHMYzmH/o8+1RrtsVJr8= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1566311465428980.5498494595256; Tue, 20 Aug 2019 07:31:05 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 476991801594; Tue, 20 Aug 2019 14:31:04 +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 161105FCA6; Tue, 20 Aug 2019 14:31:04 +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 B74C9180BA9E; Tue, 20 Aug 2019 14:31:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7KEUnek028813 for ; Tue, 20 Aug 2019 10:30:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id E063A438B; Tue, 20 Aug 2019 14:30:49 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A6B61F0 for ; Tue, 20 Aug 2019 14:30:49 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 20 Aug 2019 16:30:26 +0200 Message-Id: <32e157b8051be93fe86c892b43bd27dd776571ed.1566311075.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/12] virpci: Drop 'pci-stub' driver 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: , 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Tue, 20 Aug 2019 14:31:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Now that no one uses KVM style of PCI assignment we can safely remove 'pci-stub' backend. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko Tested-by: Daniel Henrique Barboza --- src/util/virpci.c | 11 ----------- src/util/virpci.h | 1 - 2 files changed, 12 deletions(-) diff --git a/src/util/virpci.c b/src/util/virpci.c index 4c7c26f981..9c9ffa55c2 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -54,7 +54,6 @@ VIR_ENUM_IMPL(virPCIStubDriver, VIR_PCI_STUB_DRIVER_LAST, "none", "pciback", /* XEN */ - "pci-stub", /* KVM */ "vfio-pci", /* VFIO */ ); =20 @@ -1541,16 +1540,6 @@ virPCIDeviceReattach(virPCIDevicePtr dev, return -1; } =20 - /* Wait for device cleanup if it is qemu/kvm */ - if (virPCIDeviceGetStubDriver(dev) =3D=3D VIR_PCI_STUB_DRIVER_KVM) { - int retries =3D 100; - while (virPCIDeviceWaitForCleanup(dev, "kvm_assigned_device") - && retries) { - usleep(100*1000); - retries--; - } - } - if (virPCIDeviceUnbindFromStub(dev) < 0) return -1; =20 diff --git a/src/util/virpci.h b/src/util/virpci.h index 5074851777..4ac0d230a4 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -59,7 +59,6 @@ struct _virPCIDeviceAddress { typedef enum { VIR_PCI_STUB_DRIVER_NONE =3D 0, VIR_PCI_STUB_DRIVER_XEN, - VIR_PCI_STUB_DRIVER_KVM, VIR_PCI_STUB_DRIVER_VFIO, VIR_PCI_STUB_DRIVER_LAST } virPCIStubDriver; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 21:07:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1566311456; cv=none; d=zoho.com; s=zohoarc; b=lKsqJtXiwgLQ5h8Q/VPmrmRffIOMT6FFdt9Cuq2tvv/8aTrd4p+ocfCmaACjoPMiNLhR04jjWn898x4zJu5eOQzTupYdLuVieYVpEd1K8wPFe985Yor6wCCp05f9cJPipxgUUZC7r5sgET/5eUzw9JHiBcggzNhe+MARRwXimzY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566311456; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=utqpNtGB20JT9z0R9hPnh9sBMdYevpYh8DU68ueYKhc=; b=jmR0zpe209zJJPJOCSqRcnPfl1iTas5DlHbkcBWxLV26BDyyGrme07dwqyrr/8zUF+1WrTGyxlCuwMyytVVlBLRbWzvyXcV7ZaNj8mznCd/QfsCxLnmS+Yw3+Cj8paifVhITtNkVpFlmiVDIlJalqgKC8gBRnwLF50KcYwfNrMg= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1566311456789840.0367080685228; Tue, 20 Aug 2019 07:30:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6FE8810F23EF; Tue, 20 Aug 2019 14:30:55 +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 4811E5C686; Tue, 20 Aug 2019 14:30:55 +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 0807224F32; Tue, 20 Aug 2019 14:30:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7KEUoIh028825 for ; Tue, 20 Aug 2019 10:30:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id B145E438B; Tue, 20 Aug 2019 14:30:50 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 384EA1F0 for ; Tue, 20 Aug 2019 14:30:50 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 20 Aug 2019 16:30:27 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/12] virpci: Remove unused virPCIDeviceWaitForCleanup 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: , 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.66]); Tue, 20 Aug 2019 14:30:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This function is no longer used after previous commit. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko Tested-by: Daniel Henrique Barboza --- src/libvirt_private.syms | 1 - src/util/virpci.c | 108 --------------------------------------- src/util/virpci.h | 1 - 3 files changed, 110 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 9db4ac7933..6c57351866 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2696,7 +2696,6 @@ virPCIDeviceSetStubDriver; virPCIDeviceSetUnbindFromStub; virPCIDeviceSetUsedBy; virPCIDeviceUnbind; -virPCIDeviceWaitForCleanup; virPCIEDeviceInfoFree; virPCIELinkSpeedTypeFromString; virPCIELinkSpeedTypeToString; diff --git a/src/util/virpci.c b/src/util/virpci.c index 9c9ffa55c2..ea5be62033 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -1552,114 +1552,6 @@ virPCIDeviceReattach(virPCIDevicePtr dev, return 0; } =20 -/* Certain hypervisors (like qemu/kvm) map the PCI bar(s) on - * the host when doing device passthrough. This can lead to a race - * condition where the hypervisor is still cleaning up the device while - * libvirt is trying to re-attach it to the host device driver. To avoid - * this situation, we look through /proc/iomem, and if the hypervisor is - * still holding on to the bar (denoted by the string in the matcher - * variable), then we can wait around a bit for that to clear up. - * - * A typical /proc/iomem looks like this (snipped for brevity): - * 00010000-0008efff : System RAM - * 0008f000-0008ffff : reserved - * ... - * 00100000-cc9fcfff : System RAM - * 00200000-00483d3b : Kernel code - * 00483d3c-005c88df : Kernel data - * cc9fd000-ccc71fff : ACPI Non-volatile Storage - * ... - * d0200000-d02fffff : PCI Bus #05 - * d0200000-d021ffff : 0000:05:00.0 - * d0200000-d021ffff : e1000e - * d0220000-d023ffff : 0000:05:00.0 - * d0220000-d023ffff : e1000e - * ... - * f0000000-f0003fff : 0000:00:1b.0 - * f0000000-f0003fff : kvm_assigned_device - * - * Returns 0 if we are clear to continue, and 1 if the hypervisor is still - * holding on to the resource. - */ -int -virPCIDeviceWaitForCleanup(virPCIDevicePtr dev, const char *matcher) -{ - FILE *fp; - char line[160]; - char *tmp; - unsigned long long start, end; - unsigned int domain, bus, slot, function; - bool in_matching_device; - int ret; - size_t match_depth; - - fp =3D fopen("/proc/iomem", "r"); - if (!fp) { - /* If we failed to open iomem, we just basically ignore the error.= The - * unbind might succeed anyway, and besides, it's very likely we h= ave - * no way to report the error - */ - VIR_DEBUG("Failed to open /proc/iomem, trying to continue anyway"); - return 0; - } - - ret =3D 0; - in_matching_device =3D false; - match_depth =3D 0; - while (fgets(line, sizeof(line), fp) !=3D 0) { - /* the logic here is a bit confusing. For each line, we look to - * see if it matches the domain:bus:slot.function we were given. - * If this line matches the DBSF, then any subsequent lines indent= ed - * by 2 spaces are the PCI regions for this device. It's also - * possible that none of the PCI regions are currently mapped, in - * which case we have no indented regions. This code handles all - * of these situations - */ - if (in_matching_device && (strspn(line, " ") =3D=3D (match_depth += 2))) { - /* expected format: - : */ - if (/* start */ - virStrToLong_ull(line, &tmp, 16, &start) < 0 || *tmp !=3D = '-' || - /* end */ - virStrToLong_ull(tmp + 1, &tmp, 16, &end) < 0 || - (tmp =3D STRSKIP(tmp, " : ")) =3D=3D NULL) - continue; - - if (STRPREFIX(tmp, matcher)) { - ret =3D 1; - break; - } - } else { - in_matching_device =3D false; - - /* expected format: - : ::. */ - if (/* start */ - virStrToLong_ull(line, &tmp, 16, &start) < 0 || *tmp !=3D = '-' || - /* end */ - virStrToLong_ull(tmp + 1, &tmp, 16, &end) < 0 || - (tmp =3D STRSKIP(tmp, " : ")) =3D=3D NULL || - /* domain */ - virStrToLong_ui(tmp, &tmp, 16, &domain) < 0 || *tmp !=3D '= :' || - /* bus */ - virStrToLong_ui(tmp + 1, &tmp, 16, &bus) < 0 || *tmp !=3D = ':' || - /* slot */ - virStrToLong_ui(tmp + 1, &tmp, 16, &slot) < 0 || *tmp !=3D= '.' || - /* function */ - virStrToLong_ui(tmp + 1, &tmp, 16, &function) < 0 || *tmp = !=3D '\n') - continue; - - if (domain !=3D dev->address.domain || bus !=3D dev->address.b= us || - slot !=3D dev->address.slot || function !=3D dev->address.= function) - continue; - in_matching_device =3D true; - match_depth =3D strspn(line, " "); - } - } - - VIR_FORCE_FCLOSE(fp); - - return ret; -} - static char * virPCIDeviceReadID(virPCIDevicePtr dev, const char *id_name) { diff --git a/src/util/virpci.h b/src/util/virpci.h index 4ac0d230a4..dc20f91710 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -197,7 +197,6 @@ char *virPCIDeviceGetIOMMUGroupDev(virPCIDevicePtr dev); =20 int virPCIDeviceIsAssignable(virPCIDevicePtr dev, int strict_acs_check); -int virPCIDeviceWaitForCleanup(virPCIDevicePtr dev, const char *matcher); =20 virPCIDeviceAddressPtr virPCIGetDeviceAddressFromSysfsLink(const char *device_link); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 21:07:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1566311460; cv=none; d=zoho.com; s=zohoarc; b=DnJEGOtcoxN9i/Lh3KO5cng0FFWSSRoSBuXDlsK8G3bHl7A0W73mG359IzSTXVKPYZLOk5sfghr0tPjQotDAfu+OLwyvdLznMksDhW6CLPjC+S5d+r0F4ChxCZjUdSL6BWzvuuI/IudK4dMAsYFb0cAtt9fiYEITfRminPBjC+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566311460; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=xtuYmYas3EHuvO18Zebcc61/cgSrsaFEvTI9HPgQXaw=; b=F164jArv0DpXQKCrV2LCS30N/kQanwudDM99UIrz6MgAuqcDqxJ2O46H7vh6FZKge7AgkP7Nmw7FCQrOjFagjMJZhDxJCoQXSOtckbSY9jJUJjWzf3F0UhJPiunsba9ClHDiacGDrvPxhnh9FI8o9E1GfantxP852GyLODFbMMY= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1566311460343287.2991935159781; Tue, 20 Aug 2019 07:31:00 -0700 (PDT) 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 EBC04180158A; Tue, 20 Aug 2019 14:30:58 +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 C46905D9D5; Tue, 20 Aug 2019 14:30:58 +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 8774F24F36; Tue, 20 Aug 2019 14:30:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7KEUtUC028851 for ; Tue, 20 Aug 2019 10:30:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 19ABB438B; Tue, 20 Aug 2019 14:30:55 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 96A461F0 for ; Tue, 20 Aug 2019 14:30:50 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 20 Aug 2019 16:30:28 +0200 Message-Id: <518f29156cfb32d4044b116cfdd37d032ab8342c.1566311075.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/12] virpci: Drop newid style of PCI device detach 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: , 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.6.2 (mx1.redhat.com [10.5.110.63]); Tue, 20 Aug 2019 14:30:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" As stated in 84f9358b18346 all kernels that we are interested in have 'drivers_override'. Drop the other, older style of overriding PCI device driver - newid. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko Tested-by: Daniel Henrique Barboza --- src/util/virpci.c | 284 +--------------------------------------------- 1 file changed, 2 insertions(+), 282 deletions(-) diff --git a/src/util/virpci.c b/src/util/virpci.c index ea5be62033..6724a8ad9e 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -218,16 +218,6 @@ virPCIDriverDir(const char *driver) } =20 =20 -static char * -virPCIDriverFile(const char *driver, const char *file) -{ - char *buffer; - - ignore_value(virAsprintf(&buffer, PCI_SYSFS "drivers/%s/%s", driver, f= ile)); - return buffer; -} - - static char * virPCIFile(const char *device, const char *file) { @@ -1145,104 +1135,6 @@ virPCIDeviceBindWithDriverOverride(virPCIDevicePtr = dev, return 0; } =20 -static int -virPCIDeviceUnbindFromStubWithNewid(virPCIDevicePtr dev) -{ - int result =3D -1; - VIR_AUTOFREE(char *) drvdir =3D NULL; - VIR_AUTOFREE(char *) path =3D NULL; - VIR_AUTOFREE(char *) driver =3D NULL; - - /* If the device is currently bound to one of the "well known" - * stub drivers, then unbind it, otherwise ignore it. - */ - if (virPCIDeviceGetDriverPathAndName(dev, &drvdir, &driver) < 0) - goto cleanup; - - if (!driver) { - /* The device is not bound to any driver and we are almost done. */ - VIR_DEBUG("PCI device %s is not bound to any driver", dev->name); - goto reprobe; - } - - if (!dev->unbind_from_stub) { - VIR_DEBUG("Unbind from stub skipped for PCI device %s", dev->name); - goto remove_slot; - } - - /* If the device isn't bound to a known stub, skip the unbind. */ - if (virPCIStubDriverTypeFromString(driver) < 0 || - virPCIStubDriverTypeFromString(driver) =3D=3D VIR_PCI_STUB_DRIVER_= NONE) { - VIR_DEBUG("Unbind from stub skipped for PCI device %s because of " - "unknown stub driver", dev->name); - goto remove_slot; - } - - VIR_DEBUG("Unbinding PCI device %s from stub driver %s", - dev->name, driver); - - if (virPCIDeviceUnbind(dev) < 0) - goto cleanup; - dev->unbind_from_stub =3D false; - - remove_slot: - if (!dev->remove_slot) { - VIR_DEBUG("Slot removal skipped for PCI device %s", dev->name); - goto reprobe; - } - - VIR_DEBUG("Removing slot for PCI device %s", dev->name); - - /* Xen's pciback.ko wants you to use remove_slot on the specific devic= e */ - if (!(path =3D virPCIDriverFile(driver, "remove_slot"))) - goto cleanup; - - if (virFileExists(path) && virFileWriteStr(path, dev->name, 0) < 0) { - virReportSystemError(errno, - _("Failed to remove slot for PCI device '%s' = from %s"), - dev->name, driver); - goto cleanup; - } - dev->remove_slot =3D false; - - reprobe: - if (!dev->reprobe) { - VIR_DEBUG("Reprobe skipped for PCI device %s", dev->name); - result =3D 0; - goto cleanup; - } - - VIR_DEBUG("Reprobing for PCI device %s", dev->name); - - /* Trigger a re-probe of the device is not in the stub's dynamic - * ID table. If the stub is available, but 'remove_id' isn't - * available, then re-probing would just cause the device to be - * re-bound to the stub. - */ - VIR_FREE(path); - if (driver && !(path =3D virPCIDriverFile(driver, "remove_id"))) - goto cleanup; - - if (!driver || !virFileExists(drvdir) || virFileExists(path)) { - if (virFileWriteStr(PCI_SYSFS "drivers_probe", dev->name, 0) < 0) { - virReportSystemError(errno, - _("Failed to trigger a re-probe for PCI d= evice '%s'"), - dev->name); - goto cleanup; - } - } - - result =3D 0; - - cleanup: - /* do not do it again */ - dev->unbind_from_stub =3D false; - dev->remove_slot =3D false; - dev->reprobe =3D false; - - return result; -} - static int virPCIDeviceUnbindFromStubWithOverride(virPCIDevicePtr dev) { @@ -1257,167 +1149,7 @@ virPCIDeviceUnbindFromStubWithOverride(virPCIDevice= Ptr dev) static int virPCIDeviceUnbindFromStub(virPCIDevicePtr dev) { - VIR_AUTOFREE(char *) path =3D NULL; - - /* - * Prefer using the device's driver_override interface, falling back - * to the unpleasant new_id interface. - */ - if (!(path =3D virPCIFile(dev->name, "driver_override"))) - return -1; - - if (virFileExists(path)) - return virPCIDeviceUnbindFromStubWithOverride(dev); - - return virPCIDeviceUnbindFromStubWithNewid(dev); -} - -static int -virPCIDeviceBindToStubWithNewid(virPCIDevicePtr dev) -{ - int result =3D -1; - bool reprobe =3D false; - VIR_AUTOFREE(char *) stubDriverPath =3D NULL; - VIR_AUTOFREE(char *) driverLink =3D NULL; - VIR_AUTOFREE(char *) path =3D NULL; /* reused for different purposes */ - VIR_AUTOPTR(virError) err =3D NULL; - const char *stubDriverName =3D NULL; - - /* Check the device is configured to use one of the known stub drivers= */ - if (dev->stubDriver =3D=3D VIR_PCI_STUB_DRIVER_NONE) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("No stub driver configured for PCI device %s"), - dev->name); - return -1; - } else if (!(stubDriverName =3D virPCIStubDriverTypeToString(dev->stub= Driver))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unknown stub driver configured for PCI device %s= "), - dev->name); - return -1; - } - - if (!(stubDriverPath =3D virPCIDriverDir(stubDriverName)) || - !(driverLink =3D virPCIFile(dev->name, "driver"))) - goto cleanup; - - if (virFileExists(driverLink)) { - if (virFileLinkPointsTo(driverLink, stubDriverPath)) { - /* The device is already bound to the correct driver */ - VIR_DEBUG("Device %s is already bound to %s", - dev->name, stubDriverName); - result =3D 0; - goto cleanup; - } - reprobe =3D true; - } - - /* Add the PCI device ID to the stub's dynamic ID table; - * this is needed to allow us to bind the device to the stub. - * Note: if the device is not currently bound to any driver, - * stub will immediately be bound to the device. Also, note - * that if a new device with this ID is hotplugged, or if a probe - * is triggered for such a device, it will also be immediately - * bound by the stub. - */ - if (!(path =3D virPCIDriverFile(stubDriverName, "new_id"))) - goto cleanup; - - if (virFileWriteStr(path, dev->id, 0) < 0) { - virReportSystemError(errno, - _("Failed to add PCI device ID '%s' to %s"), - dev->id, stubDriverName); - goto cleanup; - } - - /* check whether the device is bound to pci-stub when we write dev->id= to - * ${stubDriver}/new_id. - */ - if (virFileLinkPointsTo(driverLink, stubDriverPath)) { - dev->unbind_from_stub =3D true; - dev->remove_slot =3D true; - result =3D 0; - goto remove_id; - } - - if (virPCIDeviceUnbind(dev) < 0) - goto remove_id; - - /* If the device was bound to a driver we'll need to reprobe later */ - dev->reprobe =3D reprobe; - - /* If the device isn't already bound to pci-stub, try binding it now. - */ - if (!virFileLinkPointsTo(driverLink, stubDriverPath)) { - /* Xen's pciback.ko wants you to use new_slot first */ - VIR_FREE(path); - if (!(path =3D virPCIDriverFile(stubDriverName, "new_slot"))) - goto remove_id; - - if (virFileExists(path) && virFileWriteStr(path, dev->name, 0) < 0= ) { - virReportSystemError(errno, - _("Failed to add slot for " - "PCI device '%s' to %s"), - dev->name, stubDriverName); - goto remove_id; - } - dev->remove_slot =3D true; - - VIR_FREE(path); - if (!(path =3D virPCIDriverFile(stubDriverName, "bind"))) - goto remove_id; - - if (virFileWriteStr(path, dev->name, 0) < 0) { - virReportSystemError(errno, - _("Failed to bind PCI device '%s' to %s"), - dev->name, stubDriverName); - goto remove_id; - } - dev->unbind_from_stub =3D true; - } - - result =3D 0; - - remove_id: - err =3D virSaveLastError(); - - /* If 'remove_id' exists, remove the device id from pci-stub's dynamic - * ID table so that 'drivers_probe' works below. - */ - VIR_FREE(path); - if (!(path =3D virPCIDriverFile(stubDriverName, "remove_id"))) { - /* We do not remove PCI ID from pci-stub, and we cannot reprobe it= */ - if (dev->reprobe) { - VIR_WARN("Could not remove PCI ID '%s' from %s, and the device= " - "cannot be probed again.", dev->id, stubDriverName); - } - dev->reprobe =3D false; - result =3D -1; - goto cleanup; - } - - if (virFileExists(path) && virFileWriteStr(path, dev->id, 0) < 0) { - virReportSystemError(errno, - _("Failed to remove PCI ID '%s' from %s"), - dev->id, stubDriverName); - - /* remove PCI ID from pci-stub failed, and we cannot reprobe it */ - if (dev->reprobe) { - VIR_WARN("Failed to remove PCI ID '%s' from %s, and the device= " - "cannot be probed again.", dev->id, stubDriverName); - } - dev->reprobe =3D false; - result =3D -1; - goto cleanup; - } - - cleanup: - if (result < 0) - virPCIDeviceUnbindFromStub(dev); - - if (err) - virSetError(err); - - return result; + return virPCIDeviceUnbindFromStubWithOverride(dev); } =20 static int @@ -1463,19 +1195,7 @@ virPCIDeviceBindToStubWithOverride(virPCIDevicePtr d= ev) static int virPCIDeviceBindToStub(virPCIDevicePtr dev) { - VIR_AUTOFREE(char *) path =3D NULL; - - /* - * Prefer using the device's driver_override interface, falling back - * to the unpleasant new_id interface. - */ - if (!(path =3D virPCIFile(dev->name, "driver_override"))) - return -1; - - if (virFileExists(path)) - return virPCIDeviceBindToStubWithOverride(dev); - - return virPCIDeviceBindToStubWithNewid(dev); + return virPCIDeviceBindToStubWithOverride(dev); } =20 /* virPCIDeviceDetach: --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 21:07:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1566311469; cv=none; d=zoho.com; s=zohoarc; b=BttqD1fnYr4K5Iv+KKSlItsspoiuHkZAcXnlcq/ebZ3K3OP0zbKqj/ryeuMBKYtXK6KQbO/APFNLr2hbDoBibDc+acWhcBNZZlZnSqXRxdKLL60bLZlBWQH6HEtd3XCQENg/BofdgXQ0tU5xrKn7dFggx0tRqyb0IZqy3/FQRmk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566311469; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=z7UX6WET1+01iIPi7GnVjB0CpQ+eURAVn44llnwks44=; b=PgQO6f3yDYWkmw5sneAX6pxwxseiotvKeIjVxCpp/tp3kbTWOHp80eL9v6P9gvM8I33cojMB2wIDRyG+zY17Cxl9Yo3llnIgwwsDcFJSpID0zrJHbJvSFbuWiaGaDpKAK5li2HV6Piq/b5OBaorP7dQbRNXa3UUnz1KZp2xUkaY= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1566311469180844.4956259399128; Tue, 20 Aug 2019 07:31:09 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E7C7E3090FD6; Tue, 20 Aug 2019 14:31:07 +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 A57F627C53; Tue, 20 Aug 2019 14:31:07 +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 698E5180BA9F; Tue, 20 Aug 2019 14:31:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7KEUt1V028856 for ; Tue, 20 Aug 2019 10:30:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id DDA94438B; Tue, 20 Aug 2019 14:30:55 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 66E7A1F0 for ; Tue, 20 Aug 2019 14:30:55 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 20 Aug 2019 16:30:29 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/12] virpcimock: Don't create "pci-stub" driver 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 20 Aug 2019 14:31:08 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Now that nothing supports "pci-stub" driver (aka KVM style of PCI device assignment) there is no need for virpcimock to create it. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko Tested-by: Daniel Henrique Barboza --- tests/virpcimock.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/virpcimock.c b/tests/virpcimock.c index c0dcd377d5..bbec77975a 100644 --- a/tests/virpcimock.c +++ b/tests/virpcimock.c @@ -992,7 +992,6 @@ init_env(void) =20 MAKE_PCI_DRIVER("iwlwifi", 0x8086, 0x0044); MAKE_PCI_DRIVER("i915", 0x8086, 0x0046, 0x8086, 0x0047); - MAKE_PCI_DRIVER("pci-stub", -1, -1); pci_driver_new("vfio-pci", PCI_ACTION_BIND, -1, -1); =20 # define MAKE_PCI_DEVICE(Id, Vendor, Device, ...) \ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 21:07:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1566311472; cv=none; d=zoho.com; s=zohoarc; b=R6HVIPg8LJ12MBDfOSOWB/vBDENo4UwpaKnWpRSY7d5ebLruNiohaE9zLTRV0WW/BfbDnBcZbbc26mGYlS39TVp7a3r7o7KcEqrFTgBZVz1fMv0e31v7Gvr60JxWv6VzLkt/c53wzhwAduBCls8VUCSzmlUcsKGJSoIcpgaC1Kc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566311472; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=mEdL6XXdUGc1HvYI59XGgeGyAQ4p2299Qu+0t/H+aEI=; b=LwjfYdHAnLBYLn/1aZ9E1AJfgd2b6lGn6PAHc0iCjL+dFt2xDgtAm9IL2GEE1w8rMS5HLN6DId9oS1c9MfhyufswRVwolp2TW8r/+JaB1kB9TjzXDjelkecm8OHNPZlz+ehEb63cZ1xlsL8zhJCF54fnNMShCNFcFleNUbhWOX4= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1566311472896814.6664107484658; Tue, 20 Aug 2019 07:31:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9D7D48CF1A5; Tue, 20 Aug 2019 14:31:11 +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 2609252CE; Tue, 20 Aug 2019 14:31:11 +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 D811724F34; Tue, 20 Aug 2019 14:31:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7KEUuqX028864 for ; Tue, 20 Aug 2019 10:30:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id AB6F6438B; Tue, 20 Aug 2019 14:30:56 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 35E7F1F0 for ; Tue, 20 Aug 2019 14:30:56 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 20 Aug 2019 16:30:30 +0200 Message-Id: <1eab56f9b7ef342d4d9a0e4b7f0d4c28e47b3f11.1566311075.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/12] virpcimock: Don't create new_id or remove_id files 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.69]); Tue, 20 Aug 2019 14:31:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Now that PCI attach/detach happens solely via driver_override these two files are no longer needed. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko Tested-by: Daniel Henrique Barboza --- tests/virpcimock.c | 112 --------------------------------------------- 1 file changed, 112 deletions(-) diff --git a/tests/virpcimock.c b/tests/virpcimock.c index bbec77975a..3157037913 100644 --- a/tests/virpcimock.c +++ b/tests/virpcimock.c @@ -68,14 +68,6 @@ char *fakerootdir; * created by us. There are some actions that we must take if some special * files are written to. Here's the list of files we watch: * - * /sys/bus/pci/drivers//new_id: - * Learn the driver new vendor and device combination. - * Data in format "VVVV DDDD". - * - * /sys/bus/pci/drivers//remove_id - * Make the driver forget about vendor and device. - * Data in format "VVVV DDDD". - * * /sys/bus/pci/drivers//bind * Check if driver supports the device and bind driver to it (create sym= link * called 'driver' pointing to the /sys/but/pci/drivers/). @@ -168,8 +160,6 @@ static int pci_driver_unbind(struct pciDriver *driver, = struct pciDevice *dev); static int pci_driver_handle_change(int fd, const char *path); static int pci_driver_handle_bind(const char *path); static int pci_driver_handle_unbind(const char *path); -static int pci_driver_handle_new_id(const char *path); -static int pci_driver_handle_remove_id(const char *path); =20 =20 /* @@ -640,8 +630,6 @@ pci_driver_new(const char *name, int fail, ...) =20 make_file(driverpath, "bind", NULL, -1); make_file(driverpath, "unbind", NULL, -1); - make_file(driverpath, "new_id", NULL, -1); - make_file(driverpath, "remove_id", NULL, -1); =20 if (VIR_APPEND_ELEMENT_QUIET(pciDrivers, nPCIDrivers, driver) < 0) ABORT_OOM(); @@ -801,10 +789,6 @@ pci_driver_handle_change(int fd ATTRIBUTE_UNUSED, cons= t char *path) ret =3D pci_driver_handle_bind(path); else if (STREQ(file, "unbind")) ret =3D pci_driver_handle_unbind(path); - else if (STREQ(file, "new_id")) - ret =3D pci_driver_handle_new_id(path); - else if (STREQ(file, "remove_id")) - ret =3D pci_driver_handle_remove_id(path); else if (STREQ(file, "drivers_probe")) ret =3D pci_driver_handle_drivers_probe(path); else if (STREQ(file, "driver_override")) @@ -849,102 +833,6 @@ pci_driver_handle_unbind(const char *path) return ret; } =20 -static int -pci_driver_handle_new_id(const char *path) -{ - int ret =3D -1; - struct pciDriver *driver =3D pci_driver_find_by_path(path); - size_t i; - int vendor, device; - char buf[32]; - - if (!driver || PCI_ACTION_NEW_ID & driver->fail) { - errno =3D ENODEV; - goto cleanup; - } - - if (pci_read_file(path, buf, sizeof(buf), true) < 0) - goto cleanup; - - if (sscanf(buf, "%x %x", &vendor, &device) < 2) { - errno =3D EINVAL; - goto cleanup; - } - - for (i =3D 0; i < driver->len; i++) { - if (driver->vendor[i] =3D=3D vendor && - driver->device[i] =3D=3D device) - break; - } - - if (i =3D=3D driver->len) { - if (VIR_REALLOC_N_QUIET(driver->vendor, driver->len + 1) < 0 || - VIR_REALLOC_N_QUIET(driver->device, driver->len + 1) < 0) { - errno =3D ENOMEM; - goto cleanup; - } - - driver->vendor[driver->len] =3D vendor; - driver->device[driver->len] =3D device; - driver->len++; - } - - for (i =3D 0; i < nPCIDevices; i++) { - struct pciDevice *dev =3D pciDevices[i]; - - if (!dev->driver && - dev->vendor =3D=3D vendor && - dev->device =3D=3D device && - pci_driver_bind(driver, dev) < 0) - goto cleanup; - } - - ret =3D 0; - cleanup: - return ret; -} - -static int -pci_driver_handle_remove_id(const char *path) -{ - int ret =3D -1; - struct pciDriver *driver =3D pci_driver_find_by_path(path); - size_t i; - int vendor, device; - char buf[32]; - - if (!driver || PCI_ACTION_REMOVE_ID & driver->fail) { - errno =3D ENODEV; - goto cleanup; - } - - if (pci_read_file(path, buf, sizeof(buf), true) < 0) - goto cleanup; - - if (sscanf(buf, "%x %x", &vendor, &device) < 2) { - errno =3D EINVAL; - goto cleanup; - } - - for (i =3D 0; i < driver->len; i++) { - if (driver->vendor[i] =3D=3D vendor && - driver->device[i] =3D=3D device) - continue; - } - - if (i !=3D driver->len) { - if (VIR_DELETE_ELEMENT(driver->vendor, i, driver->len) < 0) - goto cleanup; - driver->len++; - if (VIR_DELETE_ELEMENT(driver->device, i, driver->len) < 0) - goto cleanup; - } - - ret =3D 0; - cleanup: - return ret; -} - =20 /* * Functions to load the symbols and init the environment --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 21:07:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1566311462; cv=none; d=zoho.com; s=zohoarc; b=QnSTXV0Q/oX5OR90HyswaR8oLUJmHO83c9bTJhkqF5J9Uv9nTv1B/pp7hKB80Sfd3LMQ2wlUL2Gv12XO64h4BzNK74u/0ztb042wxHo6aHDi5hHHKPzN3NpoUAAPrbvXUOHlTQY0i1thNtq+Lnu4JsZlEpyDstPxQPR3RjUHk5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566311462; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=jH9xtwxm9RjDaCTL61accTiJ33vG23HFt+qkXj7CGvE=; b=cXab7MmFV38G6pdvcUZKRMK5MR9RS/FcjipgrAy/il3cQIxxom4SnyggeuX6+rENq+ArwuWgkKix4LgndKq0D6oWsSe4e55UqQcwBoLRyP7JyT3c6uNAyPbYqlwm/WjxJCDi6YXHQF4dGby4AN1yBhhya2/+8hdgYDVXX5HyHRI= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1566311462880982.3259719020668; Tue, 20 Aug 2019 07:31:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A8D9810F23E4; Tue, 20 Aug 2019 14:31:01 +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 7DBE53DE5; Tue, 20 Aug 2019 14:31:01 +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 37F7A180BA9B; Tue, 20 Aug 2019 14:31:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7KEUvEA028871 for ; Tue, 20 Aug 2019 10:30:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7A9456092F; Tue, 20 Aug 2019 14:30:57 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03CFF17AB5 for ; Tue, 20 Aug 2019 14:30:56 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 20 Aug 2019 16:30:31 +0200 Message-Id: <17e7499d30003cea014c38a5025c1aa2e5247b7a.1566311075.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 11/12] virpcimock: Drop @driverActions enum 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.66]); Tue, 20 Aug 2019 14:31:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This enum was introduced to model how RHEL-7 kernel behaves - for some reason going with the old way (via new_id + bind) fails but using driver_override succeeds. Well, we don't need to care about that anymore since we don't create new_id file. Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko Tested-by: Daniel Henrique Barboza --- tests/virpcimock.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/tests/virpcimock.c b/tests/virpcimock.c index 3157037913..a5045ed97c 100644 --- a/tests/virpcimock.c +++ b/tests/virpcimock.c @@ -98,19 +98,11 @@ char *fakerootdir; * */ =20 -enum driverActions { - PCI_ACTION_BIND =3D 1 << 0, - PCI_ACTION_UNBIND =3D 1 << 1, - PCI_ACTION_NEW_ID =3D 1 << 2, - PCI_ACTION_REMOVE_ID =3D 1 << 3, -}; - struct pciDriver { char *name; int *vendor; /* List of vendor:device IDs the driver can handle= */ int *device; size_t len; /* @len is used for both @vendor and @device */ - unsigned int fail; /* Bitwise-OR of driverActions that should fail */ }; =20 struct pciDeviceAddress { @@ -151,7 +143,7 @@ static void pci_device_new_from_stub(const struct pciDe= vice *data); static struct pciDevice *pci_device_find_by_id(struct pciDeviceAddress con= st *addr); static struct pciDevice *pci_device_find_by_content(const char *path); =20 -static void pci_driver_new(const char *name, int fail, ...); +static void pci_driver_new(const char *name, ...); static struct pciDriver *pci_driver_find_by_dev(struct pciDevice *dev); static struct pciDriver *pci_driver_find_by_path(const char *path); static struct pciDriver *pci_driver_find_by_driver_override(struct pciDevi= ce *dev); @@ -594,7 +586,7 @@ pci_driver_get_path(const struct pciDriver *driver, =20 =20 static void -pci_driver_new(const char *name, int fail, ...) +pci_driver_new(const char *name, ...) { struct pciDriver *driver; va_list args; @@ -606,12 +598,10 @@ pci_driver_new(const char *name, int fail, ...) !(driverpath =3D pci_driver_get_path(driver, NULL, true))) ABORT_OOM(); =20 - driver->fail =3D fail; - if (virFileMakePath(driverpath) < 0) ABORT("Unable to create: %s", driverpath); =20 - va_start(args, fail); + va_start(args, name); =20 while ((vendor =3D va_arg(args, int)) !=3D -1) { if ((device =3D va_arg(args, int)) =3D=3D -1) @@ -805,7 +795,7 @@ pci_driver_handle_bind(const char *path) struct pciDevice *dev =3D pci_device_find_by_content(path); struct pciDriver *driver =3D pci_driver_find_by_path(path); =20 - if (!driver || !dev || PCI_ACTION_BIND & driver->fail) { + if (!driver || !dev) { /* No driver, no device or failing driver requested */ errno =3D ENODEV; goto cleanup; @@ -822,7 +812,7 @@ pci_driver_handle_unbind(const char *path) int ret =3D -1; struct pciDevice *dev =3D pci_device_find_by_content(path); =20 - if (!dev || !dev->driver || PCI_ACTION_UNBIND & dev->driver->fail) { + if (!dev || !dev->driver) { /* No device, device not binded or failing driver requested */ errno =3D ENODEV; goto cleanup; @@ -876,11 +866,11 @@ init_env(void) make_file(tmp, "drivers_probe", NULL, -1); =20 # define MAKE_PCI_DRIVER(name, ...) \ - pci_driver_new(name, 0, __VA_ARGS__, -1, -1) + pci_driver_new(name, __VA_ARGS__, -1, -1) =20 MAKE_PCI_DRIVER("iwlwifi", 0x8086, 0x0044); MAKE_PCI_DRIVER("i915", 0x8086, 0x0046, 0x8086, 0x0047); - pci_driver_new("vfio-pci", PCI_ACTION_BIND, -1, -1); + MAKE_PCI_DRIVER("vfio-pci", -1, -1); =20 # define MAKE_PCI_DEVICE(Id, Vendor, Device, ...) \ do { \ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 21:07:23 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 ARC-Seal: i=1; a=rsa-sha256; t=1566311476; cv=none; d=zoho.com; s=zohoarc; b=XvH1LUJU1d6IvR7KrIeV/MBodGESuPmporeamyH+tdkIPuJEk4Vupu+f+Lw1A0w5aAXz3LMPd28VJgsUUS05ZMeKoFKK3R7m9lAFOs8IbY5TEZ/sDtj9z15yr4cw/a3q7qn2J5Vl7yEf4O8m9J+FhPwIiQwAgXoLqcM8z4nSOY8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1566311476; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=aAoMxUY1oadUwDgceoNRb7VhPKNkxS9iR0JgXKMETVM=; b=Qu/2zctIAGu5ffarHFSBLEFaPgX3D3HhAY9Aeq3b6x6TFwtHnvJ6oET6xcglfhKgXXofyuubIK6gW0ve0ijBLBOK8bH7Dq09qe7A9hCMUbwr87HRPXU+FDUhJ6mKz+ek/O9ccCG3ukgGxYrWX0Zm6QQuqeNjyBaRj654QWGsbmw= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1566311476662801.7984921435407; Tue, 20 Aug 2019 07:31:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 65C7E3091786; Tue, 20 Aug 2019 14:31:15 +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 E144A1813F; Tue, 20 Aug 2019 14:31:14 +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 A28C4180B536; Tue, 20 Aug 2019 14:31:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x7KEUwhL028882 for ; Tue, 20 Aug 2019 10:30:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 495B818220; Tue, 20 Aug 2019 14:30:58 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id C6CCA6092F for ; Tue, 20 Aug 2019 14:30:57 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 20 Aug 2019 16:30:32 +0200 Message-Id: <8d8f08b7918a518cf169552aa172befa91d89210.1566311075.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 12/12] news: Document KVM assignment removal 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: , 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 20 Aug 2019 14:31:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Michal Privoznik Reviewed-by: Daniel Henrique Barboza Reviewed-by: J=C3=A1n Tomko Tested-by: Daniel Henrique Barboza --- docs/news.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index d63fca3b48..6137ebd943 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -51,6 +51,19 @@ +
+ + + Remove KVM assignment support + + + The KVM style of PCI device assignment was removed from + kernel in kernel 4.12.0 after being deprecated since 4.2.0. + Libvirt defaults to VFIO for a long time. Remove support for + KVM device assignment then. + + +
--=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list