From nobody Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1692646395; cv=none; d=zohomail.com; s=zohoarc; b=d1Mf5i1nH5aLI9dmCuG/L8LB0+Gi997DraZCJFhoqO54biKt1yDAQVsMN46YUB+NtOC/KNKF9akv14vxnvbCA8cNWv6IlSggs+E3XohsxxFAexW5j4S94PlYvLlBFYjDvir0HANLQ3fkAVrXBR2x/8JCdOxC/MpRXRWbE35kGBM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692646395; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=iOgCsOxhv36l2avqmHAXlMsQ6wSFBCwNKUM8Ora/1Zk=; b=fg2PSvHd8VHE9sc/AJhXPE69ZKNqaTBcHufgGswBrV/3Mj1Q3AmHe/CZQw2Jg++1hbMXbUQBotzDJ9LDi2JoJD01EMQAGUof6yDtvNrJoChK83CBWcfNNIUzx0RXWn4zEarIsdJWywQp2t+M6tmai45kCrrfAMM3d4U2V8cI5SA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1692646395806713.1020192431408; Mon, 21 Aug 2023 12:33:15 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-324-XnoR7bAYOiqRtEYUKNmimw-1; Mon, 21 Aug 2023 15:33:10 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 051DD8022E4; Mon, 21 Aug 2023 19:33:08 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8B48064687; Mon, 21 Aug 2023 19:33:05 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1ACA81946587; Mon, 21 Aug 2023 19:33:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 662941946586 for ; Mon, 21 Aug 2023 19:32:59 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 477B64A9004; Mon, 21 Aug 2023 19:32:59 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.9.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0A7AA492C13; Mon, 21 Aug 2023 19:32:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692646394; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=iOgCsOxhv36l2avqmHAXlMsQ6wSFBCwNKUM8Ora/1Zk=; b=MrsnLgPQPe0xT/i9t4avve6vG/0R4D+VUVruZBKIRJqiAQdsN2nPXZWqnPx6qrabbaX7bg sgZ7xSx7aNu4+KDaaXY807p9wXbQ8Tv3MtEtAR9nvwt3TFL93xCNlUTLkuDeotbAj8gNne 1kpyYwh1EkxY8imret3GVhB2uugLhkY= X-MC-Unique: XnoR7bAYOiqRtEYUKNmimw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v3 1/8] util: use "stubDriverType" instead of just "stubDriver" Date: Mon, 21 Aug 2023 15:32:51 -0400 Message-ID: <20230821193258.520859-2-laine@redhat.com> In-Reply-To: <20230821193258.520859-1-laine@redhat.com> References: <20230821193258.520859-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Cc : Joao Martins" , "Cc : Cedric Le Goater" , "Cc : Jason Gunthorpe" Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1692646397605100003 Content-Type: text/plain; charset="utf-8"; x-default="true" In the past we just kept track of the type of the "stub driver" (the driver that is bound to a device in order to assign it to a guest). The next commit will add a stubDriverName to go along with type, so lets use stubDriverType for the existing enum to make it easier to keep track of whether we're talking about the name or the type. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/hypervisor/domain_driver.c | 4 ++-- src/hypervisor/virhostdev.c | 8 ++++---- src/libvirt_private.syms | 4 ++-- src/util/virnvme.c | 2 +- src/util/virpci.c | 16 ++++++++-------- src/util/virpci.h | 6 +++--- tests/virhostdevtest.c | 2 +- tests/virpcitest.c | 8 ++++---- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/hypervisor/domain_driver.c b/src/hypervisor/domain_driver.c index 66e09ffb04..a70f75f3ae 100644 --- a/src/hypervisor/domain_driver.c +++ b/src/hypervisor/domain_driver.c @@ -505,9 +505,9 @@ virDomainDriverNodeDeviceDetachFlags(virNodeDevicePtr d= ev, return -1; =20 if (STREQ(driverName, "vfio")) - virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_VFIO); + virPCIDeviceSetStubDriverType(pci, VIR_PCI_STUB_DRIVER_VFIO); else if (STREQ(driverName, "xen")) - virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_XEN); + virPCIDeviceSetStubDriverType(pci, VIR_PCI_STUB_DRIVER_XEN); =20 return virHostdevPCINodeDeviceDetach(hostdevMgr, pci); } diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index eac3474783..c437ca9d22 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -244,9 +244,9 @@ virHostdevGetPCIHostDevice(const virDomainHostdevDef *h= ostdev, virPCIDeviceSetManaged(actual, hostdev->managed); =20 if (pcisrc->backend =3D=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO) { - virPCIDeviceSetStubDriver(actual, VIR_PCI_STUB_DRIVER_VFIO); + virPCIDeviceSetStubDriverType(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); + virPCIDeviceSetStubDriverType(actual, VIR_PCI_STUB_DRIVER_XEN); } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("pci backend driver '%1$s' is not supported"), @@ -679,7 +679,7 @@ virHostdevPreparePCIDevicesImpl(virHostdevManager *mgr, for (i =3D 0; i < virPCIDeviceListCount(pcidevs); i++) { virPCIDevice *pci =3D virPCIDeviceListGet(pcidevs, i); bool strict_acs_check =3D !!(flags & VIR_HOSTDEV_STRICT_ACS_CHECK); - bool usesVFIO =3D (virPCIDeviceGetStubDriver(pci) =3D=3D VIR_PCI_S= TUB_DRIVER_VFIO); + bool usesVFIO =3D (virPCIDeviceGetStubDriverType(pci) =3D=3D VIR_P= CI_STUB_DRIVER_VFIO); struct virHostdevIsPCINodeDeviceUsedData data =3D {mgr, drv_name, = dom_name, false}; int hdrType =3D -1; =20 @@ -776,7 +776,7 @@ virHostdevPreparePCIDevicesImpl(virHostdevManager *mgr, =20 /* The device is bound to a known stub driver: store this * information and add a copy to the inactive list */ - virPCIDeviceSetStubDriver(pci, stub); + virPCIDeviceSetStubDriverType(pci, stub); =20 VIR_DEBUG("Adding PCI device %s to inactive list", virPCIDeviceGetName(pci)); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index da60c965dd..983109df86 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3072,7 +3072,7 @@ virPCIDeviceGetManaged; virPCIDeviceGetName; virPCIDeviceGetRemoveSlot; virPCIDeviceGetReprobe; -virPCIDeviceGetStubDriver; +virPCIDeviceGetStubDriverType; virPCIDeviceGetUnbindFromStub; virPCIDeviceGetUsedBy; virPCIDeviceGetVPD; @@ -3098,7 +3098,7 @@ virPCIDeviceReset; virPCIDeviceSetManaged; virPCIDeviceSetRemoveSlot; virPCIDeviceSetReprobe; -virPCIDeviceSetStubDriver; +virPCIDeviceSetStubDriverType; virPCIDeviceSetUnbindFromStub; virPCIDeviceSetUsedBy; virPCIDeviceUnbind; diff --git a/src/util/virnvme.c b/src/util/virnvme.c index f7f8dc5ea9..37333d515b 100644 --- a/src/util/virnvme.c +++ b/src/util/virnvme.c @@ -292,7 +292,7 @@ virNVMeDeviceCreatePCIDevice(const virNVMeDevice *nvme) return NULL; =20 /* NVMe devices must be bound to vfio */ - virPCIDeviceSetStubDriver(pci, VIR_PCI_STUB_DRIVER_VFIO); + virPCIDeviceSetStubDriverType(pci, VIR_PCI_STUB_DRIVER_VFIO); virPCIDeviceSetManaged(pci, nvme->managed); =20 return g_steal_pointer(&pci); diff --git a/src/util/virpci.c b/src/util/virpci.c index cc2b07bbba..88a020fb86 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -87,7 +87,7 @@ struct _virPCIDevice { =20 bool managed; =20 - virPCIStubDriver stubDriver; + virPCIStubDriver stubDriverType; =20 /* used by reattach function */ bool unbind_from_stub; @@ -1233,12 +1233,12 @@ virPCIDeviceBindToStub(virPCIDevice *dev) g_autofree char *driverLink =3D NULL; =20 /* Check the device is configured to use one of the known stub drivers= */ - if (dev->stubDriver =3D=3D VIR_PCI_STUB_DRIVER_NONE) { + if (dev->stubDriverType =3D=3D VIR_PCI_STUB_DRIVER_NONE) { virReportError(VIR_ERR_INTERNAL_ERROR, _("No stub driver configured for PCI device %1$s"), dev->name); return -1; - } else if (!(stubDriverName =3D virPCIStubDriverTypeToString(dev->stub= Driver))) { + } else if (!(stubDriverName =3D virPCIStubDriverTypeToString(dev->stub= DriverType))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown stub driver configured for PCI device %1= $s"), dev->name); @@ -1287,7 +1287,7 @@ virPCIDeviceDetach(virPCIDevice *dev, virPCIDeviceList *activeDevs, virPCIDeviceList *inactiveDevs) { - if (virPCIProbeStubDriver(dev->stubDriver) < 0) + if (virPCIProbeStubDriver(dev->stubDriverType) < 0) return -1; =20 if (activeDevs && virPCIDeviceListFind(activeDevs, &dev->address)) { @@ -1569,15 +1569,15 @@ virPCIDeviceGetManaged(virPCIDevice *dev) } =20 void -virPCIDeviceSetStubDriver(virPCIDevice *dev, virPCIStubDriver driver) +virPCIDeviceSetStubDriverType(virPCIDevice *dev, virPCIStubDriver driverTy= pe) { - dev->stubDriver =3D driver; + dev->stubDriverType =3D driverType; } =20 virPCIStubDriver -virPCIDeviceGetStubDriver(virPCIDevice *dev) +virPCIDeviceGetStubDriverType(virPCIDevice *dev) { - return dev->stubDriver; + return dev->stubDriverType; } =20 bool diff --git a/src/util/virpci.h b/src/util/virpci.h index 4d9193f24e..485f535bc9 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -134,9 +134,9 @@ int virPCIDeviceReset(virPCIDevice *dev, void virPCIDeviceSetManaged(virPCIDevice *dev, bool managed); bool virPCIDeviceGetManaged(virPCIDevice *dev); -void virPCIDeviceSetStubDriver(virPCIDevice *dev, - virPCIStubDriver driver); -virPCIStubDriver virPCIDeviceGetStubDriver(virPCIDevice *dev); +void virPCIDeviceSetStubDriverType(virPCIDevice *dev, + virPCIStubDriver driverType); +virPCIStubDriver virPCIDeviceGetStubDriverType(virPCIDevice *dev); virPCIDeviceAddress *virPCIDeviceGetAddress(virPCIDevice *dev); int virPCIDeviceSetUsedBy(virPCIDevice *dev, const char *drv_name, diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c index ee0d1c1e6b..04e6c00908 100644 --- a/tests/virhostdevtest.c +++ b/tests/virhostdevtest.c @@ -142,7 +142,7 @@ myInit(void) if (!(dev[i] =3D virPCIDeviceNew(&subsys->u.pci.addr))) goto cleanup; =20 - virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_VFIO); + virPCIDeviceSetStubDriverType(dev[i], VIR_PCI_STUB_DRIVER_VFIO); } =20 for (i =3D 0; i < ndisks; i++) { diff --git a/tests/virpcitest.c b/tests/virpcitest.c index 769175d7c4..92cc8c07c6 100644 --- a/tests/virpcitest.c +++ b/tests/virpcitest.c @@ -107,7 +107,7 @@ testVirPCIDeviceDetach(const void *opaque G_GNUC_UNUSED) if (!(dev[i] =3D virPCIDeviceNew(&devAddr))) goto cleanup; =20 - virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_VFIO); + virPCIDeviceSetStubDriverType(dev[i], VIR_PCI_STUB_DRIVER_VFIO); =20 if (virPCIDeviceDetach(dev[i], activeDevs, inactiveDevs) < 0) goto cleanup; @@ -149,7 +149,7 @@ testVirPCIDeviceReset(const void *opaque G_GNUC_UNUSED) if (!(dev[i] =3D virPCIDeviceNew(&devAddr))) goto cleanup; =20 - virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_VFIO); + virPCIDeviceSetStubDriverType(dev[i], VIR_PCI_STUB_DRIVER_VFIO); =20 if (virPCIDeviceReset(dev[i], activeDevs, inactiveDevs) < 0) goto cleanup; @@ -190,7 +190,7 @@ testVirPCIDeviceReattach(const void *opaque G_GNUC_UNUS= ED) CHECK_LIST_COUNT(activeDevs, 0); CHECK_LIST_COUNT(inactiveDevs, i + 1); =20 - virPCIDeviceSetStubDriver(dev[i], VIR_PCI_STUB_DRIVER_VFIO); + virPCIDeviceSetStubDriverType(dev[i], VIR_PCI_STUB_DRIVER_VFIO); } =20 CHECK_LIST_COUNT(activeDevs, 0); @@ -249,7 +249,7 @@ testVirPCIDeviceDetachSingle(const void *opaque) if (!dev) goto cleanup; =20 - virPCIDeviceSetStubDriver(dev, VIR_PCI_STUB_DRIVER_VFIO); + virPCIDeviceSetStubDriverType(dev, VIR_PCI_STUB_DRIVER_VFIO); =20 if (virPCIDeviceDetach(dev, NULL, NULL) < 0) goto cleanup; --=20 2.41.0 From nobody Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 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=1692646401; cv=none; d=zohomail.com; s=zohoarc; b=DEUPdMrF6z41H8Gbt6XRdEecNDCw+8PansxC/oU0YhxtFWvfkHP9vP+6RTfGrmse6KdcwncJeKPGEBac8FQR65D+Gd6UIZShlWCr+oMLA+XuvKdMlNd25bL2bBuA4vbnSGWVt6KCw4o7xBvM5hus5u2iaKFKP/SAtn81BAy+iNo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692646401; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=gzf9lTNHCn6VgNcivCn2RQpTTy0oeaMQfK84WF8BjGM=; b=FGuTTUWcprYBZi+JTXNWhCC7Cz4VdQPJKF8pfIs6FJWJCQLylyH/u1gPlIVBWOZ+JKsjTF8X2lPTB5vfXqQafCkGnzmZm68+06emejnwqgFlbaEwlJAdYMDUrjvAKiCnTH6lWhfegNmVxEN7ZpWPmhAvupPAJwMgiawAg6Z3Hp8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1692646401104468.56664554459394; Mon, 21 Aug 2023 12:33:21 -0700 (PDT) Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-587-tun8uCoAN9qDeAR911k5DQ-1; Mon, 21 Aug 2023 15:33:15 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D07983C11CC6; Mon, 21 Aug 2023 19:33:11 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC48B1121314; Mon, 21 Aug 2023 19:33:11 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 54BF319465B1; Mon, 21 Aug 2023 19:33:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9B7621946586 for ; Mon, 21 Aug 2023 19:32:59 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8B6C94A9004; Mon, 21 Aug 2023 19:32:59 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.9.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id 54271492C13; Mon, 21 Aug 2023 19:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692646399; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=gzf9lTNHCn6VgNcivCn2RQpTTy0oeaMQfK84WF8BjGM=; b=PsPfH9v7OJLxZIAank8wXIbvNDtYF6JpNLQD6SjZCsoOcHW4wjJu+nIsNL98XWDHUzyEUR zkJVD788hDn7pZwXlgNfltgrbF3UZHKR8k2NJ9Tpd7AHNU+tBWr5/L8tZWlJRYFDmOISU1 VmNn2xcEPEbxHwUWw+JG2fY7Np3qcKM= X-MC-Unique: tun8uCoAN9qDeAR911k5DQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v3 2/8] util: add stub driver name to virPCIDevice object Date: Mon, 21 Aug 2023 15:32:52 -0400 Message-ID: <20230821193258.520859-3-laine@redhat.com> In-Reply-To: <20230821193258.520859-1-laine@redhat.com> References: <20230821193258.520859-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Cc : Joao Martins" , "Cc : Cedric Le Goater" , "Cc : Jason Gunthorpe" Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1692646401423100001 Content-Type: text/plain; charset="utf-8"; x-default="true" There can be many different drivers that are of the type "VFIO", so add the driver name to the object and allow getting/setting it. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/libvirt_private.syms | 2 ++ src/util/virpci.c | 16 ++++++++++++++++ src/util/virpci.h | 3 +++ 3 files changed, 21 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 983109df86..fad5389d68 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3072,6 +3072,7 @@ virPCIDeviceGetManaged; virPCIDeviceGetName; virPCIDeviceGetRemoveSlot; virPCIDeviceGetReprobe; +virPCIDeviceGetStubDriverName; virPCIDeviceGetStubDriverType; virPCIDeviceGetUnbindFromStub; virPCIDeviceGetUsedBy; @@ -3098,6 +3099,7 @@ virPCIDeviceReset; virPCIDeviceSetManaged; virPCIDeviceSetRemoveSlot; virPCIDeviceSetReprobe; +virPCIDeviceSetStubDriverName; virPCIDeviceSetStubDriverType; virPCIDeviceSetUnbindFromStub; virPCIDeviceSetUsedBy; diff --git a/src/util/virpci.c b/src/util/virpci.c index 88a020fb86..103bc4254e 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -88,6 +88,7 @@ struct _virPCIDevice { bool managed; =20 virPCIStubDriver stubDriverType; + char *stubDriverName; /* if blank, use default for type */ =20 /* used by reattach function */ bool unbind_from_stub; @@ -1507,6 +1508,7 @@ virPCIDeviceCopy(virPCIDevice *dev) copy->path =3D g_strdup(dev->path); copy->used_by_drvname =3D g_strdup(dev->used_by_drvname); copy->used_by_domname =3D g_strdup(dev->used_by_domname); + copy->stubDriverName =3D g_strdup(dev->stubDriverName); return copy; } =20 @@ -1521,6 +1523,7 @@ virPCIDeviceFree(virPCIDevice *dev) g_free(dev->path); g_free(dev->used_by_drvname); g_free(dev->used_by_domname); + g_free(dev->stubDriverName); g_free(dev); } =20 @@ -1580,6 +1583,19 @@ virPCIDeviceGetStubDriverType(virPCIDevice *dev) return dev->stubDriverType; } =20 +void +virPCIDeviceSetStubDriverName(virPCIDevice *dev, + const char *driverName) +{ + dev->stubDriverName =3D g_strdup(driverName); +} + +const char * +virPCIDeviceGetStubDriverName(virPCIDevice *dev) +{ + return dev->stubDriverName; +} + bool virPCIDeviceGetUnbindFromStub(virPCIDevice *dev) { diff --git a/src/util/virpci.h b/src/util/virpci.h index 485f535bc9..f8f98f39de 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -137,6 +137,9 @@ bool virPCIDeviceGetManaged(virPCIDevice *dev); void virPCIDeviceSetStubDriverType(virPCIDevice *dev, virPCIStubDriver driverType); virPCIStubDriver virPCIDeviceGetStubDriverType(virPCIDevice *dev); +void virPCIDeviceSetStubDriverName(virPCIDevice *dev, + const char *driverName); +const char *virPCIDeviceGetStubDriverName(virPCIDevice *dev); virPCIDeviceAddress *virPCIDeviceGetAddress(virPCIDevice *dev); int virPCIDeviceSetUsedBy(virPCIDevice *dev, const char *drv_name, --=20 2.41.0 From nobody Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 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=1692646416; cv=none; d=zohomail.com; s=zohoarc; b=XEOYVwX88fp7wD0cf1bpBQjMkuR4xAHyz9w/AUH0IBG/RHoZQolC3IF4QZuhgJvkJbJGgrgrg0VjN2V1iuCSPjZJKl7PwGNFbIjwV+KKOfVHNjbhR1MHa3dl/2/rRjLoALejZrKtH7R1tmrUxeXLPiEeLwu8WG8Ob3rp5znu1PA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692646416; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=7jXheK93uuxKcJOlFFfOqYtsk7LAX3Sc41J+FxQk6ro=; b=dph1AAPvrFH/Oryt64mTQ6suJMpsWmB83jBoSJP0wZ3Cm6Wp8qkbWM/wHFXSrOOmNvvmvG6VqEwVHli+YIqE+1iZsgLEcvEDecP3UzxU7b46BagMCqO6mXgARua1CFGMpCs0cqnWVIUN1w7EvJCnzOyDkksqDjM/7ZMCYaaHPAU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1692646416215258.48684741667944; Mon, 21 Aug 2023 12:33:36 -0700 (PDT) Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-627-W3sn75M3OmKsboynEfZufA-1; Mon, 21 Aug 2023 15:33:32 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6B6C13814950; Mon, 21 Aug 2023 19:33:29 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C1402026D76; Mon, 21 Aug 2023 19:33:29 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C66F71946A6F; Mon, 21 Aug 2023 19:33:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EC2C11946586 for ; Mon, 21 Aug 2023 19:32:59 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D00C2492C13; Mon, 21 Aug 2023 19:32:59 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.9.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id 982984A9005; Mon, 21 Aug 2023 19:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692646415; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=7jXheK93uuxKcJOlFFfOqYtsk7LAX3Sc41J+FxQk6ro=; b=Z6NtANzoBAnaCYS8mDzr/WRSWodD4u/ioxXx5REI3etJmabbamIxXYVe6zvVaGyMdWNpzc Km4GHdX5NsUi/qhAgZiuyni16Rc1kJADolV9VUJqxb7VJbh2mKeO8y6p1ni8DvKnBYgNAk 0UjBye9g0BABbpKNVhXgWPMasflqudA= X-MC-Unique: W3sn75M3OmKsboynEfZufA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v3 3/8] util: rename virPCIDeviceGetDriverPathAndName Date: Mon, 21 Aug 2023 15:32:53 -0400 Message-ID: <20230821193258.520859-4-laine@redhat.com> In-Reply-To: <20230821193258.520859-1-laine@redhat.com> References: <20230821193258.520859-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Cc : Joao Martins" , "Cc : Cedric Le Goater" , "Cc : Jason Gunthorpe" Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1692646418001100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Instead, call it virPCIDeviceGetCurrentDriverPathAndName() to avoid confusion with the device name that is stored in the virPCIDevice object - that one is not necessarily the name of the current driver for the device, but could instead be the driver that we want to be bound to the device in the future. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/hypervisor/virhostdev.c | 7 ++++--- src/libvirt_private.syms | 2 +- src/util/virpci.c | 10 ++++++---- src/util/virpci.h | 6 +++--- tests/virpcitest.c | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index c437ca9d22..244f057c6c 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -765,9 +765,10 @@ virHostdevPreparePCIDevicesImpl(virHostdevManager *mgr, * information about active / inactive device across * daemon restarts has been implemented */ =20 - if (virPCIDeviceGetDriverPathAndName(pci, - &driverPath, &driverName)= < 0) + if (virPCIDeviceGetCurrentDriverPathAndName(pci, &driverPath, + &driverName) < 0) { goto reattachdevs; + } =20 stub =3D virPCIStubDriverTypeFromString(driverName); =20 @@ -2294,7 +2295,7 @@ virHostdevPrepareOneNVMeDevice(virHostdevManager *hos= tdev_mgr, g_autofree char *drvName =3D NULL; int stub =3D VIR_PCI_STUB_DRIVER_NONE; =20 - if (virPCIDeviceGetDriverPathAndName(pci, &drvPath, &drvName) < 0) + if (virPCIDeviceGetCurrentDriverPathAndName(pci, &drvPath, &drvNam= e) < 0) goto cleanup; =20 if (drvName) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index fad5389d68..2b577c4e2d 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3064,7 +3064,7 @@ virPCIDeviceFileIterate; virPCIDeviceFree; virPCIDeviceGetAddress; virPCIDeviceGetConfigPath; -virPCIDeviceGetDriverPathAndName; +virPCIDeviceGetCurrentDriverPathAndName; virPCIDeviceGetIOMMUGroupDev; virPCIDeviceGetIOMMUGroupList; virPCIDeviceGetLinkCapSta; diff --git a/src/util/virpci.c b/src/util/virpci.c index 103bc4254e..2ec0dc2053 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -228,7 +228,7 @@ virPCIFile(const char *device, const char *file) } =20 =20 -/* virPCIDeviceGetDriverPathAndName - put the path to the driver +/* virPCIDeviceGetCurrentDriverPathAndName - put the path to the driver * directory of the driver in use for this device in @path and the * name of the driver in @name. Both could be NULL if it's not bound * to any driver. @@ -236,7 +236,9 @@ virPCIFile(const char *device, const char *file) * Return 0 for success, -1 for error. */ int -virPCIDeviceGetDriverPathAndName(virPCIDevice *dev, char **path, char **na= me) +virPCIDeviceGetCurrentDriverPathAndName(virPCIDevice *dev, + char **path, + char **name) { int ret =3D -1; g_autofree char *drvlink =3D NULL; @@ -1032,7 +1034,7 @@ virPCIDeviceReset(virPCIDevice *dev, * reset it whenever appropriate, so doing it ourselves would just * be redundant. */ - if (virPCIDeviceGetDriverPathAndName(dev, &drvPath, &drvName) < 0) + if (virPCIDeviceGetCurrentDriverPathAndName(dev, &drvPath, &drvName) <= 0) goto cleanup; =20 if (virPCIStubDriverTypeFromString(drvName) =3D=3D VIR_PCI_STUB_DRIVER= _VFIO) { @@ -1137,7 +1139,7 @@ virPCIDeviceUnbind(virPCIDevice *dev) g_autofree char *drvpath =3D NULL; g_autofree char *driver =3D NULL; =20 - if (virPCIDeviceGetDriverPathAndName(dev, &drvpath, &driver) < 0) + if (virPCIDeviceGetCurrentDriverPathAndName(dev, &drvpath, &driver) < = 0) return -1; =20 if (!driver) diff --git a/src/util/virpci.h b/src/util/virpci.h index f8f98f39de..19c910202a 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -280,9 +280,9 @@ virPCIVPDResource * virPCIDeviceGetVPD(virPCIDevice *de= v); =20 int virPCIDeviceUnbind(virPCIDevice *dev); int virPCIDeviceRebind(virPCIDevice *dev); -int virPCIDeviceGetDriverPathAndName(virPCIDevice *dev, - char **path, - char **name); +int virPCIDeviceGetCurrentDriverPathAndName(virPCIDevice *dev, + char **path, + char **name); =20 int virPCIDeviceIsPCIExpress(virPCIDevice *dev); int virPCIDeviceHasPCIExpressLink(virPCIDevice *dev); diff --git a/tests/virpcitest.c b/tests/virpcitest.c index 92cc8c07c6..d69a1b5118 100644 --- a/tests/virpcitest.c +++ b/tests/virpcitest.c @@ -37,7 +37,7 @@ testVirPCIDeviceCheckDriver(virPCIDevice *dev, const char= *expected) g_autofree char *path =3D NULL; g_autofree char *driver =3D NULL; =20 - if (virPCIDeviceGetDriverPathAndName(dev, &path, &driver) < 0) + if (virPCIDeviceGetCurrentDriverPathAndName(dev, &path, &driver) < 0) return -1; =20 if (STRNEQ_NULLABLE(driver, expected)) { --=20 2.41.0 From nobody Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1692646395; cv=none; d=zohomail.com; s=zohoarc; b=mOU81yJ3fpGag+qoJQuRoOb2shFaOcYvleij+oIKdRV1Jn6xwbh0XVJVwKa8puGM5uGySJ8oY/jfQ5zaaFRWVzo4Ovr4+HmEabC6xdYsTBvclL6WFmQkDzxUxrI+Cgpmj/Xlr0dnv3p2hxNq9WYhrTGs4B9ifDsvD8oksQUFRMw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692646395; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=mZ5MHKNXs7zabIbfUogNyBDGOscqGT6VadihqtQV2K0=; b=dJvQtLDpouLfiYqTO3WEvkWhb8+bfUjabCTUzQ5dIaaKOVa6KvPqemXvbml4lKE/IN+nm1VsZkZuuvZ2gApah0YF9IOqLh/Z4NxbDgKUcfG7BFPmCMa1qdttGEgslmph+CwoHQYu5g/AyZxj7YLUtJlnDeyLOLxcuDwV1s9c290= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1692646395150261.9255662279327; Mon, 21 Aug 2023 12:33:15 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-66-sR4PMjWRM82FHRmTm9xLEg-1; Mon, 21 Aug 2023 15:33:11 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CE6608015AB; Mon, 21 Aug 2023 19:33:08 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id BA130492C13; Mon, 21 Aug 2023 19:33:08 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3AC9419466DF; Mon, 21 Aug 2023 19:33:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 40BA119465A0 for ; Mon, 21 Aug 2023 19:33:00 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 20551492C13; Mon, 21 Aug 2023 19:33:00 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.9.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD1614021B9; Mon, 21 Aug 2023 19:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692646393; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=mZ5MHKNXs7zabIbfUogNyBDGOscqGT6VadihqtQV2K0=; b=i6z+ZkCL1cbiofVwoc2Wu2cgebKa6NKaAUa1B7tIIZJncR/0chHxeuoF0vK2spoR8xNlWt 5QQYiuAxl8Rcl9cFslyfwapTVvTEjDkVyL5l4piokS0kC6YvTMlPUvTBUJVVktz2So+uFC DozWW3VOL+ZQAN+gu62erJGKy8bcsd8= X-MC-Unique: sR4PMjWRM82FHRmTm9xLEg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v3 4/8] util: permit existing binding to VFIO variant driver Date: Mon, 21 Aug 2023 15:32:54 -0400 Message-ID: <20230821193258.520859-5-laine@redhat.com> In-Reply-To: <20230821193258.520859-1-laine@redhat.com> References: <20230821193258.520859-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Cc : Joao Martins" , "Cc : Cedric Le Goater" , "Cc : Jason Gunthorpe" Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1692646395634100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Before a PCI device can be assigned to a guest with VFIO, that device must be bound to the vfio-pci driver rather than to the device's normal host driver. The vfio-pci driver provides APIs that permit QEMU to perform all the necessary operations to make the device accessible to the guest. In the past vfio-pci was the only driver that supplied these APIs, but there are now vendor/device-specific "VFIO variant" drivers that provide the basic vfio-pci driver functionality/API while adding support for device-specific operations (for example these device-specific drivers may support live migration of certain devices). All that is needed to make this functionality available is to bind the vendor-specific "VFIO variant" driver to the device (rather than the generic vfio-pci driver, which will continue to work, just without the extra functionality). But until now libvirt has required that all PCI devices being assigned to a guest with VFIO specifically have the "vfio-pci" driver bound to the device. So even if the user manually binds a shiny new vendor-specific VFIO variant driver to the device (and puts "managed=3D'no'" in the config to prevent libvirt from changing the binding), libvirt will just fail during startup of the guest (or during hotplug) because the driver bound to the device isn't exactly "vfio-pci". Beginning with kernel 6.1, it's possible to determine from the sysfs directory for a device whether the currently-bound driver is the vfio-pci driver or a VFIO variant - the device directory will have a subdirectory called "vfio-dev". We can use that to appropriately widen the list of drivers that libvirt will allow for VFIO device assignment. This patch doesn't remove the explicit check for the exact "vfio-pci" driver (since that would cause systems with pre-6.1 kernels to behave incorrectly), but adds an additional check for the vfio-dev directory, so that any VFIO variant driver is acceptable for libvirt to continue setting up for VFIO device assignment. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/hypervisor/virhostdev.c | 28 +++++-------- src/libvirt_private.syms | 1 + src/util/virpci.c | 78 ++++++++++++++++++++++++++++++++++--- src/util/virpci.h | 3 ++ 4 files changed, 87 insertions(+), 23 deletions(-) diff --git a/src/hypervisor/virhostdev.c b/src/hypervisor/virhostdev.c index 244f057c6c..b95d6bf3d6 100644 --- a/src/hypervisor/virhostdev.c +++ b/src/hypervisor/virhostdev.c @@ -743,9 +743,8 @@ virHostdevPreparePCIDevicesImpl(virHostdevManager *mgr, mgr->inactivePCIHostdevs) < 0) goto reattachdevs; } else { - g_autofree char *driverPath =3D NULL; - g_autofree char *driverName =3D NULL; - int stub; + g_autofree char *drvName =3D NULL; + virPCIStubDriver drvType; =20 /* Unmanaged devices should already have been marked as * inactive: if that's the case, we can simply move on */ @@ -765,19 +764,17 @@ virHostdevPreparePCIDevicesImpl(virHostdevManager *mg= r, * information about active / inactive device across * daemon restarts has been implemented */ =20 - if (virPCIDeviceGetCurrentDriverPathAndName(pci, &driverPath, - &driverName) < 0) { + if (virPCIDeviceGetCurrentDriverNameAndType(pci, &drvName, + &drvType) < 0) { goto reattachdevs; } =20 - stub =3D virPCIStubDriverTypeFromString(driverName); - - if (stub > VIR_PCI_STUB_DRIVER_NONE && - stub < VIR_PCI_STUB_DRIVER_LAST) { + if (drvType > VIR_PCI_STUB_DRIVER_NONE) { =20 /* The device is bound to a known stub driver: store this * information and add a copy to the inactive list */ - virPCIDeviceSetStubDriverType(pci, stub); + virPCIDeviceSetStubDriverType(pci, drvType); + virPCIDeviceSetStubDriverName(pci, drvName); =20 VIR_DEBUG("Adding PCI device %s to inactive list", virPCIDeviceGetName(pci)); @@ -2291,18 +2288,13 @@ virHostdevPrepareOneNVMeDevice(virHostdevManager *h= ostdev_mgr, /* Let's check if all PCI devices are NVMe disks. */ for (i =3D 0; i < virPCIDeviceListCount(pciDevices); i++) { virPCIDevice *pci =3D virPCIDeviceListGet(pciDevices, i); - g_autofree char *drvPath =3D NULL; g_autofree char *drvName =3D NULL; - int stub =3D VIR_PCI_STUB_DRIVER_NONE; + virPCIStubDriver drvType; =20 - if (virPCIDeviceGetCurrentDriverPathAndName(pci, &drvPath, &drvNam= e) < 0) + if (virPCIDeviceGetCurrentDriverNameAndType(pci, &drvName, &drvTyp= e) < 0) goto cleanup; =20 - if (drvName) - stub =3D virPCIStubDriverTypeFromString(drvName); - - if (stub =3D=3D VIR_PCI_STUB_DRIVER_VFIO || - STREQ_NULLABLE(drvName, "nvme")) + if (drvType =3D=3D VIR_PCI_STUB_DRIVER_VFIO || STREQ_NULLABLE(drvN= ame, "nvme")) continue; =20 VIR_WARN("Suspicious NVMe disk assignment. PCI device " diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 2b577c4e2d..413985d34c 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -3064,6 +3064,7 @@ virPCIDeviceFileIterate; virPCIDeviceFree; virPCIDeviceGetAddress; virPCIDeviceGetConfigPath; +virPCIDeviceGetCurrentDriverNameAndType; virPCIDeviceGetCurrentDriverPathAndName; virPCIDeviceGetIOMMUGroupDev; virPCIDeviceGetIOMMUGroupList; diff --git a/src/util/virpci.c b/src/util/virpci.c index 2ec0dc2053..e165725cd9 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -280,6 +280,73 @@ virPCIDeviceGetCurrentDriverPathAndName(virPCIDevice *= dev, } =20 =20 +/** + * virPCIDeviceGetCurrentDriverNameAndType: + * @dev: virPCIDevice object to examine + * @drvName: returns name of driver bound to this device (if any) + * @drvType: returns type of driver if it is a known stub driver type + * + * Find the name of the driver bound to @dev (if any) and the type of + * the driver if it is a known/recognized "stub" driver (based on the + * driver name). + * + * There are vfio "variant" drivers that provide all the basic + * functionality of the standard vfio-pci driver as well as additional + * stuff. As of kernel 6.1, the vfio-pci driver and all vfio variant + * drivers can be identified (once the driver has been bound to a + * device) by looking for the subdirectory "vfio-dev" in the device's + * sysfs directory; for example, if the directory + * /sys/bus/pci/devices/0000:04:11.4/vfio-dev exists, then the driver + * that is currently bound to PCI device 0000:04:11.4 is either + * vfio-pci, or a vfio-pci variant driver. + * + * Return 0 on success, -1 on failure. If -1 is returned, then an error + * message has been logged. + */ +int +virPCIDeviceGetCurrentDriverNameAndType(virPCIDevice *dev, + char **drvName, + virPCIStubDriver *drvType) +{ + g_autofree char *drvPath =3D NULL; + g_autofree char *vfioDevDir =3D NULL; + int tmpType; + + if (virPCIDeviceGetCurrentDriverPathAndName(dev, &drvPath, drvName) < = 0) + return -1; + + if (!*drvName) { + *drvType =3D VIR_PCI_STUB_DRIVER_NONE; + return 0; + } + + tmpType =3D virPCIStubDriverTypeFromString(*drvName); + + if (tmpType > VIR_PCI_STUB_DRIVER_NONE) { + *drvType =3D tmpType; + return 0; /* exact match of a known driver name (or no name) */ + } + + /* If the sysfs directory of this device contains a directory + * named "vfio-dev" then the currently-bound driver is a vfio + * variant driver. + */ + + vfioDevDir =3D virPCIFile(dev->name, "vfio-dev"); + + if (virFileIsDir(vfioDevDir)) { + VIR_DEBUG("Driver %s is a vfio_pci driver", *drvName); + *drvType =3D VIR_PCI_STUB_DRIVER_VFIO; + } else { + VIR_DEBUG("Driver %s is NOT a vfio_pci driver, or kernel is too ol= d", + *drvName); + *drvType =3D VIR_PCI_STUB_DRIVER_NONE; + } + + return 0; +} + + static int virPCIDeviceConfigOpenInternal(virPCIDevice *dev, bool readonly, bool fata= l) { @@ -1007,8 +1074,8 @@ virPCIDeviceReset(virPCIDevice *dev, virPCIDeviceList *activeDevs, virPCIDeviceList *inactiveDevs) { - g_autofree char *drvPath =3D NULL; g_autofree char *drvName =3D NULL; + virPCIStubDriver drvType; int ret =3D -1; int fd =3D -1; int hdrType =3D -1; @@ -1034,15 +1101,16 @@ virPCIDeviceReset(virPCIDevice *dev, * reset it whenever appropriate, so doing it ourselves would just * be redundant. */ - if (virPCIDeviceGetCurrentDriverPathAndName(dev, &drvPath, &drvName) <= 0) + if (virPCIDeviceGetCurrentDriverNameAndType(dev, &drvName, &drvType) <= 0) goto cleanup; =20 - if (virPCIStubDriverTypeFromString(drvName) =3D=3D VIR_PCI_STUB_DRIVER= _VFIO) { - VIR_DEBUG("Device %s is bound to vfio-pci - skip reset", - dev->name); + if (drvType =3D=3D VIR_PCI_STUB_DRIVER_VFIO) { + + VIR_DEBUG("Device %s is bound to %s - skip reset", dev->name, drvN= ame); ret =3D 0; goto cleanup; } + VIR_DEBUG("Resetting device %s", dev->name); =20 if ((fd =3D virPCIDeviceConfigOpenWrite(dev)) < 0) diff --git a/src/util/virpci.h b/src/util/virpci.h index 19c910202a..faca6cf6f9 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -283,6 +283,9 @@ int virPCIDeviceRebind(virPCIDevice *dev); int virPCIDeviceGetCurrentDriverPathAndName(virPCIDevice *dev, char **path, char **name); +int virPCIDeviceGetCurrentDriverNameAndType(virPCIDevice *dev, + char **drvName, + virPCIStubDriver *drvType); =20 int virPCIDeviceIsPCIExpress(virPCIDevice *dev); int virPCIDeviceHasPCIExpressLink(virPCIDevice *dev); --=20 2.41.0 From nobody Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1692646468; cv=none; d=zohomail.com; s=zohoarc; b=g1c+RITArXZyxjmDlrVl+W/s+VpBOM0wDc6n2LORDq81bxb8D2DyL18M800zg8D5BNwXK6YFKM3Ia+v4MIAWnn6QuX7AePxupFti1jVxEV/ixlhwibgjXlLybTyNQinfIlz1WNE6mCAizAE0hCClysurZSczHfAzg+ABVIp0xvM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692646468; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=pEQpna+mTq5rfAiowEPiM5gD7tO5bFWvCiCAcCLIN9o=; b=efNocSqiVOWCB05jwfA9Ng77h3XtsKxZuwrsHCAxA10lFCjfFYDM7KR0mI8RoHWmXMPcYDQMMYKSUB5GKDuEYQGBwo1he/zJgymfMeTV717PZmIpHi28fRc9piKmIzAVj+C+UpMBtMAS/DFqgaY+mx+cvJ9IbmptMbgcfHjR7kQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1692646468664297.5225783446185; Mon, 21 Aug 2023 12:34:28 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-550-l0a40JEwO7mXlWsR7Rfx3A-1; Mon, 21 Aug 2023 15:33:38 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 15CE88D40B6; Mon, 21 Aug 2023 19:33:36 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 007B6492C13; Mon, 21 Aug 2023 19:33:36 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0D3D91946A7B; Mon, 21 Aug 2023 19:33:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 789091946A4B for ; Mon, 21 Aug 2023 19:33:05 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 63EC04021B9; Mon, 21 Aug 2023 19:33:00 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.9.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2D29C40282C; Mon, 21 Aug 2023 19:33:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692646467; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=pEQpna+mTq5rfAiowEPiM5gD7tO5bFWvCiCAcCLIN9o=; b=DrcZ3rCOJZg25VuHtGajGP0/+W0TRet2GT5+fEyBH8+0WEL5Pfd7tsF7nRGhbhAaR70uez RD81eNizV/RLBs4DyLxY4AFbQUrorNaCQ+DVJkjWWz5//GV//xzxJzttH4FOKSfQDBovRN RXzPmxPPe7WPxB5wui261WnEFFKoxTI= X-MC-Unique: l0a40JEwO7mXlWsR7Rfx3A-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v3 5/8] util: probe stub driver from within function that binds to stub driver Date: Mon, 21 Aug 2023 15:32:55 -0400 Message-ID: <20230821193258.520859-6-laine@redhat.com> In-Reply-To: <20230821193258.520859-1-laine@redhat.com> References: <20230821193258.520859-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Cc : Joao Martins" , "Cc : Cedric Le Goater" , "Cc : Jason Gunthorpe" Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1692646471093100001 Content-Type: text/plain; charset="utf-8"; x-default="true" virPCIProbeStubDriver() and virPCIDeviceBindToStub() both have very similar code that locally sets a driver name (based on stubDriverType). These two functions are each also called in just one place (virPCIDeviceDetach()), with just a small bit of validation code in between. To eliminate the "duplicated" code (which is going to be expanded slightly in upcoming patches to support manually or automatically picking a VFIO variant driver), this patch modifies virPCIProbeStubDriver() to take the driver name as an argument (rather than the virPCIDevice object), and calls it from within virPCIDeviceBindToStub() (rather than from that function's caller), using the driverName it has just figured out with the now-not-duplicated code. (NB: Since it could be used to probe *any* driver module, the name is changed to virPCIProbeDriver()). Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/util/virpci.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/util/virpci.c b/src/util/virpci.c index e165725cd9..ac91480e0b 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -1154,28 +1154,19 @@ virPCIDeviceReset(virPCIDevice *dev, =20 =20 static int -virPCIProbeStubDriver(virPCIStubDriver driver) +virPCIProbeDriver(const char *driverName) { - const char *drvname =3D NULL; g_autofree char *drvpath =3D NULL; g_autofree char *errbuf =3D NULL; =20 - if (driver =3D=3D VIR_PCI_STUB_DRIVER_NONE || - !(drvname =3D virPCIStubDriverTypeToString(driver))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", - _("Attempting to use unknown stub driver")); - return -1; - } - - drvpath =3D virPCIDriverDir(drvname); + drvpath =3D virPCIDriverDir(driverName); =20 /* driver previously loaded, return */ if (virFileExists(drvpath)) return 0; =20 - if ((errbuf =3D virKModLoad(drvname))) { - VIR_WARN("failed to load driver %s: %s", drvname, errbuf); + if ((errbuf =3D virKModLoad(driverName))) { + VIR_WARN("failed to load driver %s: %s", driverName, errbuf); goto cleanup; } =20 @@ -1187,14 +1178,14 @@ virPCIProbeStubDriver(virPCIStubDriver driver) /* If we know failure was because of admin config, let's report that; * otherwise, report a more generic failure message */ - if (virKModIsProhibited(drvname)) { + if (virKModIsProhibited(driverName)) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to load PCI stub module %1$s: administrat= ively prohibited"), - drvname); + _("Failed to load PCI driver module %1$s: administr= atively prohibited"), + driverName); } else { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Failed to load PCI stub module %1$s"), - drvname); + _("Failed to load PCI driver module %1$s"), + driverName); } =20 return -1; @@ -1316,6 +1307,9 @@ virPCIDeviceBindToStub(virPCIDevice *dev) return -1; } =20 + if (virPCIProbeDriver(stubDriverName) < 0) + return -1; + stubDriverPath =3D virPCIDriverDir(stubDriverName); driverLink =3D virPCIFile(dev->name, "driver"); =20 @@ -1358,9 +1352,6 @@ virPCIDeviceDetach(virPCIDevice *dev, virPCIDeviceList *activeDevs, virPCIDeviceList *inactiveDevs) { - if (virPCIProbeStubDriver(dev->stubDriverType) < 0) - return -1; - if (activeDevs && virPCIDeviceListFind(activeDevs, &dev->address)) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Not detaching active device %1$s"), dev->name); --=20 2.41.0 From nobody Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 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=1692646423; cv=none; d=zohomail.com; s=zohoarc; b=LCW/nebB+lpTijC3AUtOfxVpbeSHCX/i4/C7ZIYAqEatRJqVaX7jqbCdwvyS7VDplzaZVfkG9Am/kZ9WKsKTbG+xOMTKRAMeAipBc9KClVeRxkW/sxuaM3RSa2FkmtF4bKb8Dh531CDpz8ucsNMroUUXY3Px0AYz6Mt0q1LlMJk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692646423; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=DsOUYB50EGWFFRBxITk+sr53hwTSTxvtI6nRyXjAoUI=; b=nzok2rWCmtuSivB7acN1/rB/xzWjuPRBjwA0hBTbN0KG1pK9C3Pj9mlxg0DhN7d+irkWMA9GsnkM6tEbtIQqwyJHoNr9TTS2dBbT/6K+OmIcxaZLWX/7JMB34b+wYOYIlPEwr67wMIE5bVDDVEWmipGYRvthlllxaT7MjaxLUXM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1692646423481620.1361749429286; Mon, 21 Aug 2023 12:33:43 -0700 (PDT) Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-451-72yoCZW-PpeVT7c23QtuFg-1; Mon, 21 Aug 2023 15:33:38 -0400 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A13D03814952; Mon, 21 Aug 2023 19:33:36 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D51F40610B; Mon, 21 Aug 2023 19:33:36 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4725A19452C6; Mon, 21 Aug 2023 19:33:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id BE95B1946A5E for ; Mon, 21 Aug 2023 19:33:05 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A7CAA403161; Mon, 21 Aug 2023 19:33:00 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.9.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6FD71492C13; Mon, 21 Aug 2023 19:33:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692646422; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=DsOUYB50EGWFFRBxITk+sr53hwTSTxvtI6nRyXjAoUI=; b=jKtnbMtyi911Va1YQlITHGuB9B57pqs1U7GkXCbylLhY5Ax5zugawruABQhjucmEKOUvNY X5ForufhoKYl/GJu0gfHUU8EhAWbjAjH9ffOGnRp/Zrp3WUWtDVjqM1Ufq6ZIE5ogO2BjG pO4RhUwKEQh+42YVzZLFuM4hCN8RwNU= X-MC-Unique: 72yoCZW-PpeVT7c23QtuFg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v3 6/8] util: honor stubDriverName when probing/binding stub driver for a device Date: Mon, 21 Aug 2023 15:32:56 -0400 Message-ID: <20230821193258.520859-7-laine@redhat.com> In-Reply-To: <20230821193258.520859-1-laine@redhat.com> References: <20230821193258.520859-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Cc : Joao Martins" , "Cc : Cedric Le Goater" , "Cc : Jason Gunthorpe" Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1692646424951100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/util/virpci.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/util/virpci.c b/src/util/virpci.c index ac91480e0b..c721b8e533 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -1290,17 +1290,20 @@ virPCIDeviceUnbindFromStub(virPCIDevice *dev) static int virPCIDeviceBindToStub(virPCIDevice *dev) { - const char *stubDriverName; + const char *stubDriverName =3D dev->stubDriverName; g_autofree char *stubDriverPath =3D NULL; g_autofree char *driverLink =3D NULL; =20 - /* Check the device is configured to use one of the known stub drivers= */ + if (dev->stubDriverType =3D=3D VIR_PCI_STUB_DRIVER_NONE) { virReportError(VIR_ERR_INTERNAL_ERROR, _("No stub driver configured for PCI device %1$s"), dev->name); return -1; - } else if (!(stubDriverName =3D virPCIStubDriverTypeToString(dev->stub= DriverType))) { + } + + if (!stubDriverName + && !(stubDriverName =3D virPCIStubDriverTypeToString(dev->stubDriv= erType))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unknown stub driver configured for PCI device %1= $s"), dev->name); --=20 2.41.0 From nobody Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1692646450; cv=none; d=zohomail.com; s=zohoarc; b=PXfaLPzd1gW3Z9g9Bb6TB91eO9V3yCSGXTQzmkoN/UwI+LZ4vjOcDtEpcf1G9VilFSKhOeaA9NLj77lmjjRzZ7n8vWsBUQB0YR4T2Pq2TweO71EgCFyVZxhOEeuHaaV2S5EdXPENDqeZZGAxul9kUeMwKX+Sr7vdMlSa7prEAXQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692646450; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=oRtVG7GR5kuTO18RdKHtT4chA8FgT1uQ0mTjV4BPFcw=; b=c87p41OT8iazRgnubNe+g3xHa/KSgLK6fYRY/mmIna/EZ4ZHOFJ8ekoAYGsScJTdgAm6xuJKCW1Ap/sw2y9+qj0cH/OP7qLQBaZkRuGHE2RDUgzOaGSflKVB8WeEbzbzPcxPdGC7a9xyDAx06AQjATOddhitNLZGyL60mQvIn0E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 169264645016197.7980429615676; Mon, 21 Aug 2023 12:34:10 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-686-AiLCHUTxNem9vhDbL4UZiQ-1; Mon, 21 Aug 2023 15:33:45 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 67D628022E4; Mon, 21 Aug 2023 19:33:43 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 497E540D2843; Mon, 21 Aug 2023 19:33:43 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D993519465BD; Mon, 21 Aug 2023 19:33:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 21F7C1946588 for ; Mon, 21 Aug 2023 19:33:06 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id ECE8A403163; Mon, 21 Aug 2023 19:33:00 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.9.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id B4860492C13; Mon, 21 Aug 2023 19:33:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692646448; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=oRtVG7GR5kuTO18RdKHtT4chA8FgT1uQ0mTjV4BPFcw=; b=gRoRwCafcd9Wrs3UoUc0ZROWERH8CSPSJMmU3ncCHL9By1Rjpwf127fI7X/Ro1g8MSn0LF 8VAPoHaOmU6dFskUxyyQwQ0Pd9O/SmcMbYWi+mvd4t/FSvTmqcJMs+V5kzUoHFFcEP8ArF pWQ+G1R6rr2w02scv+D/wFf6xCgXImA= X-MC-Unique: AiLCHUTxNem9vhDbL4UZiQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v3 7/8] node_device: support binding other drivers with virNodeDeviceDetachFlags() Date: Mon, 21 Aug 2023 15:32:57 -0400 Message-ID: <20230821193258.520859-8-laine@redhat.com> In-Reply-To: <20230821193258.520859-1-laine@redhat.com> References: <20230821193258.520859-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Cc : Joao Martins" , "Cc : Cedric Le Goater" , "Cc : Jason Gunthorpe" Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1692646451081100001 Content-Type: text/plain; charset="utf-8"; x-default="true" In the past, the only allowable values for the "driver" field of virNodeDeviceDetachFlags() were "kvm" or "vfio" for the QEMU driver, and "xen" for the libxl driver. Then "kvm" was deprecated and removed, so the driver name became essentially irrelevant (because it is always called via a particular hypervisor driver, and so the "xen" or "vfio" can be (and almost always is) implied. With the advent of VFIO variant drivers, the ability to explicitly specify a driver name once again becomes useful - it can be used to name the exact VFIO driver that we want bound to the device in place of vfio-pci, so this patch allows those other names to be passed down the call chain, where the code in virpci.c can make use of them. The names "vfio", "kvm", and "xen" retain their special meaning, though: 1) because there may be some application or configuration that still calls virNodeDeviceDetachFlags() with driverName=3D"vfio", this single value is substituted with the synonym of NULL, which means "bind the default driver for this device and hypervisor". This will currently result in the vfio-pci driver being bound to the device. 2) in the case of the libxl driver, "xen" means to use the standard driver used in the case of Xen ("pciback"). 3) "kvm" as a driver name always results in an error, as legacy KVM device assignment was removed from the kernel around 10 years ago. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/hypervisor/domain_driver.c | 9 ++++----- src/hypervisor/domain_driver.h | 2 ++ src/libxl/libxl_driver.c | 3 ++- src/qemu/qemu_driver.c | 33 +++++++++++++++++++-------------- 4 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/hypervisor/domain_driver.c b/src/hypervisor/domain_driver.c index a70f75f3ae..429784292a 100644 --- a/src/hypervisor/domain_driver.c +++ b/src/hypervisor/domain_driver.c @@ -462,6 +462,7 @@ virDomainDriverNodeDeviceReAttach(virNodeDevicePtr dev, int virDomainDriverNodeDeviceDetachFlags(virNodeDevicePtr dev, virHostdevManager *hostdevMgr, + virPCIStubDriver driverType, const char *driverName) { g_autoptr(virPCIDevice) pci =3D NULL; @@ -471,7 +472,7 @@ virDomainDriverNodeDeviceDetachFlags(virNodeDevicePtr d= ev, g_autoptr(virConnect) nodeconn =3D NULL; g_autoptr(virNodeDevice) nodedev =3D NULL; =20 - if (!driverName) + if (driverType =3D=3D VIR_PCI_STUB_DRIVER_NONE) return -1; =20 if (!(nodeconn =3D virGetConnectNodeDev())) @@ -504,10 +505,8 @@ virDomainDriverNodeDeviceDetachFlags(virNodeDevicePtr = dev, if (!pci) return -1; =20 - if (STREQ(driverName, "vfio")) - virPCIDeviceSetStubDriverType(pci, VIR_PCI_STUB_DRIVER_VFIO); - else if (STREQ(driverName, "xen")) - virPCIDeviceSetStubDriverType(pci, VIR_PCI_STUB_DRIVER_XEN); + virPCIDeviceSetStubDriverType(pci, driverType); + virPCIDeviceSetStubDriverName(pci, driverName); =20 return virHostdevPCINodeDeviceDetach(hostdevMgr, pci); } diff --git a/src/hypervisor/domain_driver.h b/src/hypervisor/domain_driver.h index 4241c86932..9942f58fda 100644 --- a/src/hypervisor/domain_driver.h +++ b/src/hypervisor/domain_driver.h @@ -22,6 +22,7 @@ =20 #include "node_device_conf.h" #include "virhostdev.h" +#include "virpci.h" =20 char * virDomainDriverGenerateRootHash(const char *drivername, @@ -58,6 +59,7 @@ int virDomainDriverNodeDeviceReAttach(virNodeDevicePtr de= v, =20 int virDomainDriverNodeDeviceDetachFlags(virNodeDevicePtr dev, virHostdevManager *hostdevMgr, + virPCIStubDriver driverType, const char *driverName); =20 int virDomainDriverAddIOThreadCheck(virDomainDef *def, diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 3d10f45850..079922dd32 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -5876,7 +5876,8 @@ libxlNodeDeviceDetachFlags(virNodeDevicePtr dev, =20 /* virNodeDeviceDetachFlagsEnsureACL() is being called by * virDomainDriverNodeDeviceDetachFlags() */ - return virDomainDriverNodeDeviceDetachFlags(dev, hostdev_mgr, driverNa= me); + return virDomainDriverNodeDeviceDetachFlags(dev, hostdev_mgr, + VIR_PCI_STUB_DRIVER_XEN, N= ULL); } =20 static int diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f8039160f4..f676744e9e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -70,7 +70,6 @@ #include "domain_driver.h" #include "domain_postparse.h" #include "domain_validate.h" -#include "virpci.h" #include "virpidfile.h" #include "virprocess.h" #include "libvirt_internal.h" @@ -11400,24 +11399,28 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev, =20 virCheckFlags(0, -1); =20 - if (!driverName) - driverName =3D "vfio"; - - /* Only the 'vfio' driver is supported and a special error message for - * the previously supported 'kvm' driver is provided below. */ - if (STRNEQ(driverName, "vfio") && STRNEQ(driverName, "kvm")) { - virReportError(VIR_ERR_INVALID_ARG, - _("unknown driver name '%1$s'"), driverName); - return -1; - } + /* For historical reasons, if driverName is "vfio", that is the + * same as NULL, i.e. the default vfio driver for this device + */ + if (STREQ_NULLABLE(driverName, "vfio")) + driverName =3D NULL; =20 - if (STREQ(driverName, "kvm")) { + /* the "kvm" driver name was used a very long time ago to force + * "legacy KVM device assignment", which hasn't been supported in + * over 10 years. + */ + if (STREQ_NULLABLE(driverName, "kvm")) { virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("KVM device assignment is no longer " + _("'legacy KVM' device assignment is no longer " "supported on this system")); return -1; } =20 + /* for any other driver, we can't know whether or not it is a VFIO + * driver until the device has been bound to it, so we will defer + * further validation until then. + */ + if (!qemuHostdevHostSupportsPassthroughVFIO()) { virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", _("VFIO device assignment is currently not " @@ -11427,7 +11430,9 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev, =20 /* virNodeDeviceDetachFlagsEnsureACL() is being called by * virDomainDriverNodeDeviceDetachFlags() */ - return virDomainDriverNodeDeviceDetachFlags(dev, hostdev_mgr, driverNa= me); + return virDomainDriverNodeDeviceDetachFlags(dev, hostdev_mgr, + VIR_PCI_STUB_DRIVER_VFIO, + driverName); } =20 static int --=20 2.41.0 From nobody Sun May 19 13:34:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 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=1692646437; cv=none; d=zohomail.com; s=zohoarc; b=fhdUHyJaIobeGqgmlEK6JFG8rWXGPntfaOe33gZbyvt55ldkZ3JDXUzt04PFiU2Z71IZ2yxRhEN4AJXWq05AY15k2fQFm1aRDlNSRDq1CeyrMGRNupzyo0QcPdbYtd+quwdPV246bhRO6IIU4MO51Z1HjDT8Gua0IByOzOGRuEo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1692646437; h=Content-Type:Content-Transfer-Encoding:Cc: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; bh=agtk7AiHeU/m5b2pPQYLZSsjcyzCUv5xMo3e/Tm1cxA=; b=hiXAPzpVWXNb3I/REBX/SmNCoPbKsTks0SjL7foQJSVU/hUUR0T3NHDpiIW7Ijo5YUzVagrihXOVMRnqHyhsgl5UT7Oa8255OENXVmtda0k3Cxc7y7ZCfdAl2VyP8GD+v7ARuum3LKgDFa8/m0ZMBl24tMBo45Zl9Tgmw9PinwA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1692646437530888.7848354569351; Mon, 21 Aug 2023 12:33:57 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-335-KG7ljDTbPJi-BoZrMA0hQQ-1; Mon, 21 Aug 2023 15:33:40 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B45AC18E0042; Mon, 21 Aug 2023 19:33:37 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A205F63F6C; Mon, 21 Aug 2023 19:33:37 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9009119465A3; Mon, 21 Aug 2023 19:33:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4F49F19465BD for ; Mon, 21 Aug 2023 19:33:01 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 3EDD9403166; Mon, 21 Aug 2023 19:33:01 +0000 (UTC) Received: from vhost3.router.laine.org (unknown [10.22.9.186]) by smtp.corp.redhat.com (Postfix) with ESMTP id 07222492C13; Mon, 21 Aug 2023 19:33:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692646436; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=agtk7AiHeU/m5b2pPQYLZSsjcyzCUv5xMo3e/Tm1cxA=; b=dMrYt2SQvx27+zO0ve9cnQIgQHu/+BvJ/Xt5qfKSL6+EnzEsCPe4m9OPs89GSimrJLf3Ui YqO2dOB5t1I4d3oDMxiih25f0gYcctslWgmBy4DFSqrYYjFWpMQYPhF/pRShH3XyJheLho Lt9U8wjmbpnXOdEsifprkN9v3SEuARM= X-MC-Unique: KG7ljDTbPJi-BoZrMA0hQQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v3 8/8] qemu: turn two multiline log messages into single line Date: Mon, 21 Aug 2023 15:32:58 -0400 Message-ID: <20230821193258.520859-9-laine@redhat.com> In-Reply-To: <20230821193258.520859-1-laine@redhat.com> References: <20230821193258.520859-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Cc : Joao Martins" , "Cc : Cedric Le Goater" , "Cc : Jason Gunthorpe" Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1692646437896100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Normally I wouldn't bother with a change like this, but I was touching the function anyway, and wanted to leave it looking nice and tidy. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index f676744e9e..a60cbf0ed4 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -11411,8 +11411,7 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev, */ if (STREQ_NULLABLE(driverName, "kvm")) { virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("'legacy KVM' device assignment is no longer " - "supported on this system")); + _("'legacy KVM' device assignment is no longer supp= orted on this system")); return -1; } =20 @@ -11423,8 +11422,7 @@ qemuNodeDeviceDetachFlags(virNodeDevicePtr dev, =20 if (!qemuHostdevHostSupportsPassthroughVFIO()) { virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", - _("VFIO device assignment is currently not " - "supported on this system")); + _("VFIO device assignment is currently not supporte= d on this system")); return -1; } =20 --=20 2.41.0