From nobody Fri Apr 19 16:08:06 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28
as permitted sender) client-ip=209.132.183.28;
envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com;
Authentication-Results: mx.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1562860472; cv=none;
d=zoho.com; s=zohoarc;
b=AYb2dz2LXe8c5DhL0AcFUmGmGskVrlthn0UsIGJlefmkdMpqYugR433pp+j5TP732iJihLGaKsfRrBmfdJ97GzU6vOmZbiTkhe0jkW9tpjraIErsIunEXH0M3MY5VXjeljGcoD11TI7vLLB6FCZPhuEtrCBmYe3sZFzqk4g7Tfg=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1562860472;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=9K4po4DlLixFvQ0fX16v7hMWhYDjBcvGk4JOqHTIqy8=;
b=nglNx7da0s4ntOfvWIvy1niDij+Rc3Y3ZPf2v3u7VAx/aBQ4tBWns496FHsaSL45/RCSnEtm6iTZPCKhVRKrTNdbmDi6sqZGKOhS7D3fIZWrceoEYb0tOhUPgH7Oq5+VyF+CBF2D8G7ba9TCc36O4tNgcoc7EDcTrs+07aLBUjI=
ARC-Authentication-Results: i=1; mx.zoho.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1562860472586845.3569230921016;
Thu, 11 Jul 2019 08:54:32 -0700 (PDT)
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 mx1.redhat.com (Postfix) with ESMTPS id BB0EA30C5847;
Thu, 11 Jul 2019 15:54:30 +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 A668660A97;
Thu, 11 Jul 2019 15:54:29 +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 CEC3018184AC;
Thu, 11 Jul 2019 15:54:27 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x6BFsPPW014606 for ;
Thu, 11 Jul 2019 11:54:25 -0400
Received: by smtp.corp.redhat.com (Postfix)
id CD6465D9DC; Thu, 11 Jul 2019 15:54:25 +0000 (UTC)
Received: from moe.brq.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id 590D35D9CC
for ; Thu, 11 Jul 2019 15:54:25 +0000 (UTC)
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Thu, 11 Jul 2019 17:53:48 +0200
Message-Id:
<6f19a3aaf0ca65bf75f4b50a5f5d0a3cc71d8752.1562859733.git.mprivozn@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v1 01/31] virHostdevPreparePCIDevices: Separate
out function body
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]);
Thu, 11 Jul 2019 15:54:31 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
In near future we will have a list of PCI devices we want to
detach (held in virPCIDeviceListPtr) but we don't have
virDomainHostdevDefPtr. That's okay because
virHostdevPreparePCIDevices() works with virPCIDeviceListPtr
mostly anyway. And in very few places where it needs
virDomainHostdevDefPtr are not interesting for our case.
Signed-off-by: Michal Privoznik
---
src/util/virhostdev.c | 48 ++++++++++++++++++++++++++++---------------
1 file changed, 32 insertions(+), 16 deletions(-)
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index a3647a6cf4..88b0828675 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -613,27 +613,22 @@ virHostdevRestoreNetConfig(virDomainHostdevDefPtr hos=
tdev,
}
}
=20
-int
-virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
- const char *drv_name,
- const char *dom_name,
- const unsigned char *uuid,
- virDomainHostdevDefPtr *hostdevs,
- int nhostdevs,
- unsigned int flags)
+
+static int
+virHostdevPreparePCIDevicesImpl(virHostdevManagerPtr mgr,
+ const char *drv_name,
+ const char *dom_name,
+ const unsigned char *uuid,
+ virPCIDeviceListPtr pcidevs,
+ virDomainHostdevDefPtr *hostdevs,
+ int nhostdevs,
+ unsigned int flags)
{
- VIR_AUTOUNREF(virPCIDeviceListPtr) pcidevs =3D NULL;
int last_processed_hostdev_vf =3D -1;
size_t i;
int ret =3D -1;
virPCIDeviceAddressPtr devAddr =3D NULL;
=20
- if (!nhostdevs)
- return 0;
-
- if (!(pcidevs =3D virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs)))
- return -1;
-
virObjectLock(mgr->activePCIHostdevs);
virObjectLock(mgr->inactivePCIHostdevs);
=20
@@ -906,10 +901,31 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
cleanup:
virObjectUnlock(mgr->activePCIHostdevs);
virObjectUnlock(mgr->inactivePCIHostdevs);
-
return ret;
}
=20
+
+int
+virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
+ const char *drv_name,
+ const char *dom_name,
+ const unsigned char *uuid,
+ virDomainHostdevDefPtr *hostdevs,
+ int nhostdevs,
+ unsigned int flags)
+{
+ VIR_AUTOUNREF(virPCIDeviceListPtr) pcidevs =3D NULL;
+
+ if (!nhostdevs)
+ return 0;
+
+ if (!(pcidevs =3D virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs)))
+ return -1;
+
+ return virHostdevPreparePCIDevicesImpl(mgr, drv_name, dom_name, uuid,
+ pcidevs, hostdevs, nhostdevs, f=
lags);
+}
+
/*
* Pre-condition: inactivePCIHostdevs & activePCIHostdevs
* are locked
--=20
2.21.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 16:08:06 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28
as permitted sender) client-ip=209.132.183.28;
envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com;
Authentication-Results: mx.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1562860472; cv=none;
d=zoho.com; s=zohoarc;
b=KHcQozsyTDavaWZ/uNKlEB+KxPlcBs260MeR2wyFq0gXo0S1lKqDeA14KpvLO6jBnx4efAY/+T89/7ZkP4AVCit6xH6rQ29iA8xFmYWc6TBc6FEN+TfwtC3G9AZuThcTEp7qBDpqCdkOH4tGSmQHSpyfgyJgfQyNWsU1cPmBlWY=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1562860472;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=r/6jwVm6/Nc4HbjNgeJTE74r00+iIASaX1uzEJX/iHo=;
b=KA0gcm4+/n8wjyyJKmMGdVwE9iHPn5bokzmUxwB5SLlsqzTZas38jDnCrurz0POGvRlxT0kL71XLnFUM8qHzLTIzHTY0XX/bqeWYQXRa4nFCz9TqMAvgXBEE3DOcH2csWMr6pSDcpj/vcVwSuc+F6xFpE3N+c1lUlQPvpdexYTc=
ARC-Authentication-Results: i=1; mx.zoho.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1562860472847163.24057345312553;
Thu, 11 Jul 2019 08:54:32 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com
[10.5.11.23])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id BA57187628;
Thu, 11 Jul 2019 15:54:30 +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 A5A1019C69;
Thu, 11 Jul 2019 15:54:29 +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 115A43D3F3;
Thu, 11 Jul 2019 15:54:27 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x6BFsQKU014614 for ;
Thu, 11 Jul 2019 11:54:26 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 97D725D9DC; Thu, 11 Jul 2019 15:54:26 +0000 (UTC)
Received: from moe.brq.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id 23E565D9CC
for ; Thu, 11 Jul 2019 15:54:25 +0000 (UTC)
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Thu, 11 Jul 2019 17:53:49 +0200
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v1 02/31] virHostdevReAttachPCIDevices: Separate
out function body
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]);
Thu, 11 Jul 2019 15:54:31 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
In near future we will have a list of PCI devices we want to
re-attach to the host (held in virPCIDeviceListPtr) but we don't
have virDomainHostdevDefPtr. That's okay because
virHostdevReAttachPCIDevices() works with virPCIDeviceListPtr
mostly anyway. And in very few places where it needs
virDomainHostdevDefPtr are not interesting for our case.
Signed-off-by: Michal Privoznik
---
src/util/virhostdev.c | 58 +++++++++++++++++++++++++++----------------
1 file changed, 37 insertions(+), 21 deletions(-)
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 88b0828675..07397b9682 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -953,30 +953,18 @@ virHostdevReattachPCIDevice(virHostdevManagerPtr mgr,
}
}
=20
-/* @oldStateDir:
- * For upgrade purpose: see virHostdevRestoreNetConfig
- */
-void
-virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr,
- const char *drv_name,
- const char *dom_name,
- virDomainHostdevDefPtr *hostdevs,
- int nhostdevs,
- const char *oldStateDir)
+
+static void
+virHostdevReAttachPCIDevicesImpl(virHostdevManagerPtr mgr,
+ const char *drv_name,
+ const char *dom_name,
+ virPCIDeviceListPtr pcidevs,
+ virDomainHostdevDefPtr *hostdevs,
+ int nhostdevs,
+ const char *oldStateDir)
{
- VIR_AUTOUNREF(virPCIDeviceListPtr) pcidevs =3D NULL;
size_t i;
=20
- if (!nhostdevs)
- return;
-
- if (!(pcidevs =3D virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs))=
) {
- VIR_ERROR(_("Failed to allocate PCI device list: %s"),
- virGetLastErrorMessage());
- virResetLastError();
- return;
- }
-
virObjectLock(mgr->activePCIHostdevs);
virObjectLock(mgr->inactivePCIHostdevs);
=20
@@ -1100,6 +1088,34 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr mg=
r,
virObjectUnref(pcidevs);
}
=20
+
+/* @oldStateDir:
+ * For upgrade purpose: see virHostdevRestoreNetConfig
+ */
+void
+virHostdevReAttachPCIDevices(virHostdevManagerPtr mgr,
+ const char *drv_name,
+ const char *dom_name,
+ virDomainHostdevDefPtr *hostdevs,
+ int nhostdevs,
+ const char *oldStateDir)
+{
+ VIR_AUTOUNREF(virPCIDeviceListPtr) pcidevs =3D NULL;
+
+ if (!nhostdevs)
+ return;
+
+ if (!(pcidevs =3D virHostdevGetPCIHostDeviceList(hostdevs, nhostdevs))=
) {
+ VIR_ERROR(_("Failed to allocate PCI device list: %s"),
+ virGetLastErrorMessage());
+ virResetLastError();
+ return;
+ }
+
+ virHostdevReAttachPCIDevicesImpl(mgr, drv_name, dom_name, pcidevs,
+ hostdevs, nhostdevs, oldStateDir);
+}
+
int
virHostdevUpdateActivePCIDevices(virHostdevManagerPtr mgr,
virDomainHostdevDefPtr *hostdevs,
--=20
2.21.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 16:08:06 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28
as permitted sender) client-ip=209.132.183.28;
envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com;
Authentication-Results: mx.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1562860486; cv=none;
d=zoho.com; s=zohoarc;
b=LeBYj5Yuu6H1/yPhtrbGdDQvuSJdITHZXV/SIIw8WMp0CySAN2FIi7vStXx5SdWf7ECcmWHofXS2ailkgV5mb8mOw8ySZQU4v9/6EnLBMxK0IeEB45N4DqBB4lrBMcrJMO6HOXXvMWxNNsX1pZ9WuMpXahomsBT6pPL6bkgNoak=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1562860486;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=b3wqAyf70WZO+DQB1Pr5Vd6MBNzT52E7HPaQMI/PIfU=;
b=ROuzyn/NMm8AQou8bqjX2kTamoCM9+Xy6KcXxkJ3DLcTgbXYDmsQihJSeTs8qxt+Q/E5aB090jqnyGwVzjFT1FthiXesuMy9936Jtk4JeFU0Hvon4Y3twW6fLjJF72H8RqDt9bgpKqyytF+VyXRoT+1wMOCeYY2PlDD+MZ+xGY0=
ARC-Authentication-Results: i=1; mx.zoho.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 15628604864941015.1595370691829;
Thu, 11 Jul 2019 08:54:46 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 8BC8DC057F4B;
Thu, 11 Jul 2019 15:54:44 +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 192BE5D9CC;
Thu, 11 Jul 2019 15:54:44 +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 D07EE1801215;
Thu, 11 Jul 2019 15:54:43 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x6BFsR4W014622 for ;
Thu, 11 Jul 2019 11:54:27 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 62FB85D9DC; Thu, 11 Jul 2019 15:54:27 +0000 (UTC)
Received: from moe.brq.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id E2D135D9CC
for ; Thu, 11 Jul 2019 15:54:26 +0000 (UTC)
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Thu, 11 Jul 2019 17:53:50 +0200
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v1 03/31] virpcimock: Move actions checking one
level up
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]);
Thu, 11 Jul 2019 15:54:45 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
The pci_driver_bind() and pci_driver_unbind() functions are
"internal implementation", meaning other parts of the code should
be able to call them and get the job done. Checking for actions
(PCI_ACTION_BIND and PCI_ACTION_UNBIND) should be done in
handlers (pci_driver_handle_bind() and
pci_driver_handle_unbind()). Surprisingly, the other two actions
(PCI_ACTION_NEW_ID and PCI_ACTION_REMOVE_ID) are checked already
at this level.
Signed-off-by: Michal Privoznik
---
tests/virpcimock.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index beb5e1490d..6865f992dc 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -551,8 +551,8 @@ pci_driver_bind(struct pciDriver *driver,
int ret =3D -1;
char *devpath =3D NULL, *driverpath =3D NULL;
=20
- if (dev->driver || PCI_ACTION_BIND & driver->fail) {
- /* Device already bound or failing driver requested */
+ if (dev->driver) {
+ /* Device already bound */
errno =3D ENODEV;
return ret;
}
@@ -598,8 +598,8 @@ pci_driver_unbind(struct pciDriver *driver,
int ret =3D -1;
char *devpath =3D NULL, *driverpath =3D NULL;
=20
- if (dev->driver !=3D driver || PCI_ACTION_UNBIND & driver->fail) {
- /* Device not bound to the @driver or failing driver used */
+ if (dev->driver !=3D driver) {
+ /* Device not bound to the @driver */
errno =3D ENODEV;
return ret;
}
@@ -669,8 +669,8 @@ pci_driver_handle_bind(const char *path)
struct pciDevice *dev =3D pci_device_find_by_content(path);
struct pciDriver *driver =3D pci_driver_find_by_path(path);
=20
- if (!driver || !dev) {
- /* This should never happen (TM) */
+ if (!driver || !dev || PCI_ACTION_BIND & driver->fail) {
+ /* No driver, no device or failing driver requested */
errno =3D ENODEV;
goto cleanup;
}
@@ -686,8 +686,8 @@ pci_driver_handle_unbind(const char *path)
int ret =3D -1;
struct pciDevice *dev =3D pci_device_find_by_content(path);
=20
- if (!dev || !dev->driver) {
- /* This should never happen (TM) */
+ if (!dev || !dev->driver || PCI_ACTION_UNBIND & dev->driver->fail) {
+ /* No device, device not binded or failing driver requested */
errno =3D ENODEV;
goto cleanup;
}
--=20
2.21.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 16:08:06 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28
as permitted sender) client-ip=209.132.183.28;
envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com;
Authentication-Results: mx.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1562860485; cv=none;
d=zoho.com; s=zohoarc;
b=BnflN+mkCCMnIdq/Rz4tOuiiBnCkL6pyKCQeshgxDf9gCehgVq4VuOi/E4boKf9MrzdInu+6IjKBJYFxDbOVuyjHPpXhvPK083wJAGUmENLJ6dicD7bEOiBC1qvWDzHm1T6JoG9b16EDq5Ui2V2iCk7S0rd0LnV6DAGzsk83OVQ=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1562860485;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=DtGOODcpfoI8PKxiXpDce+pYcfiX6bTxG4IcEQzPJu0=;
b=Q49frTLxyA989nXqKp2C+Rv6jn6nHftufnxueWLdKxfUem7IoWlEjyWBGbB1xtADaTF+GOgQGZV+tWM2Ej/zKpvojam1KBS95ACMS4GL40HyJ9SjcmZn4QigVS8ztsopLA6Mr0c+xKNpI0Bo7H3KX/bFkl83HjZYP1CRY0jUc3c=
ARC-Authentication-Results: i=1; mx.zoho.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1562860485230268.36953033604686;
Thu, 11 Jul 2019 08:54:45 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com
[10.5.11.11])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 87240307D861;
Thu, 11 Jul 2019 15:54:43 +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 59A3C6014E;
Thu, 11 Jul 2019 15:54:43 +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 1B61018184B7;
Thu, 11 Jul 2019 15:54:43 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x6BFsS9p014630 for ;
Thu, 11 Jul 2019 11:54:28 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 2EB865D9DC; Thu, 11 Jul 2019 15:54:28 +0000 (UTC)
Received: from moe.brq.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id AF32E5D9CC
for ; Thu, 11 Jul 2019 15:54:27 +0000 (UTC)
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Thu, 11 Jul 2019 17:53:51 +0200
Message-Id:
<48cb8d5771288a152366718b749e230c1e983b9f.1562859733.git.mprivozn@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v1 04/31] Revert "virpcitest: Test
virPCIDeviceDetach failure"
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]);
Thu, 11 Jul 2019 15:54:44 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
This reverts commit b70c093ffa00cd87c8d39d3652b798f033a81faf.
In next commit the virpcimock is going to be extended and thus
binding a PCI device to vfio-pci driver will finally succeed.
Remove this test as it will no longer make sense.
Signed-off-by: Michal Privoznik
---
tests/virpcitest.c | 32 --------------------------------
1 file changed, 32 deletions(-)
diff --git a/tests/virpcitest.c b/tests/virpcitest.c
index 961a7eff1a..9ecd1b7d27 100644
--- a/tests/virpcitest.c
+++ b/tests/virpcitest.c
@@ -256,36 +256,6 @@ testVirPCIDeviceDetachSingle(const void *opaque)
return ret;
}
=20
-static int
-testVirPCIDeviceDetachFail(const void *opaque)
-{
- const struct testPCIDevData *data =3D opaque;
- int ret =3D -1;
- virPCIDevicePtr dev;
-
- dev =3D virPCIDeviceNew(data->domain, data->bus, data->slot, data->fun=
ction);
- if (!dev)
- goto cleanup;
-
- virPCIDeviceSetStubDriver(dev, VIR_PCI_STUB_DRIVER_VFIO);
-
- if (virPCIDeviceDetach(dev, NULL, NULL) < 0) {
- if (virTestGetVerbose() || virTestGetDebug())
- virDispatchError(NULL);
- virResetLastError();
- ret =3D 0;
- } else {
- virReportError(VIR_ERR_INTERNAL_ERROR,
- "Attaching device %s to %s should have failed",
- virPCIDeviceGetName(dev),
- virPCIStubDriverTypeToString(VIR_PCI_STUB_DRIVER_VF=
IO));
- }
-
- cleanup:
- virPCIDeviceFree(dev);
- return ret;
-}
-
static int
testVirPCIDeviceReattachSingle(const void *opaque)
{
@@ -421,8 +391,6 @@ mymain(void)
DO_TEST_PCI(testVirPCIDeviceIsAssignable, 5, 0x90, 1, 0);
DO_TEST_PCI(testVirPCIDeviceIsAssignable, 1, 1, 0, 0);
=20
- DO_TEST_PCI(testVirPCIDeviceDetachFail, 0, 0x0a, 1, 0);
-
/* Reattach a device already bound to non-stub a driver */
DO_TEST_PCI_DRIVER(0, 0x0a, 1, 0, "i915");
DO_TEST_PCI(testVirPCIDeviceReattachSingle, 0, 0x0a, 1, 0);
--=20
2.21.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 16:08:06 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28
as permitted sender) client-ip=209.132.183.28;
envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com;
Authentication-Results: mx.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1562860488; cv=none;
d=zoho.com; s=zohoarc;
b=czdpTbB6v7LSg+Rfj2sqP2k2tJiI0GlaCgQ9+fk7b6wBc0rp6FfK4ZTaM32JboS8wvKK8L0wpV6VRat4pxlXtAzEYJ94z2aRBZFwMb/Bl9kBpFuXdE8ftxLUDHY7eqyhheJM2tcplsUza4pCQq43KnSHTlJFYzTKUXw6uFz2NGc=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1562860488;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=5wCOG0HDL813EN7k7g+4xF7PERg9DziQhQYli83ioMs=;
b=MImkSb4iYz/C2fAVKfWJ8b+bvLv4bLpmJNqsXzOKqyUEnJ2UusVa2U9AaFmGIGhfnp22JkokaY5KmB2aTNjjunq6z+BQ40aoyXuSd5WBv/JSzVySrd/WU0hl+LkIFbxAsQuKi2h2ObdCB+A1spl4ddA48DMjXN0koB4TRMvYKRA=
ARC-Authentication-Results: i=1; mx.zoho.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1562860488829972.1521533558903;
Thu, 11 Jul 2019 08:54:48 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com
[10.5.11.11])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 1677C309B143;
Thu, 11 Jul 2019 15:54:47 +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 E5A2D60148;
Thu, 11 Jul 2019 15:54:46 +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 A58D9206D4;
Thu, 11 Jul 2019 15:54:46 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x6BFsSdi014642 for ;
Thu, 11 Jul 2019 11:54:29 -0400
Received: by smtp.corp.redhat.com (Postfix)
id EDE195D9CC; Thu, 11 Jul 2019 15:54:28 +0000 (UTC)
Received: from moe.brq.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id 7A1C95D9DC
for ; Thu, 11 Jul 2019 15:54:28 +0000 (UTC)
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Thu, 11 Jul 2019 17:53:52 +0200
Message-Id:
<883546a6872fb3afc83ea184d901bdb274b1000f.1562859733.git.mprivozn@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v1 05/31] virpcimock: Create driver_override file
in device dirs
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]);
Thu, 11 Jul 2019 15:54:47 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
Newer kernels (v3.16-rc1~29^2~6^4) have 'driver_override' file
which simplifies way of binding a PCI device to desired driver.
Libvirt has support for this for some time too (v2.3.0-rc1~236),
but not our virpcimock. So far we did not care because our code
is designed to deal with this situation. Except for one.
hypothetical case: binding a device to the vfio-pci driver can be
successful only via driver_override. Any attempt to bind a PCI
device to vfio-pci driver using old method (new_id + unbind +
bind) will fail because of b803b29c1a5. While on vanilla kernel
I'm able to use the old method successfully, it's failing on RHEL
kernels (not sure why).
Signed-off-by: Michal Privoznik
---
tests/virpcimock.c | 57 +++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 51 insertions(+), 6 deletions(-)
diff --git a/tests/virpcimock.c b/tests/virpcimock.c
index 6865f992dc..18d06d11d4 100644
--- a/tests/virpcimock.c
+++ b/tests/virpcimock.c
@@ -87,6 +87,11 @@ char *fakesysfspcidir;
* Probe for a driver that handles the specified device.
* Data in format "DDDD:BB:DD.F" (Domain:Bus:Device.Function).
*
+ * /sys/bus/pci/devices//driver_override
+ * Name of a driver that overrides preferred driver can be written
+ * here. The device will be attached to it on drivers_probe event.
+ * Writing an empty string (or "\n") clears the override.
+ *
* As a little hack, we are not mocking write to these files, but close()
* instead. The advantage is we don't need any self growing array to hold =
the
* partial writes and construct them back. We can let all the writes finis=
h,
@@ -147,6 +152,7 @@ static struct pciDevice *pci_device_find_by_content(con=
st char *path);
static void pci_driver_new(const char *name, int fail, ...);
static struct pciDriver *pci_driver_find_by_dev(struct pciDevice *dev);
static struct pciDriver *pci_driver_find_by_path(const char *path);
+static struct pciDriver *pci_driver_find_by_driver_override(struct pciDevi=
ce *dev);
static int pci_driver_bind(struct pciDriver *driver, struct pciDevice *dev=
);
static int pci_driver_unbind(struct pciDriver *driver, struct pciDevice *d=
ev);
static int pci_driver_handle_change(int fd, const char *path);
@@ -202,7 +208,8 @@ make_symlink(const char *path,
static int
pci_read_file(const char *path,
char *buf,
- size_t buf_size)
+ size_t buf_size,
+ bool truncate)
{
int ret =3D -1;
int fd =3D -1;
@@ -224,7 +231,8 @@ pci_read_file(const char *path,
goto cleanup;
}
=20
- if (ftruncate(fd, 0) < 0)
+ if (truncate &&
+ ftruncate(fd, 0) < 0)
goto cleanup;
=20
ret =3D 0;
@@ -398,6 +406,8 @@ pci_device_new_from_stub(const struct pciDevice *data)
ABORT("@tmp overflow");
make_file(devpath, "class", tmp, -1);
=20
+ make_file(devpath, "driver_override", NULL, -1);
+
if (snprintf(tmp, sizeof(tmp),
"%s/../../../kernel/iommu_groups/%d",
devpath, dev->iommuGroup) < 0) {
@@ -441,7 +451,7 @@ pci_device_find_by_content(const char *path)
{
char tmp[32];
=20
- if (pci_read_file(path, tmp, sizeof(tmp)) < 0)
+ if (pci_read_file(path, tmp, sizeof(tmp), true) < 0)
return NULL;
=20
return pci_device_find_by_id(tmp);
@@ -450,7 +460,10 @@ pci_device_find_by_content(const char *path)
static int
pci_device_autobind(struct pciDevice *dev)
{
- struct pciDriver *driver =3D pci_driver_find_by_dev(dev);
+ struct pciDriver *driver =3D pci_driver_find_by_driver_override(dev);
+
+ if (!driver)
+ driver =3D pci_driver_find_by_dev(dev);
=20
if (!driver) {
/* No driver found. Nothing to do */
@@ -544,6 +557,36 @@ pci_driver_find_by_path(const char *path)
return NULL;
}
=20
+static struct pciDriver *
+pci_driver_find_by_driver_override(struct pciDevice *dev)
+{
+ struct pciDriver *ret =3D NULL;
+ char *path =3D NULL;
+ char tmp[32];
+ size_t i;
+
+ if (virAsprintfQuiet(&path,
+ SYSFS_PCI_PREFIX "devices/%s/driver_override",
+ dev->id) < 0)
+ return NULL;
+
+ if (pci_read_file(path, tmp, sizeof(tmp), false) < 0)
+ goto cleanup;
+
+ for (i =3D 0; i < nPCIDrivers; i++) {
+ struct pciDriver *driver =3D pciDrivers[i];
+
+ if (STREQ(tmp, driver->name)) {
+ ret =3D driver;
+ break;
+ }
+ }
+
+ cleanup:
+ VIR_FREE(path);
+ return ret;
+}
+
static int
pci_driver_bind(struct pciDriver *driver,
struct pciDevice *dev)
@@ -657,6 +700,8 @@ pci_driver_handle_change(int fd ATTRIBUTE_UNUSED, const=
char *path)
ret =3D pci_driver_handle_remove_id(path);
else if (STREQ(file, "drivers_probe"))
ret =3D pci_driver_handle_drivers_probe(path);
+ else if (STREQ(file, "driver_override"))
+ ret =3D 0; /* nada */
else
ABORT("Not handled write to: %s", path);
return ret;
@@ -711,7 +756,7 @@ pci_driver_handle_new_id(const char *path)
goto cleanup;
}
=20
- if (pci_read_file(path, buf, sizeof(buf)) < 0)
+ if (pci_read_file(path, buf, sizeof(buf), true) < 0)
goto cleanup;
=20
if (sscanf(buf, "%x %x", &vendor, &device) < 2) {
@@ -766,7 +811,7 @@ pci_driver_handle_remove_id(const char *path)
goto cleanup;
}
=20
- if (pci_read_file(path, buf, sizeof(buf)) < 0)
+ if (pci_read_file(path, buf, sizeof(buf), true) < 0)
goto cleanup;
=20
if (sscanf(buf, "%x %x", &vendor, &device) < 2) {
--=20
2.21.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 16:08:06 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28
as permitted sender) client-ip=209.132.183.28;
envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com;
Authentication-Results: mx.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1562860489; cv=none;
d=zoho.com; s=zohoarc;
b=NrByNcJOYYO/RX/8Wf1d+EeKmYQ8DGMRf9+buhtCM11ocuhJy83YL+By/WZbEjdR/0mVXvaidjp0C+WMCP6KZceWqvUMtnW6A0cf+DxKzAGvzp42skaefZwJuZe9UHsENGtLqV7KapZVnN3xOJqyT6GAbYOrvsIA7rTPX4d44nE=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1562860489;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=2LhmpGwIs2USrecHmAjTEwuiReVJynQE8LVucsvPL+M=;
b=mBgxReQ1e0G3WiGpTmhwE1yg/pZO1Xale8vGRvJ9+Ehi5pF4Ynb67clUtpXH+ZE1/YKU1zXIJC5n+BvpiufORZP7/HMmFvQefEIoo2/wSR9GgornpFlSq/zfHKhjsInGyrk+S8PCb8D+qkro1hsj+V4BhffIdL27OGhcIAIJupA=
ARC-Authentication-Results: i=1; mx.zoho.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1562860489338186.1345946518917;
Thu, 11 Jul 2019 08:54:49 -0700 (PDT)
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 mx1.redhat.com (Postfix) with ESMTPS id C5643C05B1CD;
Thu, 11 Jul 2019 15:54:47 +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 99C4D60605;
Thu, 11 Jul 2019 15:54:47 +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 567F01832FC6;
Thu, 11 Jul 2019 15:54:47 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x6BFsTU9014647 for ;
Thu, 11 Jul 2019 11:54:29 -0400
Received: by smtp.corp.redhat.com (Postfix)
id B920B5D973; Thu, 11 Jul 2019 15:54:29 +0000 (UTC)
Received: from moe.brq.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id 452D15D9DC
for ; Thu, 11 Jul 2019 15:54:29 +0000 (UTC)
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Thu, 11 Jul 2019 17:53:53 +0200
Message-Id:
<6fdea280f33230ff485a7f2f91167d2ba21573f1.1562859733.git.mprivozn@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v1 06/31] virPCIDeviceAddressEqual: Fix const
correctness
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]);
Thu, 11 Jul 2019 15:54:48 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
This function does not change any of the passed addresses. It
just reads them.
Signed-off-by: Michal Privoznik
---
src/util/virpci.c | 4 ++--
src/util/virpci.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 75e8daadd5..5392d62406 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -1718,8 +1718,8 @@ virPCIDeviceAddressIsEmpty(const virPCIDeviceAddress =
*addr)
}
=20
bool
-virPCIDeviceAddressEqual(virPCIDeviceAddress *addr1,
- virPCIDeviceAddress *addr2)
+virPCIDeviceAddressEqual(const virPCIDeviceAddress *addr1,
+ const virPCIDeviceAddress *addr2)
{
if (addr1->domain =3D=3D addr2->domain &&
addr1->bus =3D=3D addr2->bus &&
diff --git a/src/util/virpci.h b/src/util/virpci.h
index 457be3c929..a940608701 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -231,8 +231,8 @@ bool virPCIDeviceAddressIsValid(virPCIDeviceAddressPtr =
addr,
bool report);
bool virPCIDeviceAddressIsEmpty(const virPCIDeviceAddress *addr);
=20
-bool virPCIDeviceAddressEqual(virPCIDeviceAddress *addr1,
- virPCIDeviceAddress *addr2);
+bool virPCIDeviceAddressEqual(const virPCIDeviceAddress *addr1,
+ const virPCIDeviceAddress *addr2);
=20
char *virPCIDeviceAddressAsString(virPCIDeviceAddressPtr addr)
ATTRIBUTE_NONNULL(1);
--=20
2.21.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 16:08:06 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28
as permitted sender) client-ip=209.132.183.28;
envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com;
Authentication-Results: mx.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1562860493; cv=none;
d=zoho.com; s=zohoarc;
b=IZLJlyXN38W1ipfu2O703cnDhudACLshOaatNPP4wkOxn9a6bEebBXgKNN5UCrx/at26lKRxjCTe02hJ4/bmuxe9m0k9paQvQx6nYwdesdDtH7UHN3DHEBU9xyL5X/c7Fvots0T3Mr0V6C78zfehXRkvNJySoV3mxMHuHdyiVYc=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1562860493;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=PmOUH3RBMI0UBAA06sDOK8u2kMq3uUvS6SEGIcLONOs=;
b=V86GV9o5gkuakuq1UA63X1BAXgSBF+vnApfGskujIUolLC1/UuUk53SRHRjOuAoPpQNyJyiEUsLLQnxUWTqPlif0bE9hbb2xD6bdlr/uWBtI+Ah4STdwfqrrHwGxWUBs/N0utXJ2J3vqOdwRfDMVkgFVGhSrkxnNLf1fY3xgurQ=
ARC-Authentication-Results: i=1; mx.zoho.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1562860493442770.6034014274087;
Thu, 11 Jul 2019 08:54:53 -0700 (PDT)
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 mx1.redhat.com (Postfix) with ESMTPS id 56F14C04BD48;
Thu, 11 Jul 2019 15:54:51 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 2945E5D784;
Thu, 11 Jul 2019 15:54:51 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id CBC4C1833007;
Thu, 11 Jul 2019 15:54:50 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x6BFsUtE014660 for ;
Thu, 11 Jul 2019 11:54:30 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 8522E5D973; Thu, 11 Jul 2019 15:54:30 +0000 (UTC)
Received: from moe.brq.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id 10C935D9DC
for ; Thu, 11 Jul 2019 15:54:29 +0000 (UTC)
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Thu, 11 Jul 2019 17:53:54 +0200
Message-Id:
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v1 07/31] virPCIDeviceAddressAsString: Fix const
correctness
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]);
Thu, 11 Jul 2019 15:54:52 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
This function does not change any of the passed addresses. It
just reads them.
Signed-off-by: Michal Privoznik
---
src/util/virpci.c | 2 +-
src/util/virpci.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 5392d62406..59f478dd41 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -1731,7 +1731,7 @@ virPCIDeviceAddressEqual(const virPCIDeviceAddress *a=
ddr1,
}
=20
char *
-virPCIDeviceAddressAsString(virPCIDeviceAddressPtr addr)
+virPCIDeviceAddressAsString(const virPCIDeviceAddress *addr)
{
char *str;
=20
diff --git a/src/util/virpci.h b/src/util/virpci.h
index a940608701..1efd8b77ed 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -234,7 +234,7 @@ bool virPCIDeviceAddressIsEmpty(const virPCIDeviceAddre=
ss *addr);
bool virPCIDeviceAddressEqual(const virPCIDeviceAddress *addr1,
const virPCIDeviceAddress *addr2);
=20
-char *virPCIDeviceAddressAsString(virPCIDeviceAddressPtr addr)
+char *virPCIDeviceAddressAsString(const virPCIDeviceAddress *addr)
ATTRIBUTE_NONNULL(1);
=20
int virPCIDeviceAddressParse(char *address, virPCIDeviceAddressPtr bdf);
--=20
2.21.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 16:08:06 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28
as permitted sender) client-ip=209.132.183.28;
envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com;
Authentication-Results: mx.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1562860492; cv=none;
d=zoho.com; s=zohoarc;
b=EOG8v5Yr7E0BHD0UQzvbFwlc3PH5Lzqcdd5WvxIiY5IbVG1TfA+LrsEyW/oZIzg/OPzgW+AMKDSNBva9I/sj57CdcEf1OmzsAYjZjZm0iJBjpU8dkC9sW6nDUAI2uBBPCkwqeNBO4M/E/9QQW2AmbPBA35yaKdwmAJeNPcivNZ8=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1562860492;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=E56242hW65uSRN1unhOj8NrEK0N4GN6IOuVSpzBeOLw=;
b=FTZ9VvCdhy2dlTUm6xAX6Z9N0EYulfF73XUYHQ6w+FvAvVQrbqoeev8tT4VvuZyG5rwJuu+WrbZKmAauiGUuTnm8ZuKVwWNGqEvOfQ7s0fQ2jHdb/XVw3pMWv90mva3WheOGDeeJdAZQZskzImYu3+88q4TrWwJEaw21crHAB4Q=
ARC-Authentication-Results: i=1; mx.zoho.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1562860492308769.8400013958524;
Thu, 11 Jul 2019 08:54:52 -0700 (PDT)
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 mx1.redhat.com (Postfix) with ESMTPS id 82096309264D;
Thu, 11 Jul 2019 15:54:50 +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 564F660A97;
Thu, 11 Jul 2019 15:54:50 +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 0D8421833003;
Thu, 11 Jul 2019 15:54:50 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x6BFsVFx014667 for ;
Thu, 11 Jul 2019 11:54:31 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 514275D9DC; Thu, 11 Jul 2019 15:54:31 +0000 (UTC)
Received: from moe.brq.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id D05854F9B6
for ; Thu, 11 Jul 2019 15:54:30 +0000 (UTC)
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Thu, 11 Jul 2019 17:53:55 +0200
Message-Id:
<3415f4aa393ba268d00b811f5f6fb95c307fc8bb.1562859733.git.mprivozn@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v1 08/31] virpci: Introduce virPCIDeviceAddressCopy
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]);
Thu, 11 Jul 2019 15:54:51 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
This helper is cleaner than plain memcpy() because one doesn't
have to look into virPCIDeviceAddress struct to see if it
contains any strings / pointers.
Signed-off-by: Michal Privoznik
---
src/libvirt_private.syms | 1 +
src/util/virpci.c | 6 ++++++
src/util/virpci.h | 2 ++
3 files changed, 9 insertions(+)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 02d5b7acce..6cef8d20fe 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2612,6 +2612,7 @@ virObjectUnref;
=20
# util/virpci.h
virPCIDeviceAddressAsString;
+virPCIDeviceAddressCopy;
virPCIDeviceAddressEqual;
virPCIDeviceAddressGetIOMMUGroupAddresses;
virPCIDeviceAddressGetIOMMUGroupNum;
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 59f478dd41..03ce651f40 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -1730,6 +1730,12 @@ virPCIDeviceAddressEqual(const virPCIDeviceAddress *=
addr1,
return false;
}
=20
+void virPCIDeviceAddressCopy(virPCIDeviceAddressPtr dst,
+ const virPCIDeviceAddress *src)
+{
+ memcpy(dst, src, sizeof(*src));
+}
+
char *
virPCIDeviceAddressAsString(const virPCIDeviceAddress *addr)
{
diff --git a/src/util/virpci.h b/src/util/virpci.h
index 1efd8b77ed..72e90a1ef3 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -233,6 +233,8 @@ bool virPCIDeviceAddressIsEmpty(const virPCIDeviceAddre=
ss *addr);
=20
bool virPCIDeviceAddressEqual(const virPCIDeviceAddress *addr1,
const virPCIDeviceAddress *addr2);
+void virPCIDeviceAddressCopy(virPCIDeviceAddressPtr dst,
+ const virPCIDeviceAddress *src);
=20
char *virPCIDeviceAddressAsString(const virPCIDeviceAddress *addr)
ATTRIBUTE_NONNULL(1);
--=20
2.21.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 16:08:06 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28
as permitted sender) client-ip=209.132.183.28;
envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com;
Authentication-Results: mx.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1562860495; cv=none;
d=zoho.com; s=zohoarc;
b=SSBsp7n3sm19lKLUMeZnb/z8/fxhJbdSgFVQYV91n2uUHB6sQhYDGBH9L8wYM1BpngjvDS+ww1RekHOCUoFrYqANfVKqCYq15yAxyIxAYk0snps7Pp3RChc0tcWfn0ccESmLcpr5KsLWBbFXaZMwccx34OYRXFAgAJKBBmm1/pY=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1562860495;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=/Wj7U27gP0o6642EvbVYN93X8vQjNcw88AN7KRbRMJk=;
b=hm+N9v3QC0zUegD10kmMG2G8LD4mSGu95hKgYNCTdBsEUN4mk9jaPhaOtTDG0jR3yqa6+YEgNaM+tS4QrTOGHz+KsC0u+F1pI6A2epzW6CurSSHuwvxjsIZPL+IPkg/O1jQiHRBz2jsomtoMbnX6Bie1RbQS43oOgPdw/XAgNNs=
ARC-Authentication-Results: i=1; mx.zoho.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1562860495683171.64346558291697;
Thu, 11 Jul 2019 08:54:55 -0700 (PDT)
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 mx1.redhat.com (Postfix) with ESMTPS id 006A959474;
Thu, 11 Jul 2019 15:54:54 +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 D0CCC5B683;
Thu, 11 Jul 2019 15:54:53 +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 98B94206DA;
Thu, 11 Jul 2019 15:54:53 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x6BFsWgC014675 for ;
Thu, 11 Jul 2019 11:54:32 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 1D5295D9CC; Thu, 11 Jul 2019 15:54:32 +0000 (UTC)
Received: from moe.brq.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id 9D09B5D9DC
for ; Thu, 11 Jul 2019 15:54:31 +0000 (UTC)
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Thu, 11 Jul 2019 17:53:56 +0200
Message-Id:
<9cca51701e895305ebc68de3da90a158767bbae6.1562859733.git.mprivozn@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v1 09/31] qemuDomainDeviceDefValidateDisk: Reorder
some checks
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]);
Thu, 11 Jul 2019 15:54:54 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
I find this function more readable if checks for passed storage
source are done first and backing chain is done last. Mixing them
together does not hurt, but is less readable.
Signed-off-by: Michal Privoznik
---
src/qemu/qemu_domain.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 0f1fda2384..f09abc8a73 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5178,11 +5178,6 @@ qemuDomainDeviceDefValidateDisk(const virDomainDiskD=
ef *disk,
return -1;
}
=20
- for (n =3D disk->src; virStorageSourceIsBacking(n); n =3D n->backingSt=
ore) {
- if (qemuDomainValidateStorageSource(n, qemuCaps) < 0)
- return -1;
- }
-
if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_CDROM &&
disk->bus =3D=3D VIR_DOMAIN_DISK_BUS_VIRTIO) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -5191,6 +5186,11 @@ qemuDomainDeviceDefValidateDisk(const virDomainDiskD=
ef *disk,
return -1;
}
=20
+ for (n =3D disk->src; virStorageSourceIsBacking(n); n =3D n->backingSt=
ore) {
+ if (qemuDomainValidateStorageSource(n, qemuCaps) < 0)
+ return -1;
+ }
+
return 0;
}
=20
--=20
2.21.0
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 16:08:06 2024
Delivered-To: importer@patchew.org
Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28
as permitted sender) client-ip=209.132.183.28;
envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com;
Authentication-Results: mx.zohomail.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass(p=none dis=none) header.from=redhat.com
ARC-Seal: i=1; a=rsa-sha256; t=1562860488; cv=none;
d=zoho.com; s=zohoarc;
b=CQtRN4YghMezW8m7+k27D27/gCNHrlQNG1t04Ly+C2ux320PHv5r40/bOZYmqmGch33qOC7DFBRRwwNjJ46Ilsbot5qozPxPgCXYvT8640Y/JU+SON8KlRaD8tsiCcNlBOefxqiwmh6fAuqBpOgQWDTiXb+inHKthb7YPL8I6+E=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1562860488;
h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=n/qSGTif9/6TiHXTKYJFm0e+DacknCdDyguGfSNc5vw=;
b=b7F5hCvNebRIo7vGBlypEsDmtG9n4m1X85IGhUGhQgLGQvllubzn51oP+YF12yjbBXjPtqRn8IrdQmvJki5CDvR0nNVLLsX4k3ZH5OMAgKGwkzD0WYOuh6T8B1VfTag0di6iv0Teddd8FzTstWckCmvRvYm7xzr+tascH+CxB1o=
ARC-Authentication-Results: i=1; mx.zoho.com;
spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as
permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com;
dmarc=pass header.from= (p=none dis=none)
header.from=
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1562860488320356.04480535189305;
Thu, 11 Jul 2019 08:54:48 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
[10.5.11.12])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 98B16C024906;
Thu, 11 Jul 2019 15:54:46 +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 7119460C47;
Thu, 11 Jul 2019 15:54:46 +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 2F778206D1;
Thu, 11 Jul 2019 15:54:46 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com
[10.5.11.14])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x6BFsZbv014698 for ;
Thu, 11 Jul 2019 11:54:35 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 1A23C5D9DC; Thu, 11 Jul 2019 15:54:35 +0000 (UTC)
Received: from moe.brq.redhat.com (unknown [10.43.2.30])
by smtp.corp.redhat.com (Postfix) with ESMTP id 99A415D973
for ; Thu, 11 Jul 2019 15:54:32 +0000 (UTC)
From: Michal Privoznik
To: libvir-list@redhat.com
Date: Thu, 11 Jul 2019 17:53:57 +0200
Message-Id:
<17aad25e7827405ec0d33a2fd030683c4249ef30.1562859733.git.mprivozn@redhat.com>
In-Reply-To:
References:
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-loop: libvir-list@redhat.com
Subject: [libvirt] [PATCH v1 10/31] schemas: Introduce disk type NVMe
X-BeenThere: libvir-list@redhat.com
X-Mailman-Version: 2.1.12
Precedence: junk
List-Id: Development discussions about the libvirt library & tools
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]);
Thu, 11 Jul 2019 15:54:47 +0000 (UTC)
Content-Type: text/plain; charset="utf-8"
There is this class of PCI devices that act like disks: NVMe.
Therefore, they are both PCI devices and disks. While we already
have (and can assign a NVMe device to a domain
successfully) we don't have disk representation. There are three
problems with PCI assignment in case of a NVMe device:
1) domains with can't be migrated
2) NVMe device is assigned whole, there's no way to assign only a
namespace
3) Because hypervisors see they don't put block layer
on top of it - users don't get all the fancy features like
snapshots
NVMe namespaces are way of splitting one continuous NVDIMM memory
into smaller ones, effectively creating smaller NVMe-s (which can
then be partitioned, LVMed, etc.)
Because of all of this the following XML was chosen to model a
NVMe device:
Signed-off-by: Michal Privoznik
---
docs/formatdomain.html.in | 45 +++++++++++++++++++++--
docs/schemas/domaincommon.rng | 32 ++++++++++++++++
tests/qemuxml2argvdata/disk-nvme.xml | 55 ++++++++++++++++++++++++++++
3 files changed, 129 insertions(+), 3 deletions(-)
create mode 100644 tests/qemuxml2argvdata/disk-nvme.xml
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index a7a6ec32a5..545578076d 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2922,6 +2922,13 @@
</backingStore>
<target dev=3D'vdd' bus=3D'virtio'/>
</disk>
+ <disk type=3D'nvme' device=3D'disk'>
+ <driver name=3D'qemu' type=3D'raw'/>
+ <source type=3D'pci' managed=3D'yes' namespace=3D'1'>
+ <address domain=3D'0x0000' bus=3D'0x01' slot=3D'0x00' function=3D=
'0x0'/>
+ </source>
+ <target dev=3D'vde' bus=3D'virtio'/>
+ </disk>
</devices>
...
=20
@@ -2935,7 +2942,8 @@
Valid values are "file", "block",
"dir" (since 0.7.5),
"network" (since 0.8.7), or
- "volume" (since 1.0.5)
+ "volume" (since 1.0.5), or
+ "nvme" (since 5.5.0)
and refer to the underlying source for the disk.
Since 0.0.3
@@ -3118,6 +3126,31 @@
Since 1.0.5
+
nvme
+
+ To specify disk source for NVMe disk the source
+ element has the following attributes:
+
+
type
+
The type of address specified in address
+ sub-element. Currently, only pci value is
+ accepted.
+
+
+
managed
+
This attribute instructs libvirt to detach NVMe
+ controller automatically on domain startup (yes)
+ or expect the controller to be detached by system
+ administrator (no).
+
+
+
namespace
+
The namespace ID which should be assigned to the domai=
n.
+ According to NVMe standard, namespace numbers start from 1,
+ including.
+