From nobody Mon Feb 9 14:33:27 2026 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 --- 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