From nobody Wed May 15 17:01:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1607701670; cv=none; d=zohomail.com; s=zohoarc; b=BM/8G9QC36By23/WN4b9jWw3oywtA/CoqGL9klDtuXmzCcs/iCb+oP7P2ukqdAL935D+aB/gB63xdf0LMX30CssMmL2u9BPzwNtRW9iD/EIYuoAwWbtg7sWIHjbwmRx9EWmOdOrgjsZLkyv8hrFqd9+/lo+uB+yPD/15DEsCHec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607701670; 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; bh=q7ZJQENtCtg4f0WnT0RWcsSRu4lg4DSzYTO+BZXAU+8=; b=T88PHmMYbv3T/kO1zWGSfAupmFHm9YunUdihX1+0FnPP/jJrdS5OmVsr1zeSU4so5eticatvdAPMvgmoW5grwsbfuIrKOBCIiIAMeJukmnSnOIJ5IFvtMS4780H5arfUrtdZGaZQshcIUx6/Pi0lYpaRBd9ODgH9/X51EhfdLI8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1607701670541146.76268217017957; Fri, 11 Dec 2020 07:47:50 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-513-pJecMiMXP86mnh5JR876GA-1; Fri, 11 Dec 2020 10:47:46 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6AFDC10054FF; Fri, 11 Dec 2020 15:47:40 +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 D694360BF1; Fri, 11 Dec 2020 15:47:39 +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 48DF14A7C6; Fri, 11 Dec 2020 15:47:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BBFlVZl013789 for ; Fri, 11 Dec 2020 10:47:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id 43EBA60BFA; Fri, 11 Dec 2020 15:47:31 +0000 (UTC) Received: from vhost2.laine.org (ovpn-113-158.phx2.redhat.com [10.3.113.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CF2E60BF1 for ; Fri, 11 Dec 2020 15:47:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607701669; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=q7ZJQENtCtg4f0WnT0RWcsSRu4lg4DSzYTO+BZXAU+8=; b=WCBqvq2BaXqpZ/n/m+PwDYC3fvIW3lA1zVq4P90d71CjZARNpz9xlr3QSNwaOe2gn1V+Wv aUf56CBEfeo6ejdTHt+JWMdv3cr8S655xkmoSiXz5eUnbbl5i/9eQeAKgtaAALvTQrrkAc 1YN1QJD95kleoqEr5Hzo8sMTmPG8sG4= X-MC-Unique: pJecMiMXP86mnh5JR876GA-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v2 1/7] qemu: use g_autoptr for a virPCIDevice Date: Fri, 11 Dec 2020 10:47:22 -0500 Message-Id: <20201211154728.1117948-2-laine@redhat.com> In-Reply-To: <20201211154728.1117948-1-laine@redhat.com> References: <20201211154728.1117948-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The one instance of a virPCIDevice in qemuDomainDeviceCalculatePCIConnectFlags() needs to be converted to use g_autoptr as a prerequisite for a bugfix. It's in this patch by itself (rather than in a patch converting all virPCIDevice usages to g_autoptr) to simplify any backport of said bugfix. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/qemu/qemu_domain_address.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index d872f75b38..b07672e2f4 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -803,7 +803,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevic= eDefPtr dev, case VIR_DOMAIN_DEVICE_HOSTDEV: { virDomainHostdevDefPtr hostdev =3D dev->data.hostdev; bool isExpress =3D false; - virPCIDevicePtr pciDev; + g_autoptr(virPCIDevice) pciDev =3D NULL; virPCIDeviceAddressPtr hostAddr =3D &hostdev->source.subsys.u.pci.= addr; =20 if (!virHostdevIsMdevDevice(hostdev) && @@ -891,8 +891,6 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevic= eDefPtr dev, off_t configLen =3D virFileLength(virPCIDeviceGetConfigPath(pciDev), -1); =20 - virPCIDeviceFree(pciDev); - if (configLen =3D=3D 256) return pciFlags; =20 @@ -904,7 +902,6 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevic= eDefPtr dev, * a definitive answer. */ isExpress =3D virPCIDeviceIsPCIExpress(pciDev); - virPCIDeviceFree(pciDev); =20 if (isExpress) return pcieFlags; --=20 2.28.0 From nobody Wed May 15 17:01:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1607701691; cv=none; d=zohomail.com; s=zohoarc; b=MpnhyRf5nQTs26wWU04TYx1PLiD0+eopBhqrWQRjS8O6tYBVuYn8KwIgJTRjlK0UURe6kmURd80xMtznE0LSkIhMFbTowS9PPlvfczz92Fa4d8ZdJEJbfHl4JcVADDg5o+Dt02JKBhXkEWJ1mz7QPDH7+F4JzME3+M2X3NF8BdM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607701691; 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; bh=NuMdpFC/V+Dyw8ez/m/KfYOwUD2pbure1i7s3wnXcOw=; b=kbJf1+fPbemoFxWqYl4sn1RVAJ1+25AMD7b7WclCPjGKQDvXAejx622NdrVJbkkOiIx0xvoH3Hs7DDd8UDsfm2hg4acwm7PszFipgfC/gfV4KhVBjO06Kl4XBrSQuJxZKl4xHKPS7xl0M0aJcrwHG1i+Xt28TjL34uAsx+t+7bE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1607701690999616.5487703880742; Fri, 11 Dec 2020 07:48:10 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-405-RmFDDjWKMA2a_JSiI2N_uw-1; Fri, 11 Dec 2020 10:48:07 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D2F23DF8AA; Fri, 11 Dec 2020 15:48: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 AF4FC5D6A8; Fri, 11 Dec 2020 15:48: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 6E3621809CA0; Fri, 11 Dec 2020 15:48:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BBFlVg3013795 for ; Fri, 11 Dec 2020 10:47:31 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9E12F60C04; Fri, 11 Dec 2020 15:47:31 +0000 (UTC) Received: from vhost2.laine.org (ovpn-113-158.phx2.redhat.com [10.3.113.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6731960BF1 for ; Fri, 11 Dec 2020 15:47:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607701689; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=NuMdpFC/V+Dyw8ez/m/KfYOwUD2pbure1i7s3wnXcOw=; b=EYNU6Rjw4I2yEa5hLdSR2RJrMN41BaVjYxOJLmbTrgfa40LUJRiBNBLf3FBUbY5TrvrRKT wu/H6fHu6I/fgvEh7RB1Jlk/AxpO28kLBVxxjQhoRcn2PdbIUS4Iyd2PM4ARbVm5cjoyIy bTGHDXY8SGNqu0PCYHVNoPIesldz2wU= X-MC-Unique: RmFDDjWKMA2a_JSiI2N_uw-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v2 2/7] util: simplify calling of virPCIDeviceDetectFunctionLevelReset() Date: Fri, 11 Dec 2020 10:47:23 -0500 Message-Id: <20201211154728.1117948-3-laine@redhat.com> In-Reply-To: <20201211154728.1117948-1-laine@redhat.com> References: <20201211154728.1117948-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This function returned an int, and that int was being checked for < 0 in its solitary caller, but within the function it would only ever return 0 or 1. Change the function itself to return a bool, and the caller to just directly set the flag in the virPCIDevice. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/util/virpci.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/util/virpci.c b/src/util/virpci.c index b63abac8cc..403ef1ec8e 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -549,7 +549,7 @@ virPCIDeviceFindExtendedCapabilityOffset(virPCIDevicePt= r dev, /* detects whether this device has FLR. Returns 0 if the device does * not have FLR, 1 if it does, and -1 on error */ -static int +static bool virPCIDeviceDetectFunctionLevelReset(virPCIDevicePtr dev, int cfgfd) { uint32_t caps; @@ -567,7 +567,7 @@ virPCIDeviceDetectFunctionLevelReset(virPCIDevicePtr de= v, int cfgfd) caps =3D virPCIDeviceRead32(dev, cfgfd, dev->pcie_cap_pos + PCI_EX= P_DEVCAP); if (caps & PCI_EXP_DEVCAP_FLR) { VIR_DEBUG("%s %s: detected PCIe FLR capability", dev->id, dev-= >name); - return 1; + return true; } } =20 @@ -580,7 +580,7 @@ virPCIDeviceDetectFunctionLevelReset(virPCIDevicePtr de= v, int cfgfd) caps =3D virPCIDeviceRead16(dev, cfgfd, pos + PCI_AF_CAP); if (caps & PCI_AF_CAP_FLR) { VIR_DEBUG("%s %s: detected PCI FLR capability", dev->id, dev->= name); - return 1; + return true; } } =20 @@ -596,12 +596,12 @@ virPCIDeviceDetectFunctionLevelReset(virPCIDevicePtr = dev, int cfgfd) if (found) { VIR_DEBUG("%s %s: buggy device didn't advertise FLR, but is a VF; = forcing flr on", dev->id, dev->name); - return 1; + return true; } =20 VIR_DEBUG("%s %s: no FLR capability found", dev->id, dev->name); =20 - return 0; + return false; } =20 /* Require the device has the PCI Power Management capability @@ -885,15 +885,10 @@ virPCIDeviceTryPowerManagementReset(virPCIDevicePtr d= ev, int cfgfd) static int virPCIDeviceInit(virPCIDevicePtr dev, int cfgfd) { - int flr; - dev->pcie_cap_pos =3D virPCIDeviceFindCapabilityOffset(dev, cfgfd, P= CI_CAP_ID_EXP); dev->pci_pm_cap_pos =3D virPCIDeviceFindCapabilityOffset(dev, cfgfd, P= CI_CAP_ID_PM); - flr =3D virPCIDeviceDetectFunctionLevelReset(dev, cfgfd); - if (flr < 0) - return flr; - dev->has_flr =3D !!flr; - dev->has_pm_reset =3D !!virPCIDeviceDetectPowerManagementReset(dev, = cfgfd); + dev->has_flr =3D virPCIDeviceDetectFunctionLevelReset(dev, cfgfd); + dev->has_pm_reset =3D !!virPCIDeviceDetectPowerManagementReset(dev, cf= gfd); =20 return 0; } --=20 2.28.0 From nobody Wed May 15 17:01:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1607701747; cv=none; d=zohomail.com; s=zohoarc; b=C8XEUiFB+TKX9/ygaleSczaQ/Tahdp7rH6kTGmMxuJwVALqbaoAhLqOQdC4dnn1SYOV6xWHMIVw/iayhTGWjKKkcq9X7tAD814lb/YsZKFIGmDUop3QiEOi1dSN0SgZuXZTQoUAfCQ8KXW/CNscYenkuDvuF2qNFJc24XjbaKOY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607701747; 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; bh=SwLpD5NqkdXY1AYIKGCuq8JUTymUN7TIYykMLAnFkmY=; b=hBf5Y+GVH5ON8pMzto1xHTghC2xNmKBnhYfs9hkd4fQ3sFZoxGAJDBakArckiRePYqIeVwhuHbAWViJyfniyQZnz6yG3rsWv9uKUQcvv6ZpmWDC5YsFp7dnyHDIIqCbCiaQe+RFZSfD7aeT/4Sa4BohP+XCN0h4xDUAuUoz73nA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1607701747032440.9167361995068; Fri, 11 Dec 2020 07:49:07 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-405-zGEF6JenMl-wSZvbu8ivfA-1; Fri, 11 Dec 2020 10:48:07 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id D5AFA802B42; Fri, 11 Dec 2020 15:48: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 AFF5C100239F; Fri, 11 Dec 2020 15:48: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 6DF7C1809C9F; Fri, 11 Dec 2020 15:48:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BBFlWd8013800 for ; Fri, 11 Dec 2020 10:47:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0642A60BFA; Fri, 11 Dec 2020 15:47:32 +0000 (UTC) Received: from vhost2.laine.org (ovpn-113-158.phx2.redhat.com [10.3.113.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id C217560BF1 for ; Fri, 11 Dec 2020 15:47:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607701745; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=SwLpD5NqkdXY1AYIKGCuq8JUTymUN7TIYykMLAnFkmY=; b=gZ6RIRFyMNTLVYA+JN1rNv38oCdZSZrKBPVH8KRezdRyQp3ipkV7jKu1MJQdgO+mxcFCoe vKkorwLyLeu0iFVKNHKfi8uQeDv6zzwQGbPp55FCM6K1JO9JuIWG+G1FhA1ujQPS2lmDia CRUmVYitx/Bc6dTSFJ/lOcTGUuRWAdg= X-MC-Unique: zGEF6JenMl-wSZvbu8ivfA-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v2 3/7] util: simplify call to virPCIDeviceDetectPowerManagementReset() Date: Fri, 11 Dec 2020 10:47:24 -0500 Message-Id: <20201211154728.1117948-4-laine@redhat.com> In-Reply-To: <20201211154728.1117948-1-laine@redhat.com> References: <20201211154728.1117948-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This function returned an int, but would only return 0 or 1, and the one place it was called would just use !! to convert that value to a bool. Change the function to directly return bool instead. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/util/virpci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/virpci.c b/src/util/virpci.c index 403ef1ec8e..31622cddfa 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -608,7 +608,7 @@ virPCIDeviceDetectFunctionLevelReset(virPCIDevicePtr de= v, int cfgfd) * and that a D3hot->D0 transition will results in a full * internal reset, not just a soft reset. */ -static unsigned int +static bool virPCIDeviceDetectPowerManagementReset(virPCIDevicePtr dev, int cfgfd) { if (dev->pci_pm_cap_pos) { @@ -618,13 +618,13 @@ virPCIDeviceDetectPowerManagementReset(virPCIDevicePt= r dev, int cfgfd) ctl =3D virPCIDeviceRead32(dev, cfgfd, dev->pci_pm_cap_pos + PCI_P= M_CTRL); if (!(ctl & PCI_PM_CTRL_NO_SOFT_RESET)) { VIR_DEBUG("%s %s: detected PM reset capability", dev->id, dev-= >name); - return 1; + return true; } } =20 VIR_DEBUG("%s %s: no PM reset capability found", dev->id, dev->name); =20 - return 0; + return false; } =20 /* Any active devices on the same domain/bus ? */ @@ -888,7 +888,7 @@ virPCIDeviceInit(virPCIDevicePtr dev, int cfgfd) dev->pcie_cap_pos =3D virPCIDeviceFindCapabilityOffset(dev, cfgfd, P= CI_CAP_ID_EXP); dev->pci_pm_cap_pos =3D virPCIDeviceFindCapabilityOffset(dev, cfgfd, P= CI_CAP_ID_PM); dev->has_flr =3D virPCIDeviceDetectFunctionLevelReset(dev, cfgfd); - dev->has_pm_reset =3D !!virPCIDeviceDetectPowerManagementReset(dev, cf= gfd); + dev->has_pm_reset =3D virPCIDeviceDetectPowerManagementReset(dev, cfgf= d); =20 return 0; } --=20 2.28.0 From nobody Wed May 15 17:01:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1607701693; cv=none; d=zohomail.com; s=zohoarc; b=h3dTCqNhcTDdwWF134BK99BxpWBJBQjm6uH4TKgk3pYR6Uy05BDrEvRBqguqfRpH7llt4OoTgBQMTK33aiIsNeCjpObrW2Sn7U5wofS26R2xyG/44RawKlK7YWfsFTc1fdw51WmqaYktr60Xqufq4f5BeZwbmIDJMZtWNfInCG4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607701693; 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; bh=5AhflgcYQu+9DEDf6zs09rHMAGztyaqr6nmsj/zWToM=; b=DIlNjnGuLVVKewMD6glM2O+c0c8H9o6aPmGETcNC6xBK2WNM9BwyRzFjLBhfDjkig+1zrtNy8aeGetHSQXQw1buPMUrkVlsn2gU9rTIXV/j6ydjstDzPQYBlkobDqT7DV45YZA7giafSNY18hNe5cxnXZeq8V+xIQv6ml1rKQvY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1607701693701275.798854824773; Fri, 11 Dec 2020 07:48:13 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-505-FOBK2Kj4N-iTIf1c2p7_gQ-1; Fri, 11 Dec 2020 10:48:10 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 94341802B67; Fri, 11 Dec 2020 15:48:03 +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 6D0EF5FC1D; Fri, 11 Dec 2020 15:48:03 +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 38E154EE0B; Fri, 11 Dec 2020 15:48:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BBFlWQj013808 for ; Fri, 11 Dec 2020 10:47:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5CD2B60C04; Fri, 11 Dec 2020 15:47:32 +0000 (UTC) Received: from vhost2.laine.org (ovpn-113-158.phx2.redhat.com [10.3.113.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id 26B8860BF1 for ; Fri, 11 Dec 2020 15:47:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607701692; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=5AhflgcYQu+9DEDf6zs09rHMAGztyaqr6nmsj/zWToM=; b=PT/NjDIsSlqWVoqoNrjnACfjNVvnQjD7P29ccIMt8GTbuFlo1PAJf6+HXdCKD2mwV/+euy X+7lPAQmb6dMXRN9RLIHH0B8JN6Rs0hyuempsMWwUqXWgvNVtOBEGx58fQ6Nx9hlQAP25Y Es5qMDwLO1Wc3VW1vTLliGCOBZVl4zM= X-MC-Unique: FOBK2Kj4N-iTIf1c2p7_gQ-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v2 4/7] util: make read error of PCI config file more detailed Date: Fri, 11 Dec 2020 10:47:25 -0500 Message-Id: <20201211154728.1117948-5-laine@redhat.com> In-Reply-To: <20201211154728.1117948-1-laine@redhat.com> References: <20201211154728.1117948-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The new message is more verbose/useful, but only logged at debug level instead of as a warning (since it could easily happen in a non-error situation). Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/util/virpci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/virpci.c b/src/util/virpci.c index 31622cddfa..9109fb4f3a 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -332,8 +332,8 @@ virPCIDeviceRead(virPCIDevicePtr dev, =20 if (lseek(cfgfd, pos, SEEK_SET) !=3D pos || saferead(cfgfd, buf, buflen) !=3D buflen) { - VIR_WARN("Failed to read from '%s' : %s", dev->path, - g_strerror(errno)); + VIR_DEBUG("Failed to read %u bytes at %u from '%s' : %s", + buflen, pos, dev->path, g_strerror(errno)); return -1; } return 0; --=20 2.28.0 From nobody Wed May 15 17:01:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1607701693; cv=none; d=zohomail.com; s=zohoarc; b=ORyTtmd8CZ59H87H3BB1qpTIR3340exuM9TdHnu9/KcaD4c8PFOmZ17TsuP59ujJ3iHAWG9nEgM1Ghtv9Dz6CLUv3x2ZpxXQLoSadlCAXZ6jPUGZ872qetFNDn5bmGw3DZD6NHRTrsAmKvdUbqAThUCr4F5Ig/VIn93trJu4qsM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607701693; 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; bh=CygRurP9poMlRmosca0bKZdeY7t3YjaN7LAbmcqI38c=; b=RycBDbFujTsu0PEyt1yOy0BkzGT0UogpbEsK2lTtbO5cGkdVgokASC3r10YCUH7xKAfDpBnaoxQ0UuAlUO15ihVIt+/jLbMZKaziG73bTVJfKOPyTo094WELJ4poAhFWPeyvg4cEJfbvMldKicnWI9LJh5Ia2LHev2reD7mcbws= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1607701693634986.2865713224444; Fri, 11 Dec 2020 07:48:13 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-350-4WVH4ckhPVCHVZo5Fk7QRQ-1; Fri, 11 Dec 2020 10:48:09 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id BD8A1879510; Fri, 11 Dec 2020 15:48:03 +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 72C9410023B9; Fri, 11 Dec 2020 15:48:03 +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 349A24EDB6; Fri, 11 Dec 2020 15:48:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BBFlW53013813 for ; Fri, 11 Dec 2020 10:47:32 -0500 Received: by smtp.corp.redhat.com (Postfix) id B6FBE60BFA; Fri, 11 Dec 2020 15:47:32 +0000 (UTC) Received: from vhost2.laine.org (ovpn-113-158.phx2.redhat.com [10.3.113.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8003860BF1 for ; Fri, 11 Dec 2020 15:47:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607701692; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=CygRurP9poMlRmosca0bKZdeY7t3YjaN7LAbmcqI38c=; b=KcZ81PxjQxgjNKwenhdATjMuRY+udhW7vyXcHaIpPLV8HSmuGit9TL/AgxuzQVkCQ/QFmV Fq/25UQzPRsjIMKWsK79Et0ClR6cBvyHSIfEdZFS6/EWI/+KEU3c0nAuYOjNf3hUYBVVI2 hv9iHzbWgpytqLoUwu+ZF5sVSFYUMSo= X-MC-Unique: 4WVH4ckhPVCHVZo5Fk7QRQ-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v2 5/7] util: change call sequence for virPCIDeviceFindCapabilityOffset() Date: Fri, 11 Dec 2020 10:47:26 -0500 Message-Id: <20201211154728.1117948-6-laine@redhat.com> In-Reply-To: <20201211154728.1117948-1-laine@redhat.com> References: <20201211154728.1117948-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Previously there was no way to differentiate between this function 1) encountering an error while reading the pci config, and 2) determining that the device in question is a conventional PCI device, and so has no Express Capabilities. The difference between these two conditions is important, because an unprivileged libvirtd will be unable to read all of the pci config (it can only read the first 64 bytes, and will get ENOENT when it tries to seek past that limit) even though the device is in fact a PCIe device. This patch changes virPCIDeviceFindCapabilityOffset() to put the determined offset into an argument of the function (rather than sending it back as the return value), and to return the standard "0 on success, -1 on failure". Failure is determined by checking the value of errno after each attemptd read of the config file (which can only work reliably if errno is reset to 0 before each read, and after virPCIDeviceFindCapabilityOffset() has finished examining it). (NB: if the config file is read successfully, but no Express Capabilities are found, then the function returns success, but the returned offset will be 0 (which is an impossible offset for Express Capabilities, and so easily recognizeable). An upcoming patch will take advantage of the change made here. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/util/virpci.c | 77 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 11 deletions(-) diff --git a/src/util/virpci.c b/src/util/virpci.c index 9109fb4f3a..5ec559dec0 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -329,6 +329,7 @@ virPCIDeviceRead(virPCIDevicePtr dev, unsigned int buflen) { memset(buf, 0, buflen); + errno =3D 0; =20 if (lseek(cfgfd, pos, SEEK_SET) !=3D pos || saferead(cfgfd, buf, buflen) !=3D buflen) { @@ -339,6 +340,27 @@ virPCIDeviceRead(virPCIDevicePtr dev, return 0; } =20 + +/** + * virPCIDeviceReadN: + * @dev: virPCIDevice object (used only to log name of config file) + * @cfgfd: open file descriptor for device config file in sysfs + * @pos: byte offset in the file to read from + * + * read "N" (where "N" is "8", "16", or "32", and appears at the end + * of the function name) bytes from a PCI device's already-opened + * sysfs config file and return them as the return value from the + * function. + * + * Returns the value at @pos in the file, or 0 if there was an + * error. NB: since 0 could be a valid value, occurence of an error + * must be determined by examining errno. errno is always reset to 0 + * before the seek/read is attempted (see virPCIDeviceRead()), so if + * errno !=3D 0 on return from one of these functions, then either the + * seek or the read operation failed for some reason. If errno =3D=3D 0 + * and the return value is 0, then the config file really does contain + * the value 0 at @pos. + */ static uint8_t virPCIDeviceRead8(virPCIDevicePtr dev, int cfgfd, unsigned int pos) { @@ -483,19 +505,38 @@ virPCIDeviceIterDevices(virPCIDeviceIterPredicate pre= dicate, return ret; } =20 -static uint8_t + +/** + * virPCIDeviceFindCapabilityOffset: + * @dev: virPCIDevice object (used only to log name of config file) + * @cfgfd: open file descriptor for device config file in sysfs + * @capability: PCI_CAP_ID_* being requested + * @offset: used to return the offset of @capability in the file + * + * Find the offset of @capability within the PCI config file @cfgfd of + * the device @dev. if found, the offset is returned in @offset, + * otherwise @offset is set to 0. + * + * Returns 0 on success, -1 on failure. + */ +static int virPCIDeviceFindCapabilityOffset(virPCIDevicePtr dev, int cfgfd, - unsigned int capability) + unsigned int capability, + unsigned int *offset) { uint16_t status; uint8_t pos; =20 + *offset =3D 0; /* assume failure (*nothing* can be at offset 0) */ + status =3D virPCIDeviceRead16(dev, cfgfd, PCI_STATUS); - if (!(status & PCI_STATUS_CAP_LIST)) - return 0; + if (errno !=3D 0 || !(status & PCI_STATUS_CAP_LIST)) + goto error; =20 pos =3D virPCIDeviceRead8(dev, cfgfd, PCI_CAPABILITY_LIST); + if (errno !=3D 0) + goto error; =20 /* Zero indicates last capability, capabilities can't * be in the config space header and 0xff is returned @@ -506,18 +547,31 @@ virPCIDeviceFindCapabilityOffset(virPCIDevicePtr dev, */ while (pos >=3D PCI_CONF_HEADER_LEN && pos !=3D 0xff) { uint8_t capid =3D virPCIDeviceRead8(dev, cfgfd, pos); + if (errno !=3D 0) + goto error; + if (capid =3D=3D capability) { VIR_DEBUG("%s %s: found cap 0x%.2x at 0x%.2x", dev->id, dev->name, capability, pos); - return pos; + *offset =3D pos; + return 0; } =20 pos =3D virPCIDeviceRead8(dev, cfgfd, pos + 1); + if (errno !=3D 0) + goto error; } =20 - VIR_DEBUG("%s %s: failed to find cap 0x%.2x", dev->id, dev->name, capa= bility); + error: + VIR_DEBUG("%s %s: failed to find cap 0x%.2x (%s)", + dev->id, dev->name, capability, g_strerror(errno)); + + /* reset errno in case the failure was due to insufficient + * privileges to read the entire PCI config file + */ + errno =3D 0; =20 - return 0; + return -1; } =20 static unsigned int @@ -553,7 +607,7 @@ static bool virPCIDeviceDetectFunctionLevelReset(virPCIDevicePtr dev, int cfgfd) { uint32_t caps; - uint8_t pos; + unsigned int pos; g_autofree char *path =3D NULL; int found; =20 @@ -575,7 +629,8 @@ virPCIDeviceDetectFunctionLevelReset(virPCIDevicePtr de= v, int cfgfd) * the same thing, except for conventional PCI * devices. This is not common yet. */ - pos =3D virPCIDeviceFindCapabilityOffset(dev, cfgfd, PCI_CAP_ID_AF); + virPCIDeviceFindCapabilityOffset(dev, cfgfd, PCI_CAP_ID_AF, &pos); + if (pos) { caps =3D virPCIDeviceRead16(dev, cfgfd, pos + PCI_AF_CAP); if (caps & PCI_AF_CAP_FLR) { @@ -885,8 +940,8 @@ virPCIDeviceTryPowerManagementReset(virPCIDevicePtr dev= , int cfgfd) static int virPCIDeviceInit(virPCIDevicePtr dev, int cfgfd) { - dev->pcie_cap_pos =3D virPCIDeviceFindCapabilityOffset(dev, cfgfd, P= CI_CAP_ID_EXP); - dev->pci_pm_cap_pos =3D virPCIDeviceFindCapabilityOffset(dev, cfgfd, P= CI_CAP_ID_PM); + virPCIDeviceFindCapabilityOffset(dev, cfgfd, PCI_CAP_ID_EXP, &dev->pci= e_cap_pos); + virPCIDeviceFindCapabilityOffset(dev, cfgfd, PCI_CAP_ID_PM, &dev->pci_= pm_cap_pos); dev->has_flr =3D virPCIDeviceDetectFunctionLevelReset(dev, cfgfd); dev->has_pm_reset =3D virPCIDeviceDetectPowerManagementReset(dev, cfgf= d); =20 --=20 2.28.0 From nobody Wed May 15 17:01:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1607701745; cv=none; d=zohomail.com; s=zohoarc; b=DuX/ADVvNBeLXYtKG0pnYRHAKJw9PPMbuDephJVC7IsYpCpwyA28N5K2mNWr+3bwQ3j4XdA6p9I3I9B/MZhO3LI3gq6BZxCDdD2HzGcwXrYcFsSLblyHOgBBUiUN3CLIdL3rTMmVrZqPkfOFD+/zbRZvDVR/VhJMr/BzkONgGY0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607701745; 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; bh=7yawQT6NIyoUnyxYPPCycTFeNxxzuAkrswIkbDsTZR0=; b=X/LSZyNBXm0sOFYT9/8gefby+i15l1OLko1qWYWcmdtEPnm7dA6hBTuy7VkT2kfJDM8O5vRMzCuf8R2X/gq/EHhYiE02n4wRnH0elDOz6ylCYpY+HiBEmTZJGV4lzJkCQWoOLVFQdt3NcFN2kBj6aBAbRuT/65AEjKmUVR2J3tA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1607701745615654.0400459035103; Fri, 11 Dec 2020 07:49:05 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-107-SnHabMDtNXWfJ7e31U0Eew-1; Fri, 11 Dec 2020 10:48:16 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id A544310766BB; Fri, 11 Dec 2020 15:48:06 +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 8042E60BE5; Fri, 11 Dec 2020 15:48:06 +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 48D6B1809CA4; Fri, 11 Dec 2020 15:48:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BBFlX91013820 for ; Fri, 11 Dec 2020 10:47:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1B3D260BFA; Fri, 11 Dec 2020 15:47:33 +0000 (UTC) Received: from vhost2.laine.org (ovpn-113-158.phx2.redhat.com [10.3.113.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id D94DF60BF1 for ; Fri, 11 Dec 2020 15:47:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607701743; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=7yawQT6NIyoUnyxYPPCycTFeNxxzuAkrswIkbDsTZR0=; b=ZyB3wPJelf3l49SAQmHAmuFiqZvL3TkhV60aI26/rc6TaAoMVrrG+thv8TJyaNRkH9FkOV MnBDaGTmHQva7QTFX+Gt2jjx8Pi/cSpqcaATsDsxe+3ZvJZnyokc/MvZUb8KvjCidNatbR LePrPm9bCuTe5BQo4+n1Rd32XbAhJCA= X-MC-Unique: SnHabMDtNXWfJ7e31U0Eew-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v2 6/7] util: make virPCIDeviceIsPCIExpress() more intelligent Date: Fri, 11 Dec 2020 10:47:27 -0500 Message-Id: <20201211154728.1117948-7-laine@redhat.com> In-Reply-To: <20201211154728.1117948-1-laine@redhat.com> References: <20201211154728.1117948-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Until now there has been an extra bit of code in qemuDomainDeviceCalculatePCIConnectFlag() (one of the two callers of virPCIDeviceIsPCIExpress()) that tries to determine if a device is PCIe by looking at the *length* of its sysfs config file; it only does this when libvirt is running as a non-root process. This patch takes advantage of our newfound ability to tell the difference between "I read a 0 from the device PCI config file" and "I couldn't read the PCI Express Capabilities because I don't have sufficient permission" to put the file length check down in virPCIDeviceIsPCIExpress(), and do that check any time we fail while reading the config file (not only when the process is non-root). Fixes: https://bugzilla.redhat.com/1901685 Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/util/virpci.c | 66 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/src/util/virpci.c b/src/util/virpci.c index 5ec559dec0..9bfc743fbd 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -73,10 +73,18 @@ struct _virPCIDevice { char *used_by_drvname; char *used_by_domname; =20 + /* The following 5 items are only valid after virPCIDeviceInit() + * has been called for the virPCIDevice object. This is *not* done + * in most cases (because it creates extra overhead, and parts of + * it can fail if libvirtd is running unprivileged) + */ unsigned int pcie_cap_pos; unsigned int pci_pm_cap_pos; bool has_flr; bool has_pm_reset; + bool is_pcie; + /**/ + bool managed; =20 virPCIStubDriver stubDriver; @@ -629,7 +637,8 @@ virPCIDeviceDetectFunctionLevelReset(virPCIDevicePtr de= v, int cfgfd) * the same thing, except for conventional PCI * devices. This is not common yet. */ - virPCIDeviceFindCapabilityOffset(dev, cfgfd, PCI_CAP_ID_AF, &pos); + if (virPCIDeviceFindCapabilityOffset(dev, cfgfd, PCI_CAP_ID_AF, &pos) = < 0) + goto error; =20 if (pos) { caps =3D virPCIDeviceRead16(dev, cfgfd, pos + PCI_AF_CAP); @@ -654,8 +663,8 @@ virPCIDeviceDetectFunctionLevelReset(virPCIDevicePtr de= v, int cfgfd) return true; } =20 + error: VIR_DEBUG("%s %s: no FLR capability found", dev->id, dev->name); - return false; } =20 @@ -937,10 +946,59 @@ virPCIDeviceTryPowerManagementReset(virPCIDevicePtr d= ev, int cfgfd) return 0; } =20 +/** + * virPCIDeviceInit: + * @dev: virPCIDevice object needing its PCI capabilities info initialized + * @cfgfd: open file descriptor for device config file in sysfs + * + * Initialize the PCI capabilities attributes of a virPCIDevice object + * (i.e. pcie_cap_pos, pci_pm_cap_pos, has_flr, has_pm_reset, and + * is_pcie). This is done by walking the info in the (already-opened) + * device PCI config file in sysfs. This function can be called + * regardless of whether a process has sufficient privilege to read + * the entire file (unprivileged processes can only read the 1st 64 + * bytes, while the Express Capabilities are all located beyond that + * boundary). + * + * In the case that we are unable to read a capability + * directly, we will attempt to infer its value by other means. In + * particular, we can determine that a device is (almost surely) PCIe + * by checking that the length of the config file is !=3D 256 (since all + * conventional PCI config files are 256 bytes), and we know that any + * device that is an SR-IOV VF will have FLR available (since that is + * required by the SR-IOV spec.) + * + * Always returns success (0) (for now) + */ static int virPCIDeviceInit(virPCIDevicePtr dev, int cfgfd) { - virPCIDeviceFindCapabilityOffset(dev, cfgfd, PCI_CAP_ID_EXP, &dev->pci= e_cap_pos); + dev->is_pcie =3D false; + if (virPCIDeviceFindCapabilityOffset(dev, cfgfd, PCI_CAP_ID_EXP, &dev-= >pcie_cap_pos) < 0) { + /* an unprivileged process is unable to read *all* of a + * device's PCI config (it can only read the first 64 + * bytes, which isn't enough for see the Express + * Capabilities data). If virPCIDeviceFindCapabilityOffset + * returns failure (and not just a pcie_cap_pos =3D=3D 0, + * which is *success* at determining the device is *not* + * PCIe) we make an educated guess based on the length of + * the device's config file - if it is 256 bytes, then it + * is definitely a legacy PCI device. If it's larger than + * that, then it is *probably PCIe (although it could be + * PCI-x, but those are extremely rare). If the config + * file can't be found (in which case the "length" will be + * -1), then we blindly assume the most likely outcome - + * PCIe. + */ + off_t configLen =3D virFileLength(virPCIDeviceGetConfigPath(dev), = -1); + + if (configLen !=3D 256) + dev->is_pcie =3D true; + + } else { + dev->is_pcie =3D (dev->pcie_cap_pos !=3D 0); + } + virPCIDeviceFindCapabilityOffset(dev, cfgfd, PCI_CAP_ID_PM, &dev->pci_= pm_cap_pos); dev->has_flr =3D virPCIDeviceDetectFunctionLevelReset(dev, cfgfd); dev->has_pm_reset =3D virPCIDeviceDetectPowerManagementReset(dev, cfgf= d); @@ -2644,7 +2702,7 @@ virPCIDeviceIsPCIExpress(virPCIDevicePtr dev) if (virPCIDeviceInit(dev, fd) < 0) goto cleanup; =20 - ret =3D dev->pcie_cap_pos !=3D 0; + ret =3D dev->is_pcie; =20 cleanup: virPCIDeviceConfigClose(dev, fd); --=20 2.28.0 From nobody Wed May 15 17:01:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1607701701; cv=none; d=zohomail.com; s=zohoarc; b=lUHAJ2jx/0LjOD4z5Kn2lzs0TeaZHOSH5QigDrQtXpFT6MIncZ0ybkxnzr1orFNpM3MnyP2UvhkvZB70vQzBxPCNfOK5YgalbX9X5tIydhLvjrZO2v7zjvIxA0nttY/3tORJEUIAK9vtW++JEejVTo1/XN0obWfFkJgEJHrPw/s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607701701; 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; bh=25k4T6nu3ioI0AUbPYdOdw9bJMIoOJviis5Rfiv0TiU=; b=O9DkPkTiqIpB3e95I76c2iA73+3iLFLorRNbimA/dJCjp0Y/iyKK4kS0aZl7UbqA4rSICZoI6+GTb9KRd7oT/6K7U7Tk0V4y7ao8k9DM4oeSldBUwf11kPnzoifZcbTOQmzWQuQFnzX/ZQQ+2vPoNXVqfiB2ARCFLS0qrmM3HJw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1607701701591267.02252589692955; Fri, 11 Dec 2020 07:48:21 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-531-nGLsW9LLMCOOm4HKZJytzA-1; Fri, 11 Dec 2020 10:48:18 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9D93ADF8A9; Fri, 11 Dec 2020 15:48:06 +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 7C3976F99C; Fri, 11 Dec 2020 15:48:06 +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 0F4F71809CA3; Fri, 11 Dec 2020 15:48:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BBFlXO4013825 for ; Fri, 11 Dec 2020 10:47:33 -0500 Received: by smtp.corp.redhat.com (Postfix) id 7574760BFA; Fri, 11 Dec 2020 15:47:33 +0000 (UTC) Received: from vhost2.laine.org (ovpn-113-158.phx2.redhat.com [10.3.113.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D7C260BF1 for ; Fri, 11 Dec 2020 15:47:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607701700; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=25k4T6nu3ioI0AUbPYdOdw9bJMIoOJviis5Rfiv0TiU=; b=UmxpaUppylFjMc0OOqPWpilipGAUfsGjpwWa7o+7yCzTtpA+E9k7iLCklvzGRnr35+lmnA tUX4Roc41hl79PS/CnjhkSeNw6uIieLHfaZ8FnjftohIz8zKkepfKMgum5a3xcy1j6Zsqp YvSt66Ae8GwHAkKpbNxJ10nkmV2nOjM= X-MC-Unique: nGLsW9LLMCOOm4HKZJytzA-1 From: Laine Stump To: libvir-list@redhat.com Subject: [libvirt PATCH v2 7/7] qemu: remove now-redundant check for file length when determining PCIe vs. PCI Date: Fri, 11 Dec 2020 10:47:28 -0500 Message-Id: <20201211154728.1117948-8-laine@redhat.com> In-Reply-To: <20201211154728.1117948-1-laine@redhat.com> References: <20201211154728.1117948-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Now that virPCIDeviceIsPCIExpress() checks the length of the file when the process lacks sufficient privilege to read the entire PCI config file in sysfs, we can remove the open-coding for that case from its consumer. Signed-off-by: Laine Stump Reviewed-by: Michal Privoznik --- src/qemu/qemu_domain_address.c | 38 +++------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index b07672e2f4..f0ba318cc8 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -579,7 +579,6 @@ qemuDomainDeviceCalculatePCIAddressExtensionFlags(virQE= MUCapsPtr qemuCaps, */ static virDomainPCIConnectFlags qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev, - virQEMUDriverPtr driver, virDomainPCIConnectFlags pcieFlag= s, virDomainPCIConnectFlags virtioFl= ags) { @@ -802,7 +801,6 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevic= eDefPtr dev, =20 case VIR_DOMAIN_DEVICE_HOSTDEV: { virDomainHostdevDefPtr hostdev =3D dev->data.hostdev; - bool isExpress =3D false; g_autoptr(virPCIDevice) pciDev =3D NULL; virPCIDeviceAddressPtr hostAddr =3D &hostdev->source.subsys.u.pci.= addr; =20 @@ -873,37 +871,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevi= ceDefPtr dev, return pcieFlags; } =20 - if (!driver->privileged) { - /* unprivileged libvirtd is unable to read *all* of a - * device's PCI config (it can only read the first 64 - * bytes, which isn't enough for the check that's done - * in virPCIDeviceIsPCIExpress()), so instead of - * trying and failing, we make an educated guess based - * on the length of the device's config file - if it - * is 256 bytes, then it is definitely a legacy PCI - * device. If it's larger than that, then it is - * *probably PCIe (although it could be PCI-x, but - * those are extremely rare). If the config file can't - * be found (in which case the "length" will be -1), - * then we blindly assume the most likely outcome - - * PCIe. - */ - off_t configLen - =3D virFileLength(virPCIDeviceGetConfigPath(pciDev), -1); - - if (configLen =3D=3D 256) - return pciFlags; - - return pcieFlags; - } - - /* If we are running with privileges, we can examine the - * PCI config contents with virPCIDeviceIsPCIExpress() for - * a definitive answer. - */ - isExpress =3D virPCIDeviceIsPCIExpress(pciDev); - - if (isExpress) + if (virPCIDeviceIsPCIExpress(pciDev)) return pcieFlags; =20 return pciFlags; @@ -1124,7 +1092,7 @@ qemuDomainFillDevicePCIConnectFlagsIter(virDomainDefP= tr def G_GNUC_UNUSED, qemuDomainFillDevicePCIConnectFlagsIterData *data =3D opaque; =20 info->pciConnectFlags - =3D qemuDomainDeviceCalculatePCIConnectFlags(dev, data->driver, + =3D qemuDomainDeviceCalculatePCIConnectFlags(dev, data->pcieFlags, data->virtioFlags); return 0; @@ -1468,7 +1436,7 @@ qemuDomainFillDevicePCIConnectFlags(virDomainDefPtr d= ef, qemuDomainFillDevicePCIConnectFlagsIterInit(def, qemuCaps, driver,= &data); =20 info->pciConnectFlags - =3D qemuDomainDeviceCalculatePCIConnectFlags(dev, data.driver, + =3D qemuDomainDeviceCalculatePCIConnectFlags(dev, data.pcieFlags, data.virtioFlags); } --=20 2.28.0