From nobody Fri Apr 19 17:37:59 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=1559730766; cv=none;
d=zoho.com; s=zohoarc;
b=mq8ih0Lg5qxOLwoFsjA30dyDFKuG7wfjAqdaRVTBh1N6v0W6DXxcbOOpBAdA/VDAHT2NnSrlwVvo0W7FH4trF223Lqk0xX+z9cd2yp6HjUeAFvKUZBRFbmTjEbTM9pQfOEvXrq+uGiVk45wfAxHItYlIjEjY8MxYnQGYBSKRImg=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730766;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=5tpjN3qlWH0kM4YMJRHQ1rpV+zwg/DzJ1nePE3PlA7Y=;
b=HEkHjuqcoc3EQNppYM/5HjLNUJZc/rxR2E4puEbTJ/L+DadBTfo7JggGC2UI9Y12p3BfVBpxCl08Gu8IaUgD7uBuzco7vfnxUj85s5niJKzsmRuiDPsVaUxFBiAh01o82bTfP9mkSVZTiyDamkvvnZgHJxMpcsbTVdz+NhhKkbU=
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 1559730766789246.4749464797817;
Wed, 5 Jun 2019 03:32:46 -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 0E7853086232;
Wed, 5 Jun 2019 10:32:40 +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 DD4085B689;
Wed, 5 Jun 2019 10:32:38 +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 9BC5A1806B18;
Wed, 5 Jun 2019 10:32:36 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com
[10.5.11.22])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x55AVU29019592 for ;
Wed, 5 Jun 2019 06:31:30 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 5CB5A1001E81; Wed, 5 Jun 2019 10:31:30 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id B0AD61001E79;
Wed, 5 Jun 2019 10:31:25 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:30:59 +0200
Message-Id: <20190605103117.19047-2-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 01/19] device-conf: removed unneeded
virDomainDeviceInfoCopy()
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-Type: text/plain; charset="utf-8"
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.42]);
Wed, 05 Jun 2019 10:32:45 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
Signed-off-by: Marc-Andr=C3=A9 Lureau
Reviewed-by: J=C3=A1n Tomko
---
src/conf/device_conf.c | 21 ---------------------
src/conf/device_conf.h | 2 --
src/libvirt_private.syms | 1 -
3 files changed, 24 deletions(-)
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index 2f82bdc2a7..b28f30dfc5 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -86,27 +86,6 @@ virZPCIDeviceAddressParseXML(xmlNodePtr node,
return ret;
}
=20
-int
-virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst,
- virDomainDeviceInfoPtr src)
-{
- /* Assume that dst is already cleared */
-
- /* first a shallow copy of *everything* */
- *dst =3D *src;
-
- /* then copy whatever's left */
- dst->alias =3D NULL;
- dst->romfile =3D NULL;
- dst->loadparm =3D NULL;
-
- if (VIR_STRDUP(dst->alias, src->alias) < 0 ||
- VIR_STRDUP(dst->romfile, src->romfile) < 0 ||
- VIR_STRDUP(dst->loadparm, src->loadparm) < 0)
- return -1;
- return 0;
-}
-
void
virDomainDeviceInfoClear(virDomainDeviceInfoPtr info)
{
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index b3299ac69d..54db244f0e 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -182,8 +182,6 @@ struct _virDomainDeviceInfo {
bool isolationGroupLocked;
};
=20
-int virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst,
- virDomainDeviceInfoPtr src);
void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info);
void virDomainDeviceInfoFree(virDomainDeviceInfoPtr info);
=20
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 8ee76645cd..b0dbf399eb 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -105,7 +105,6 @@ virDomainDeviceCCWAddressIsValid;
virDomainDeviceCCWAddressParseXML;
virDomainDeviceDriveAddressParseXML;
virDomainDeviceInfoAddressIsEqual;
-virDomainDeviceInfoCopy;
virDomainDeviceSpaprVioAddressParseXML;
virDomainDeviceUSBAddressParseXML;
virDomainDeviceVirtioSerialAddressParseXML;
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 17:37:59 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=1559730793; cv=none;
d=zoho.com; s=zohoarc;
b=kva2xQZ6CEkor1A9kA/uBRH+Tnr8y6WjCfzljDBO7QFFdYMEeczUyg1FcbyVLoTWrvbY0ckRiu4lFQQmdh2OfiV14tvokpfVASJX+hwXpaOXrk38PZY3LoFFds/kI8hRN2IgVCQYsbTUp9UmbFAvb61C0okpti4HcM54yG9pAHw=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730793;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=xfS6vye87OeJvyX2U7M/5C9rgIHj6UbmwnEiXfvm65w=;
b=gHhxkqYxuyZLHk0UhGnWJC2GKiJIr7zu2ebykehl0UhqlZweVXVVHqy6DWa+PFXJQrwrATFNl6OkxL2QrQSA/vhIb2i6QFU01WwfF/4Xna01UbGHNjPP/7yWq0A+0f76K+Al7LiRPQwnja/DoEApSj+YNclJQ/QfxHtxTvu1RaM=
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 1559730793470150.65894010121826;
Wed, 5 Jun 2019 03:33:13 -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 1D7DD307BA56;
Wed, 5 Jun 2019 10:33:07 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id E86CA61984;
Wed, 5 Jun 2019 10:33:05 +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 A0B221806B16;
Wed, 5 Jun 2019 10:33:03 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com
[10.5.11.22])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x55AVWMl019602 for ;
Wed, 5 Jun 2019 06:31:32 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 67AAB1017E2E; Wed, 5 Jun 2019 10:31:32 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id D325E1001E79;
Wed, 5 Jun 2019 10:31:31 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:31:00 +0200
Message-Id: <20190605103117.19047-3-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 02/19] tpm: minor argument comment fix
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-Type: text/plain; charset="utf-8"
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.43]);
Wed, 05 Jun 2019 10:33:12 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
Signed-off-by: Marc-Andr=C3=A9 Lureau
Reviewed-by: J=C3=A1n Tomko
---
src/qemu/qemu_tpm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c
index 835a9caf46..41fef1f8f5 100644
--- a/src/qemu/qemu_tpm.c
+++ b/src/qemu/qemu_tpm.c
@@ -745,7 +745,7 @@ qemuExtTPMCleanupHost(virDomainDefPtr def)
* qemuExtTPMStartEmulator:
*
* @driver: QEMU driver
- * @def: domain definition
+ * @vm: the VM domain
* @logCtxt: log context
*
* Start the external TPM Emulator:
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 17:37:59 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=1559730738; cv=none;
d=zoho.com; s=zohoarc;
b=CZlt4tvNI/4mexS6uzUcgVt4mATSBS11WrRQYwnnycgkOHV3OrhNSvB7rLZGf9OP5y+Nhuvedux8SNizvlO/L9sRQNFxARwlNKmRRFtRWIU57S24FVFNFlSSUibhTHM9A/ngmvt+MoVa87r6mmGwR9zKV/LWw2BIHpeJHl6gCSc=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730738;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=zBzyvgvJk15DjgmBhfp8djIcvb1xVt6LBYAtK25xdOs=;
b=bpof3H0b4Mja9QP0V4MF1SBlFgU3lpweK57CU9NbnIJlbILD0ZU9z1ngh9AOCaf1/Dv+X9VMNngDgEEq3hf8PiKaxASy0mq9ZRvL0ZuwjD0UJFzi1P0Tb8gMSfjfOJYyqsM4pMaPIdMCkAyXV42ETc9kLpl+xNhFS/oo3Jp7DQQ=
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 1559730738881362.0230280512269;
Wed, 5 Jun 2019 03:32:18 -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 899813688B;
Wed, 5 Jun 2019 10:32:00 +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 B55C15D6A9;
Wed, 5 Jun 2019 10:31:52 +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 BCD45206D1;
Wed, 5 Jun 2019 10:31:40 +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 x55AVc5P019924 for ;
Wed, 5 Jun 2019 06:31:38 -0400
Received: by smtp.corp.redhat.com (Postfix)
id E813D5D9CC; Wed, 5 Jun 2019 10:31:38 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id 1F13F5D9CD;
Wed, 5 Jun 2019 10:31:33 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:31:01 +0200
Message-Id: <20190605103117.19047-4-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 03/19] qemu_firmware: only set nfeatures on success
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-Type: text/plain; charset="utf-8"
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.30]);
Wed, 05 Jun 2019 10:32:12 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
The field is set just before returning on success.
Signed-off-by: Marc-Andr=C3=A9 Lureau
Reviewed-by: J=C3=A1n Tomko
---
src/qemu/qemu_firmware.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index f3d89d000d..bf29b10b9a 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -592,8 +592,6 @@ qemuFirmwareFeatureParse(const char *path,
if (VIR_ALLOC_N(features, nfeatures) < 0)
return -1;
=20
- fw->nfeatures =3D nfeatures;
-
for (i =3D 0; i < nfeatures; i++) {
virJSONValuePtr item =3D virJSONValueArrayGet(featuresJSON, i);
const char *tmpStr =3D virJSONValueGetString(item);
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 17:37:59 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=1559730774; cv=none;
d=zoho.com; s=zohoarc;
b=CsNaOgrcPljjJZiqj+DrFWmJImPpbHazTkAqWi6/+zbAgYuuOcaX9xI4E3WQZ8QHlVsgs4DKvWpDh891e0sUmKtERNtzYtkgpbHjABiKhNFMjcK3gRL5kU6vNyw7SflITj2o9COkzZrNwzyZo2jjHIg3UHhyoPlZWmBiVduHHik=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730774;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=CdlCqnJzKbAaT3oV0CpMkIxa3fn7oEx1iYVd0g5XD3E=;
b=RQUn2uczSXzU/ql4nEOqWSmLI7IKSv8TWrAFh5RYUD2RN4YIptiaeWphMMKFSNNxKuJr08nijH9glBMh6S5Zsalne++sDc52u4uvFQNcRXkoIz1mSJM5xTOqFrhy+tFB6YtiABNTJHOZOEaPs3gBpo9xRl6zwTNhnnu+LC2mhrA=
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 1559730774582355.9808024555798;
Wed, 5 Jun 2019 03:32:54 -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 275CC223879;
Wed, 5 Jun 2019 10:32:45 +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 001C12C8CC;
Wed, 5 Jun 2019 10:32:42 +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 B4208206D4;
Wed, 5 Jun 2019 10:32:40 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com
[10.5.11.23])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x55AVj6f019937 for ;
Wed, 5 Jun 2019 06:31:45 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 54D3D19C65; Wed, 5 Jun 2019 10:31:45 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id 7B14C19C6A;
Wed, 5 Jun 2019 10:31:40 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:31:02 +0200
Message-Id: <20190605103117.19047-5-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 04/19] qemu: extract out qemuFetchConfigs from
firmware
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-Type: text/plain; charset="utf-8"
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.39]);
Wed, 05 Jun 2019 10:32:48 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
The same config files disovery & priority rules are used for
vhost-user backends.
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/Makefile.inc.am | 2 +
src/qemu/qemu_configs.c | 183 +++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_configs.h | 31 +++++++
src/qemu/qemu_firmware.c | 144 +-----------------------------
4 files changed, 218 insertions(+), 142 deletions(-)
create mode 100644 src/qemu/qemu_configs.c
create mode 100644 src/qemu/qemu_configs.h
diff --git a/src/qemu/Makefile.inc.am b/src/qemu/Makefile.inc.am
index fd32a90d56..d3ef6b865c 100644
--- a/src/qemu/Makefile.inc.am
+++ b/src/qemu/Makefile.inc.am
@@ -32,6 +32,8 @@ QEMU_DRIVER_SOURCES =3D \
qemu/qemu_hotplugpriv.h \
qemu/qemu_conf.c \
qemu/qemu_conf.h \
+ qemu/qemu_configs.c \
+ qemu/qemu_configs.h \
qemu/qemu_process.c \
qemu/qemu_process.h \
qemu/qemu_processpriv.h \
diff --git a/src/qemu/qemu_configs.c b/src/qemu/qemu_configs.c
new file mode 100644
index 0000000000..48ba558cc5
--- /dev/null
+++ b/src/qemu/qemu_configs.c
@@ -0,0 +1,183 @@
+/*
+ * qemu_configs.c: QEMU firmware/vhost-user etc configs
+ *
+ * Copyright (C) 2019 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * .
+ */
+
+#include
+
+#include "qemu_configs.h"
+#include "configmake.h"
+#include "viralloc.h"
+#include "virenum.h"
+#include "virfile.h"
+#include "virhash.h"
+#include "virlog.h"
+#include "virstring.h"
+
+#define VIR_FROM_THIS VIR_FROM_QEMU
+
+VIR_LOG_INIT("qemu.qemu_configs");
+
+static int
+qemuBuildFileList(virHashTablePtr files, const char *dir)
+{
+ DIR *dirp;
+ struct dirent *ent =3D NULL;
+ int rc;
+ int ret =3D -1;
+
+ if ((rc =3D virDirOpenIfExists(&dirp, dir)) < 0)
+ return -1;
+
+ if (rc =3D=3D 0)
+ return 0;
+
+ while ((rc =3D virDirRead(dirp, &ent, dir)) > 0) {
+ VIR_AUTOFREE(char *) filename =3D NULL;
+ VIR_AUTOFREE(char *) path =3D NULL;
+ struct stat sb;
+
+ if (STRPREFIX(ent->d_name, "."))
+ continue;
+
+ if (VIR_STRDUP(filename, ent->d_name) < 0)
+ goto cleanup;
+
+ if (virAsprintf(&path, "%s/%s", dir, filename) < 0)
+ goto cleanup;
+
+ if (stat(path, &sb) < 0) {
+ virReportSystemError(errno, _("Unable to access %s"), path);
+ goto cleanup;
+ }
+
+ if (!S_ISREG(sb.st_mode) && !S_ISLNK(sb.st_mode))
+ continue;
+
+ if (virHashUpdateEntry(files, filename, path) < 0)
+ goto cleanup;
+
+ path =3D NULL;
+ }
+
+ if (rc < 0)
+ goto cleanup;
+
+ ret =3D 0;
+ cleanup:
+ virDirClose(&dirp);
+ return ret;
+}
+
+static int
+qemuConfigFilesSorter(const virHashKeyValuePair *a,
+ const virHashKeyValuePair *b)
+{
+ return strcmp(a->key, b->key);
+}
+
+#define QEMU_SYSTEM_LOCATION PREFIX "/share/qemu"
+#define QEMU_ETC_LOCATION SYSCONFDIR "/qemu"
+
+int
+qemuFetchConfigs(const char *name,
+ char ***configs,
+ bool privileged)
+{
+ VIR_AUTOPTR(virHashTable) files =3D NULL;
+ VIR_AUTOFREE(char *) homeConfig =3D NULL;
+ VIR_AUTOFREE(char *) xdgConfig =3D NULL;
+ VIR_AUTOFREE(char *) sysLocation =3D virFileBuildPath(QEMU_SYSTEM_LOCA=
TION, name, NULL);
+ VIR_AUTOFREE(char *) etcLocation =3D virFileBuildPath(QEMU_ETC_LOCATIO=
N, name, NULL);
+ VIR_AUTOFREE(virHashKeyValuePairPtr) pairs =3D NULL;
+ virHashKeyValuePairPtr tmp =3D NULL;
+
+ *configs =3D NULL;
+
+ if (!privileged) {
+ /* This is a slight divergence from the specification.
+ * Since the system daemon runs as root, it doesn't make
+ * much sense to parse files in root's home directory. It
+ * makes sense only for session daemon which runs under
+ * regular user. */
+ if (VIR_STRDUP(xdgConfig, virGetEnvBlockSUID("XDG_CONFIG_HOME")) <=
0)
+ return -1;
+
+ if (!xdgConfig) {
+ VIR_AUTOFREE(char *) home =3D virGetUserDirectory();
+
+ if (!home)
+ return -1;
+
+ if (virAsprintf(&xdgConfig, "%s/.config", home) < 0)
+ return -1;
+ }
+
+ if (virAsprintf(&homeConfig, "%s/qemu/%s", xdgConfig, name) < 0)
+ return -1;
+ }
+
+ if (!(files =3D virHashCreate(10, virHashValueFree)))
+ return -1;
+
+ if (qemuBuildFileList(files, sysLocation) < 0)
+ return -1;
+
+ if (qemuBuildFileList(files, etcLocation) < 0)
+ return -1;
+
+ if (homeConfig &&
+ qemuBuildFileList(files, homeConfig) < 0)
+ return -1;
+
+ /* At this point, the @files hash table contains unique set of filenam=
es
+ * where each filename (as key) has the highest priority full pathname
+ * associated with it. */
+
+ if (virHashSize(files) =3D=3D 0)
+ return 0;
+
+ if (!(pairs =3D virHashGetItems(files, qemuConfigFilesSorter)))
+ return -1;
+
+ for (tmp =3D pairs; tmp->key; tmp++) {
+ const char *path =3D tmp->value;
+ off_t len;
+
+ if ((len =3D virFileLength(path, -1)) < 0) {
+ virReportSystemError(errno,
+ _("unable to get size of '%s'"),
+ path);
+ return -1;
+ }
+
+ VIR_DEBUG("%s description path '%s' len=3D%jd",
+ name, path, (intmax_t) len);
+
+ if (len =3D=3D 0) {
+ /* Empty files are used to mask less specific instances
+ * of the same file. */
+ continue;
+ }
+
+ if (virStringListAdd(configs, path) < 0)
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/src/qemu/qemu_configs.h b/src/qemu/qemu_configs.h
new file mode 100644
index 0000000000..6bca21a841
--- /dev/null
+++ b/src/qemu/qemu_configs.h
@@ -0,0 +1,31 @@
+/*
+ * qemu_configs.h: QEMU firmware/vhost-user etc configs
+ *
+ * Copyright (C) 2019 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * .
+ */
+
+#ifndef LIBVIRT_QEMU_CONFIGS_H
+# define LIBVIRT_QEMU_CONFIGS_H
+
+# include "internal.h"
+
+int
+qemuFetchConfigs(const char *name,
+ char ***configs,
+ bool privileged);
+
+#endif /* LIBVIRT_QEMU_CONFIGS_H */
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
index bf29b10b9a..f0a6953d8b 100644
--- a/src/qemu/qemu_firmware.c
+++ b/src/qemu/qemu_firmware.c
@@ -23,13 +23,12 @@
#include
=20
#include "qemu_firmware.h"
+#include "qemu_configs.h"
#include "configmake.h"
#include "qemu_capabilities.h"
#include "qemu_domain.h"
#include "qemu_process.h"
#include "virarch.h"
-#include "virfile.h"
-#include "virhash.h"
#include "virjson.h"
#include "virlog.h"
#include "virstring.h"
@@ -907,150 +906,11 @@ qemuFirmwareFormat(qemuFirmwarePtr fw)
}
=20
=20
-static int
-qemuFirmwareBuildFileList(virHashTablePtr files, const char *dir)
-{
- DIR *dirp;
- struct dirent *ent =3D NULL;
- int rc;
- int ret =3D -1;
-
- if ((rc =3D virDirOpenIfExists(&dirp, dir)) < 0)
- return -1;
-
- if (rc =3D=3D 0)
- return 0;
-
- while ((rc =3D virDirRead(dirp, &ent, dir)) > 0) {
- VIR_AUTOFREE(char *) filename =3D NULL;
- VIR_AUTOFREE(char *) path =3D NULL;
- struct stat sb;
-
- if (STRPREFIX(ent->d_name, "."))
- continue;
-
- if (VIR_STRDUP(filename, ent->d_name) < 0)
- goto cleanup;
-
- if (virAsprintf(&path, "%s/%s", dir, filename) < 0)
- goto cleanup;
-
- if (stat(path, &sb) < 0) {
- virReportSystemError(errno, _("Unable to access %s"), path);
- goto cleanup;
- }
-
- if (!S_ISREG(sb.st_mode) && !S_ISLNK(sb.st_mode))
- continue;
-
- if (virHashUpdateEntry(files, filename, path) < 0)
- goto cleanup;
-
- path =3D NULL;
- }
-
- if (rc < 0)
- goto cleanup;
-
- ret =3D 0;
- cleanup:
- virDirClose(&dirp);
- return ret;
-}
-
-static int
-qemuFirmwareFilesSorter(const virHashKeyValuePair *a,
- const virHashKeyValuePair *b)
-{
- return strcmp(a->key, b->key);
-}
-
-#define QEMU_FIRMWARE_SYSTEM_LOCATION PREFIX "/share/qemu/firmware"
-#define QEMU_FIRMWARE_ETC_LOCATION SYSCONFDIR "/qemu/firmware"
-
int
qemuFirmwareFetchConfigs(char ***firmwares,
bool privileged)
{
- VIR_AUTOPTR(virHashTable) files =3D NULL;
- VIR_AUTOFREE(char *) homeConfig =3D NULL;
- VIR_AUTOFREE(char *) xdgConfig =3D NULL;
- VIR_AUTOFREE(virHashKeyValuePairPtr) pairs =3D NULL;
- virHashKeyValuePairPtr tmp =3D NULL;
-
- *firmwares =3D NULL;
-
- if (!privileged) {
- /* This is a slight divergence from the specification.
- * Since the system daemon runs as root, it doesn't make
- * much sense to parse files in root's home directory. It
- * makes sense only for session daemon which runs under
- * regular user. */
- if (VIR_STRDUP(xdgConfig, virGetEnvBlockSUID("XDG_CONFIG_HOME")) <=
0)
- return -1;
-
- if (!xdgConfig) {
- VIR_AUTOFREE(char *) home =3D virGetUserDirectory();
-
- if (!home)
- return -1;
-
- if (virAsprintf(&xdgConfig, "%s/.config", home) < 0)
- return -1;
- }
-
- if (virAsprintf(&homeConfig, "%s/qemu/firmware", xdgConfig) < 0)
- return -1;
- }
-
- if (!(files =3D virHashCreate(10, virHashValueFree)))
- return -1;
-
- if (qemuFirmwareBuildFileList(files, QEMU_FIRMWARE_SYSTEM_LOCATION) < =
0)
- return -1;
-
- if (qemuFirmwareBuildFileList(files, QEMU_FIRMWARE_ETC_LOCATION) < 0)
- return -1;
-
- if (homeConfig &&
- qemuFirmwareBuildFileList(files, homeConfig) < 0)
- return -1;
-
- /* At this point, the @files hash table contains unique set of filenam=
es
- * where each filename (as key) has the highest priority full pathname
- * associated with it. */
-
- if (virHashSize(files) =3D=3D 0)
- return 0;
-
- if (!(pairs =3D virHashGetItems(files, qemuFirmwareFilesSorter)))
- return -1;
-
- for (tmp =3D pairs; tmp->key; tmp++) {
- const char *path =3D tmp->value;
- off_t len;
-
- if ((len =3D virFileLength(path, -1)) < 0) {
- virReportSystemError(errno,
- _("unable to get size of '%s'"),
- path);
- return -1;
- }
-
- VIR_DEBUG("firmware description path '%s' len=3D%jd",
- path, (intmax_t) len);
-
- if (len =3D=3D 0) {
- /* Empty files are used to mask less specific instances
- * of the same file. */
- continue;
- }
-
- if (virStringListAdd(firmwares, path) < 0)
- return -1;
- }
-
- return 0;
+ return qemuFetchConfigs("firmware", firmwares, privileged);
}
=20
=20
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 17:37:59 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=1559730740; cv=none;
d=zoho.com; s=zohoarc;
b=SnTZrinQ2gXqUsFxmGiRdavc7NRTby1J2Ma42HuPDhTm0qbx3HOlAlVTH96AZ4Yy2dHFABBWBRFQ5+ZH61VXTAbT3DBHPlcGvxTiksNiNnooebl9UJYM8NO7/yl3gsLxiP4qGODhKzQ0VpaAaM2HBs0DIkdsXkEvidDFf4WtoNg=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730740;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=peXrJ2isHtL25d+CFY7Wb2qHGlzu86+QGu127szx4OE=;
b=f/k3ZM52LWq/Y8RXuBTxv43ZbmXIZ0360FR7DTrpALSIk9AQvBsnTrtplEjFA892rQvMihO3qHVdkxRsczX6d7yTV9nPy/AmNyJxz21/lzEhKIY1JGUWhWUj1aFYWKPNYqbS32KEuMadF/nGrE12Xi/QKngBqYyt6YZSK4UeA+g=
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 1559730740175911.8678157271172;
Wed, 5 Jun 2019 03:32:20 -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 50CC285363;
Wed, 5 Jun 2019 10:32:02 +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 044B25D9CD;
Wed, 5 Jun 2019 10:32: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 DCE0B1806B16;
Wed, 5 Jun 2019 10:31:52 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x55AVpSL019959 for ;
Wed, 5 Jun 2019 06:31:51 -0400
Received: by smtp.corp.redhat.com (Postfix)
id B473C22710; Wed, 5 Jun 2019 10:31:51 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id 067AA5F7C0;
Wed, 5 Jun 2019 10:31:46 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:31:03 +0200
Message-Id: <20190605103117.19047-6-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 05/19] domain: add "vhostuser" attribute to virtio
video model
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-Type: text/plain; charset="utf-8"
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.25]);
Wed, 05 Jun 2019 10:32:16 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
Accept a new attribute to specify usage of helper process, ex:
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
docs/formatdomain.html.in | 6 ++++++
docs/schemas/domaincommon.rng | 11 ++++++++++-
src/conf/domain_conf.c | 14 ++++++++++++++
src/conf/domain_conf.h | 1 +
4 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 22ddcb71d3..d2cc8c00b5 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7018,6 +7018,12 @@ qemu-kvm -net nic,model=3D? /dev/null
Attribute vram64 (since 1.3.3=
)
extends secondary bar and makes it addressable as 64bit memory.
+
+ For guest type "kvm" and model type "virtio" there are
+ optional attributes. Attribute vhost-user
+ (since 5.5.0) specify that a
+ vhost-user helper process should be associated with the GPU.
+
=20
acceleration
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 4bd75e3055..e249d5f8f0 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3573,7 +3573,6 @@
vmvgaxenvbox
- virtiogopnone
@@ -3598,6 +3597,16 @@
+
+
+ virtio
+
+
+
+
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 97ba8bd53a..916440256a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15311,6 +15311,7 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xml=
opt,
xmlNodePtr cur;
VIR_XPATH_NODE_AUTORESTORE(ctxt);
VIR_AUTOFREE(char *) type =3D NULL;
+ VIR_AUTOFREE(char *) vhostuser =3D NULL;
VIR_AUTOFREE(char *) heads =3D NULL;
VIR_AUTOFREE(char *) vram =3D NULL;
VIR_AUTOFREE(char *) vram64 =3D NULL;
@@ -15329,6 +15330,7 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xml=
opt,
if (!type && !vram && !ram && !heads &&
virXMLNodeNameEqual(cur, "model")) {
type =3D virXMLPropString(cur, "type");
+ vhostuser =3D virXMLPropString(cur, "vhostuser");
ram =3D virXMLPropString(cur, "ram");
vram =3D virXMLPropString(cur, "vram");
vram64 =3D virXMLPropString(cur, "vram64");
@@ -15361,6 +15363,16 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xm=
lopt,
def->type =3D virDomainVideoDefaultType(dom);
}
=20
+ if (vhostuser !=3D NULL) {
+ if (virStringParseYesNo(vhostuser, &def->vhostuser) < 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown vhostuser value '%s'"), vhostuser);
+ goto cleanup;
+ }
+ } else {
+ def->vhostuser =3D false;
+ }
+
if (ram) {
if (def->type !=3D VIR_DOMAIN_VIDEO_TYPE_QXL) {
virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -26364,6 +26376,8 @@ virDomainVideoDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, " heads=3D'%u'", def->heads);
if (def->primary)
virBufferAddLit(buf, " primary=3D'yes'");
+ if (def->vhostuser)
+ virBufferAddLit(buf, " vhostuser=3D'yes'");
if (def->accel) {
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 4c3ab07062..a62b35b092 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1419,6 +1419,7 @@ struct _virDomainVideoDef {
virDomainVideoDriverDefPtr driver;
virDomainDeviceInfo info;
virDomainVirtioOptionsPtr virtio;
+ bool vhostuser;
};
=20
/* graphics console modes */
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 17:37:59 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=1559730796; cv=none;
d=zoho.com; s=zohoarc;
b=H2siVnY40Scwr7FRbAw5ih2W4m3+s7ylqP4pyq7Nz1uBtqsZSUknaKAm2NjOPs82tnmoFFdaB09J0MQi1yn0MEtlMZYfUWDR03Idg/aQKtABj5vcWhF3SoogFiCQJ2arysxuz2oydF2/PZCom1QK4OodgIw51c4IKnf+8lEGV5I=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730796;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=wcqydVUs+Soyce2MLgSa0CwUtocqpBT/sT7ya2pvdgw=;
b=Jus/wk7Xc2Kqvt7Pz7hkLtaniAkTmq70iuWfA5vy09ZECBLQvgRjxvLCytkJlCgOF2dQI4NDlMelGBa2dlAAw5uddmLEUlAjFOyShrMA3sT8U97H0nBC7j7vBZTPv4WF1f15Kl61cO/dcqvFrsKHVbjc5GqrYXxuIMQLxPCmhP4=
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 1559730796829332.4947005011559;
Wed, 5 Jun 2019 03:33:16 -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 39746C1EB200;
Wed, 5 Jun 2019 10:33:15 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 0BAAE18ACA;
Wed, 5 Jun 2019 10:33:15 +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 BEB481806B15;
Wed, 5 Jun 2019 10:33:14 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com
[10.5.11.15])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x55AVvGm019969 for ;
Wed, 5 Jun 2019 06:31:57 -0400
Received: by smtp.corp.redhat.com (Postfix)
id DE7F45B683; Wed, 5 Jun 2019 10:31:57 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id 5D5195D739;
Wed, 5 Jun 2019 10:31:53 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:31:04 +0200
Message-Id: <20190605103117.19047-7-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 06/19] domain: add rendernode attribute on
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-Type: text/plain; charset="utf-8"
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.32]);
Wed, 05 Jun 2019 10:33:15 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
vhost-user-gpu helper may accept --render-node option to specify on
which GPU should the renderning be done.
(by comparison rendernode is the target/display rendering)
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
docs/formatdomain.html.in | 5 +++++
docs/schemas/domaincommon.rng | 5 +++++
src/conf/domain_conf.c | 19 ++++++++++++++++++-
src/conf/domain_conf.h | 1 +
4 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index d2cc8c00b5..d7f21d0329 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -7038,6 +7038,11 @@ qemu-kvm -net nic,model=3D? /dev/null
Enable 3D acceleration (for vbox driver
since 0.7.1, qemu driver
since 1.3.0)
+
+
rendernode
+
Absolute path to a host's DRI device to be used for
+ rendering (for vhost-user driver only, since 5.5.0)
=20
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index e249d5f8f0..e614ff6f56 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3635,6 +3635,11 @@
+
+
+
+
+
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 916440256a..7a590bd86a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2826,6 +2826,9 @@ virDomainVideoDefClear(virDomainVideoDefPtr def)
=20
virDomainDeviceInfoClear(&def->info);
=20
+ if (def->accel) {
+ VIR_FREE(def->accel->rendernode);
+ }
VIR_FREE(def->accel);
VIR_FREE(def->virtio);
VIR_FREE(def->driver);
@@ -15223,6 +15226,7 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
int val;
VIR_AUTOFREE(char *) accel2d =3D NULL;
VIR_AUTOFREE(char *) accel3d =3D NULL;
+ VIR_AUTOFREE(char *) rendernode =3D NULL;
=20
cur =3D node->children;
while (cur !=3D NULL) {
@@ -15231,12 +15235,13 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
virXMLNodeNameEqual(cur, "acceleration")) {
accel3d =3D virXMLPropString(cur, "accel3d");
accel2d =3D virXMLPropString(cur, "accel2d");
+ rendernode =3D virXMLPropString(cur, "rendernode");
}
}
cur =3D cur->next;
}
=20
- if (!accel3d && !accel2d)
+ if (!accel3d && !accel2d && !rendernode)
return NULL;
=20
if (VIR_ALLOC(def) < 0)
@@ -15260,6 +15265,9 @@ virDomainVideoAccelDefParseXML(xmlNodePtr node)
def->accel2d =3D val;
}
=20
+ if (VIR_STRDUP(def->rendernode, rendernode) < 0)
+ goto cleanup;
+
cleanup:
return def;
}
@@ -15427,6 +15435,11 @@ virDomainVideoDefParseXML(virDomainXMLOptionPtr xm=
lopt,
goto error;
}
}
+ if (!def->vhostuser && def->accel && def->accel->rendernode) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unsupported rendernode accel attribute without v=
host-user'"));
+ goto error;
+ }
=20
if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, flags) < 0)
goto error;
@@ -26330,6 +26343,10 @@ virDomainVideoAccelDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, " accel2d=3D'%s'",
virTristateBoolTypeToString(def->accel2d));
}
+ if (def->rendernode) {
+ virBufferAsprintf(buf, " rendernode=3D'%s'",
+ def->rendernode);
+ }
virBufferAddLit(buf, "/>\n");
}
=20
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index a62b35b092..9f533aa314 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1400,6 +1400,7 @@ VIR_ENUM_DECL(virDomainVideoVGAConf);
struct _virDomainVideoAccelDef {
int accel2d; /* enum virTristateBool */
int accel3d; /* enum virTristateBool */
+ char *rendernode;
};
=20
=20
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 17:37:59 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=1559730808; cv=none;
d=zoho.com; s=zohoarc;
b=BVSeOVeRZXs3OWNsT49b3geQcF/QfrHf05FeYlYdgEHb/2EV7X+n+oqO/Y416xHE6t8KNzfbO9vYHIXRYj+CdOMuyXc+bQWkB9px7CIpe5aMsxV8L0cFmrno8SuLHyrsZWJW86igsH7YnnXsXb6ponTYeaRiiXTZ9dfQRuvkLk8=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730808;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=V8tZ6+9GePKOgO9DR5WPxAKDvJ45BbcaYtLu+zju8Gc=;
b=Bsnf1YsI8Z37RB4yPXcqqbXWuipMI4GVfVtjpysK8JmLoecnxZM9Snq7Mt+otGkNQiiSp4hWyPXsVQWTxRaHU2UvlZtp2Vrhi/a7fDWOPX+PfSEYUG2Z45KBjt11eblzghLDqycyiumreWqou5xKRM0SFtwkICZvpvVyExFzeQg=
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 1559730808014786.669402098773;
Wed, 5 Jun 2019 03:33:28 -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 47D5FC1EB1FC;
Wed, 5 Jun 2019 10:33:26 +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 21B2D6198D;
Wed, 5 Jun 2019 10:33:26 +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 D829D1806B16;
Wed, 5 Jun 2019 10:33:25 +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 x55AW5lw020134 for ;
Wed, 5 Jun 2019 06:32:05 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 6713360C91; Wed, 5 Jun 2019 10:32:05 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id 819FD60CD6;
Wed, 5 Jun 2019 10:31:59 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:31:05 +0200
Message-Id: <20190605103117.19047-8-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 07/19] qemu-cgroup: allow accel rendernode access
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-Type: text/plain; charset="utf-8"
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]);
Wed, 05 Jun 2019 10:33:26 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_cgroup.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index ca76c4fdfa..1627b5ef5d 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -504,6 +504,25 @@ qemuSetupGraphicsCgroup(virDomainObjPtr vm,
}
=20
=20
+static int
+qemuSetupVideoAccelCgroup(virDomainObjPtr vm,
+ const virDomainVideoAccelDefPtr def)
+{
+ qemuDomainObjPrivatePtr priv =3D vm->privateData;
+ int ret;
+
+ if (!def->rendernode ||
+ !virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_DEVICE=
S))
+ return 0;
+
+ ret =3D virCgroupAllowDevicePath(priv->cgroup, def->rendernode,
+ VIR_CGROUP_DEVICE_RW, false);
+ virDomainAuditCgroupPath(vm, priv->cgroup, "allow", def->rendernode,
+ "rw", ret);
+ return ret;
+}
+
+
static int
qemuSetupBlkioCgroup(virDomainObjPtr vm)
{
@@ -804,6 +823,11 @@ qemuSetupDevicesCgroup(virDomainObjPtr vm)
goto cleanup;
}
=20
+ for (i =3D 0; i < vm->def->nvideos; i++) {
+ if (qemuSetupVideoAccelCgroup(vm, vm->def->videos[i]->accel) < 0)
+ goto cleanup;
+ }
+
for (i =3D 0; i < vm->def->ninputs; i++) {
if (qemuSetupInputCgroup(vm, vm->def->inputs[i]) < 0)
goto cleanup;
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 17:37:59 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=1559730821; cv=none;
d=zoho.com; s=zohoarc;
b=Bv9b/wi2O3ZWUeO8sP/eekYPabJnceo4xgl9SXzPe6g5bsHUI0x1jzhbEsc9BnwAo8lAwZqkfgJi164pFkSqoAuNi774UG3EeP0EiDWQ5qZvOQi2ynTHqS6mvQA5VGELcTW//gY++5oZDLeXGzni6UJyme1WZPlZA60Tgy0J9rI=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730821;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=ZKgnjB/fmezvz5mApovo9afAyFjVt++EOi92k9zWPKI=;
b=n8nzBzbps8sqNSlUpvfSRHzGNav6TieVbysuZInw17FRS/gQYuRKPbXQyGAbJP9JvwAYgp/RZvpn/T5Fr+8fVzglursBbVSLql29pX+KtdNhyEjmPnklFqDGBxxwGWxHdtJ4ndumellR57es/mdxeOMJwtIaxiaaCGMMvL8RBfk=
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 1559730821587878.2853344496976;
Wed, 5 Jun 2019 03:33:41 -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 01DA23001478;
Wed, 5 Jun 2019 10:33: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 D111E60CD6;
Wed, 5 Jun 2019 10:33: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 901B78E1F;
Wed, 5 Jun 2019 10:33:39 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com
[10.5.11.22])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x55AWBI5020298 for ;
Wed, 5 Jun 2019 06:32:11 -0400
Received: by smtp.corp.redhat.com (Postfix)
id CC7841001E73; Wed, 5 Jun 2019 10:32:11 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id 3FE0F1001E79;
Wed, 5 Jun 2019 10:32:06 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:31:06 +0200
Message-Id: <20190605103117.19047-9-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 08/19] qemu: add vhost-user-gpu capabilities 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-Type: text/plain; charset="utf-8"
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.43]);
Wed, 05 Jun 2019 10:33:40 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
Those new devices are merged for QEMU 4.1.
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_capabilities.c | 6 ++++++
src/qemu/qemu_capabilities.h | 4 ++++
2 files changed, 10 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index c8d724aed5..e46912cfec 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -526,6 +526,10 @@ VIR_ENUM_IMPL(virQEMUCaps,
"overcommit",
"query-current-machine",
"machine.virt.iommu",
+
+ /* 330 */
+ "vhost-user-gpu",
+ "vhost-user-vga",
);
=20
=20
@@ -1112,6 +1116,8 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[=
] =3D {
{ "virtio-scsi-pci-non-transitional", QEMU_CAPS_VIRTIO_PCI_TRANSITIONA=
L },
{ "virtio-serial-pci-transitional", QEMU_CAPS_VIRTIO_PCI_TRANSITIONAL =
},
{ "virtio-serial-pci-non-transitional", QEMU_CAPS_VIRTIO_PCI_TRANSITIO=
NAL },
+ { "vhost-user-gpu", QEMU_CAPS_DEVICE_VHOST_USER_GPU },
+ { "vhost-user-vga", QEMU_CAPS_DEVICE_VHOST_USER_VGA },
};
=20
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[]=
=3D {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 0f282ad239..3ba8c0afb6 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -509,6 +509,10 @@ typedef enum { /* virQEMUCapsFlags grouping marker for=
syntax-check */
QEMU_CAPS_QUERY_CURRENT_MACHINE, /* query-current-machine command */
QEMU_CAPS_MACHINE_VIRT_IOMMU, /* -machine virt,iommu */
=20
+ /* 330 */
+ QEMU_CAPS_DEVICE_VHOST_USER_GPU, /* -device vhost-user-gpu */
+ QEMU_CAPS_DEVICE_VHOST_USER_VGA, /* -device vhost-user-vga */
+
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
=20
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 17:37:59 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=1559730905; cv=none;
d=zoho.com; s=zohoarc;
b=Mpf4cCwDeZutJoi4zQTULmn2cG8f9k/Yf5dZaqNX0ALP3JmtawS2CASjeXWnWPR7XgKerKajOibw2YOoLs+/IZ2jDSGZIYNAOl7F2hyLZNNbjKnpzSiRff1l1jfmToeOLc0D0sgYKEeNGkvx2HGUoGpvzHWmbZnyJtFSl+/US2Y=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730905;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=ywh/bcC4kU1B//+SlS6cO6goxZ2FAfmE023EEWU6xhg=;
b=fd7GkM8Xq4qdqGlASDyJZ1HuHwp0wIvoW5tZ4CL3wUO1h38t4NW1PduhplE79kNOy2dOz36ZJj4+ciDvFxPLk4d0oOM602/kdTRh0a2qir7LXeZNNsPGKvGhnqxey5lepzVA6/iWy/+sB2nUxxssCpzZfERNsSVbcqqLEwJax6Q=
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 1559730905667242.54093666428446;
Wed, 5 Jun 2019 03:35:05 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com
[10.5.11.22])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id D7CC73078AC6;
Wed, 5 Jun 2019 10:35:03 +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 997D81010F63;
Wed, 5 Jun 2019 10:35: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 412B31806B0F;
Wed, 5 Jun 2019 10:35:03 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com
[10.5.11.22])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x55AWD4Y020308 for ;
Wed, 5 Jun 2019 06:32:13 -0400
Received: by smtp.corp.redhat.com (Postfix)
id B7DBB101E662; Wed, 5 Jun 2019 10:32:13 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id 53C2B101E677;
Wed, 5 Jun 2019 10:32:13 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:31:07 +0200
Message-Id: <20190605103117.19047-10-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 09/19] qemu: check that qemu is vhost-user-vga
capable
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-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]);
Wed, 05 Jun 2019 10:35:04 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
To support virtio VGA with vhost-user, vhost-user-vga device is necessary.
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_domain.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 4d3a8868b2..32722facdd 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11536,9 +11536,13 @@ bool
qemuDomainSupportsVideoVga(virDomainVideoDefPtr video,
virQEMUCapsPtr qemuCaps)
{
- if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_VGA))
- return false;
+ if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
+ if (video->vhostuser) {
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_USER_VGA))
+ return false;
+ } else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_VGA))
+ return false;
+ }
=20
return true;
}
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 17:37:59 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=1559730912; cv=none;
d=zoho.com; s=zohoarc;
b=Y4/oVrKvigZ3AWrd88zwrB37v0u5rAmlvm02SqoepqSCI3YvvTdHKfFrTr+pii7KrAcfM2FRCRDMAYRdcL7TV17glYkaz0OskaLsCNAqXOMaOiwFsHk172ei6EINkP5myYQ3SwkR9T4dkrXOj0gVAzSlrRJ5uu5AKU8P+Xti/fg=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730912;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=4tImC4/CDeBTnurSjKMgoupSQue8bHE1o3bBnCOeCKQ=;
b=E9YFo91ASdNC6lbRI+muLVvh8arBpah/Ra7ANDjasfY2g4p7tki73DBcfRRCcIBeFd1o1BkLVR0v1aUZQcYHYyie8vBKMm3FRsY9zv1u/0QLXhKp4bGpo7sQsGjvKie2TG2s4ySZOMbqwjISbk1LMu8/fFmf4+S5QHMNoT3c2OA=
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 1559730912177663.8774764657596;
Wed, 5 Jun 2019 03:35:12 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com
[10.5.11.16])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 9A28A81128;
Wed, 5 Jun 2019 10:35:10 +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 761375C206;
Wed, 5 Jun 2019 10:35:10 +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 271A6206D3;
Wed, 5 Jun 2019 10:35:10 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com
[10.5.11.16])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x55AWKkS020319 for ;
Wed, 5 Jun 2019 06:32:20 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 230615C206; Wed, 5 Jun 2019 10:32:20 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id 56E835C22C;
Wed, 5 Jun 2019 10:32:14 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:31:08 +0200
Message-Id: <20190605103117.19047-11-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 10/19] qemu: validate virtio-gpu with vhost-user
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-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]);
Wed, 05 Jun 2019 10:35:11 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
Check qemu capability, and accept 3d acceleration. 3d acceleration
support is checked when looking for a suitable vhost-user helper.
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_process.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 42a6271411..f600c4112a 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -5171,8 +5171,10 @@ qemuProcessStartValidateVideo(virDomainObjPtr vm,
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VMWARE_SVGA)) ||
(video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_QXL &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL)) ||
- (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
+ (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && !video->vh=
ostuser &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU)) ||
+ (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && video->vho=
stuser &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_USER_GPU)) ||
(video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
video->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU_CCW))) {
@@ -5182,7 +5184,15 @@ qemuProcessStartValidateVideo(virDomainObjPtr vm,
return -1;
}
=20
- if (video->accel) {
+ if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
+ video->vhostuser &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_USER_GPU)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("this QEMU does not support vhost-user backed=
video device"));
+ return -1;
+ }
+
+ if (!video->vhostuser && video->accel) {
if (video->accel->accel3d =3D=3D VIR_TRISTATE_SWITCH_ON &&
(video->type !=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO ||
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_VIRGL))) {
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 17:37:59 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=1559730829; cv=none;
d=zoho.com; s=zohoarc;
b=ErfaUUayAxXIhGAkJS/KBfbTVPCZ9rqOUnHyAwSugIYUxcx9vlt7kR7pzemi1diRQAdAodZS1ZztaNtZhDYZUKSGtnnEhKdSirlTH/CfpRQ2jP8PrScW6H+kmMcGnP19gAO28FgHjDfSUQkt2r1n3F047efBhNG3iTsE6sLAELw=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730829;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=h9gislmfMDYMlnsOGx5rFquICq0PLgddvLNBlhgGfLg=;
b=imzeOVduNAMLk2a14mjEmKLdHiA7YohGn/77dagPYMNJLKCHiyhP+8mIfVOoPB3SxYrwPJ74Iq3XLBNXVrPy0fhEoNBpM1Zk+3I63ckeZiKThSCdDd+LFXj9I0vmt/vtd+Sm2KqrgxcfmCd14xOaqQSYCweSLMWVgczOk/QD5Zw=
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 155973082941193.44070898741097;
Wed, 5 Jun 2019 03:33:49 -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 B8313223861;
Wed, 5 Jun 2019 10:33: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 90E5A5D9CC;
Wed, 5 Jun 2019 10:33: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 54AE51806B0F;
Wed, 5 Jun 2019 10:33:47 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com
[10.5.11.11])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x55AWQCE020339 for ;
Wed, 5 Jun 2019 06:32:26 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 89E4918A99; Wed, 5 Jun 2019 10:32:26 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id CD464601A5;
Wed, 5 Jun 2019 10:32:21 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:31:09 +0200
Message-Id: <20190605103117.19047-12-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 11/19] qemu: restrict 'virgl=' option to
non-vhostuser video type
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-Type: text/plain; charset="utf-8"
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.39]);
Wed, 05 Jun 2019 10:33:48 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
vhost-user device doesn't have a virgl option, it is passed to the
vhost-user-gpu helper process instead.
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_command.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 59dc134785..0551984a47 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4742,9 +4742,11 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
=20
virBufferAsprintf(&buf, ",id=3D%s", video->info.alias);
=20
- if (video->accel && video->accel->accel3d =3D=3D VIR_TRISTATE_SWITCH_O=
N) {
- virBufferAsprintf(&buf, ",virgl=3D%s",
- virTristateSwitchTypeToString(video->accel->acce=
l3d));
+ if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && !video->vhostus=
er) {
+ if (video->accel && video->accel->accel3d =3D=3D VIR_TRISTATE_SWIT=
CH_ON) {
+ virBufferAsprintf(&buf, ",virgl=3D%s",
+ virTristateSwitchTypeToString(video->accel->=
accel3d));
+ }
}
=20
if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_QXL) {
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 17:37:59 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=1559730774; cv=none;
d=zoho.com; s=zohoarc;
b=eZ87h6CA3e1cMobH0rAvpY6qU9a1ztuWNL9WxiWXfM6r10fFXMQAxRV5IVl0O2CF8SxUMZ88GiUZaUsKPYSZo/dQnanBowmnMNeIML+cnOMd5VDaeIcRUP6RF5NO0/EECJsUjJeXvoyxoQhi2NdBi9A/n2CjezW4+vGPJghpbB0=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730774;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=VsKaUPzi9PybW58OQCJmkPLBFoXtDJtBPptola4z9uo=;
b=GU8I8ElHQbljvYBYg78aOqWWxGGgwtmd6LrVseShwQoJ9Id+bAwuaLl2LzCA3Mqw5HY2Ouf8zpzdygti1zgAhAojSn+nj6hj2xU23wcz9F+0WOHRHE0chBe8maGhTonvc8k/lWwXvhrd7syc1mA0+EVEejrF44zM7INLvURVgxY=
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 1559730774514204.01670166829956;
Wed, 5 Jun 2019 03:32:54 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com
[10.5.11.22])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id E9E0D5F79B;
Wed, 5 Jun 2019 10:32: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 414E41010F63;
Wed, 5 Jun 2019 10:32:45 +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 05DC41806B1A;
Wed, 5 Jun 2019 10:32:44 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com
[10.5.11.13])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x55AWX7Y020350 for ;
Wed, 5 Jun 2019 06:32:33 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 19F862C8C9; Wed, 5 Jun 2019 10:32:33 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id 324F45F7C0;
Wed, 5 Jun 2019 10:32:27 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:31:10 +0200
Message-Id: <20190605103117.19047-13-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 12/19] qemu: add vhost-user helpers
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-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]);
Wed, 05 Jun 2019 10:32:53 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
Add qemuVhostUserFetchConfigs() to discover vhost-user helpers.
qemuVhostUserFillDomainGPU() will find the first matching GPU helper
with the required capabilities and set the associated
vhost_user_binary.
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/conf/device_conf.c | 1 +
src/conf/device_conf.h | 1 +
src/qemu/Makefile.inc.am | 2 +
src/qemu/qemu_vhost_user.c | 395 ++++++++++++++++++
src/qemu/qemu_vhost_user.h | 51 +++
tests/Makefile.am | 9 +
.../etc/qemu/vhost-user/40-gpu.json | 1 +
.../etc/qemu/vhost-user/50-gpu.json | 0
.../qemu/vhost-user/test-vhost-user-gpu | 11 +
.../usr/share/qemu/vhost-user/30-gpu.json | 1 +
.../usr/share/qemu/vhost-user/50-gpu.json | 8 +
.../usr/share/qemu/vhost-user/60-gpu.json | 1 +
tests/qemuvhostusertest.c | 132 ++++++
13 files changed, 613 insertions(+)
create mode 100644 src/qemu/qemu_vhost_user.c
create mode 100644 src/qemu/qemu_vhost_user.h
create mode 120000 tests/qemuvhostuserdata/etc/qemu/vhost-user/40-gpu.json
create mode 100644 tests/qemuvhostuserdata/etc/qemu/vhost-user/50-gpu.json
create mode 100755 tests/qemuvhostuserdata/usr/libexec/qemu/vhost-user/tes=
t-vhost-user-gpu
create mode 120000 tests/qemuvhostuserdata/usr/share/qemu/vhost-user/30-gp=
u.json
create mode 100644 tests/qemuvhostuserdata/usr/share/qemu/vhost-user/50-gp=
u.json
create mode 120000 tests/qemuvhostuserdata/usr/share/qemu/vhost-user/60-gp=
u.json
create mode 100644 tests/qemuvhostusertest.c
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index b28f30dfc5..c429791933 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -96,6 +96,7 @@ virDomainDeviceInfoClear(virDomainDeviceInfoPtr info)
VIR_FREE(info->loadparm);
info->isolationGroup =3D 0;
info->isolationGroupLocked =3D false;
+ VIR_FREE(info->vhost_user_binary);
}
=20
void
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index 54db244f0e..75a3ae8c5c 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -180,6 +180,7 @@ struct _virDomainDeviceInfo {
* cases we might want to prevent that from happening by
* locking the isolation group */
bool isolationGroupLocked;
+ char *vhost_user_binary;
};
=20
void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info);
diff --git a/src/qemu/Makefile.inc.am b/src/qemu/Makefile.inc.am
index d3ef6b865c..fdbcbc2413 100644
--- a/src/qemu/Makefile.inc.am
+++ b/src/qemu/Makefile.inc.am
@@ -62,6 +62,8 @@ QEMU_DRIVER_SOURCES =3D \
qemu/qemu_qapi.h \
qemu/qemu_tpm.c \
qemu/qemu_tpm.h \
+ qemu/qemu_vhost_user.c \
+ qemu/qemu_vhost_user.h \
$(NULL)
=20
=20
diff --git a/src/qemu/qemu_vhost_user.c b/src/qemu/qemu_vhost_user.c
new file mode 100644
index 0000000000..4527dab7d3
--- /dev/null
+++ b/src/qemu/qemu_vhost_user.c
@@ -0,0 +1,395 @@
+/*
+ * qemu_vhost_user.c: QEMU vhost-user
+ *
+ * Copyright (C) 2019 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * .
+ */
+
+#include
+
+#include "qemu_vhost_user.h"
+#include "qemu_configs.h"
+#include "virjson.h"
+#include "virlog.h"
+#include "virstring.h"
+#include "viralloc.h"
+#include "virenum.h"
+
+#define VIR_FROM_THIS VIR_FROM_QEMU
+
+VIR_LOG_INIT("qemu.qemu_vhost_user");
+
+typedef enum {
+ QEMU_VHOST_USER_TYPE_NONE =3D 0,
+ QEMU_VHOST_USER_TYPE_9P,
+ QEMU_VHOST_USER_TYPE_BALLOON,
+ QEMU_VHOST_USER_TYPE_BLOCK,
+ QEMU_VHOST_USER_TYPE_CAIF,
+ QEMU_VHOST_USER_TYPE_CONSOLE,
+ QEMU_VHOST_USER_TYPE_CRYPTO,
+ QEMU_VHOST_USER_TYPE_GPU,
+ QEMU_VHOST_USER_TYPE_INPUT,
+ QEMU_VHOST_USER_TYPE_NET,
+ QEMU_VHOST_USER_TYPE_RNG,
+ QEMU_VHOST_USER_TYPE_RPMSG,
+ QEMU_VHOST_USER_TYPE_RPROC_SERIAL,
+ QEMU_VHOST_USER_TYPE_SCSI,
+ QEMU_VHOST_USER_TYPE_VSOCK,
+
+ QEMU_VHOST_USER_TYPE_LAST
+} qemuVhostUserType;
+
+VIR_ENUM_DECL(qemuVhostUserType);
+VIR_ENUM_IMPL(qemuVhostUserType,
+ QEMU_VHOST_USER_TYPE_LAST,
+ "",
+ "9p",
+ "balloon",
+ "block",
+ "caif",
+ "console",
+ "crypto",
+ "gpu",
+ "input",
+ "net",
+ "rng",
+ "rpmsg",
+ "rproc-serial",
+ "scsi",
+ "vsock",
+);
+
+typedef enum {
+ QEMU_VHOST_USER_GPU_FEATURE_NONE =3D 0,
+ QEMU_VHOST_USER_GPU_FEATURE_VIRGL,
+ QEMU_VHOST_USER_GPU_FEATURE_RENDER_NODE,
+
+ QEMU_VHOST_USER_GPU_FEATURE_LAST
+} qemuVhostUserGPUFeature;
+
+VIR_ENUM_DECL(qemuVhostUserGPUFeature);
+VIR_ENUM_IMPL(qemuVhostUserGPUFeature,
+ QEMU_VHOST_USER_GPU_FEATURE_LAST,
+ "",
+ "virgl",
+ "render-node",
+);
+
+typedef struct _qemuVhostUserGPU qemuVhostUserGPU;
+typedef qemuVhostUserGPU *qemuVhostUserGPUPtr;
+struct _qemuVhostUserGPU {
+ size_t nfeatures;
+ qemuVhostUserGPUFeature *features;
+};
+
+struct _qemuVhostUser {
+ /* Description intentionally not parsed. */
+ qemuVhostUserType type;
+ char *binary;
+ /* Tags intentionally not parsed. */
+
+ union {
+ qemuVhostUserGPU gpu;
+ } capabilities;
+};
+
+static void
+qemuVhostUserGPUFeatureFree(qemuVhostUserGPUFeature *features)
+{
+ VIR_FREE(features);
+}
+
+
+VIR_DEFINE_AUTOPTR_FUNC(qemuVhostUserGPUFeature, qemuVhostUserGPUFeatureFr=
ee);
+
+void
+qemuVhostUserFree(qemuVhostUserPtr vu)
+{
+ if (!vu)
+ return;
+
+ if (vu->type =3D=3D QEMU_VHOST_USER_TYPE_GPU) {
+ VIR_FREE(vu->capabilities.gpu.features);
+ }
+
+ VIR_FREE(vu->binary);
+
+ VIR_FREE(vu);
+}
+
+/* 1MiB should be enough for everybody (TM) */
+#define DOCUMENT_SIZE (1024 * 1024)
+
+static int
+qemuVhostUserTypeParse(const char *path,
+ virJSONValuePtr doc,
+ qemuVhostUserPtr vu)
+{
+ const char *type =3D virJSONValueObjectGetString(doc, "type");
+ int tmp;
+
+ VIR_DEBUG("vhost-user description path '%s' type : %s",
+ path, type);
+
+ if ((tmp =3D qemuVhostUserTypeTypeFromString(type)) <=3D 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown vhost-user type: '%s'"),
+ type);
+ return -1;
+ }
+
+ vu->type =3D tmp;
+
+ return 0;
+}
+
+static int
+qemuVhostUserBinaryParse(const char *path,
+ virJSONValuePtr doc,
+ qemuVhostUserPtr vu)
+{
+ const char *binary =3D virJSONValueObjectGetString(doc, "binary");
+
+ VIR_DEBUG("vhost-user description path '%s' binary : %s",
+ path, binary);
+
+ if (VIR_STRDUP(vu->binary, binary) < 0)
+ return -1;
+
+ return 0;
+}
+
+qemuVhostUserPtr
+qemuVhostUserParse(const char *path)
+{
+ VIR_AUTOFREE(char *) cont =3D NULL;
+ VIR_AUTOPTR(virJSONValue) doc =3D NULL;
+ VIR_AUTOPTR(qemuVhostUser) vu =3D NULL;
+ qemuVhostUserPtr ret =3D NULL;
+
+ if (virFileReadAll(path, DOCUMENT_SIZE, &cont) < 0)
+ return NULL;
+
+ if (!(doc =3D virJSONValueFromString(cont))) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unable to parse json file '%s'"),
+ path);
+ return NULL;
+ }
+
+ if (VIR_ALLOC(vu) < 0)
+ return NULL;
+
+ if (qemuVhostUserTypeParse(path, doc, vu) < 0)
+ return NULL;
+
+ if (qemuVhostUserBinaryParse(path, doc, vu) < 0)
+ return NULL;
+
+ VIR_STEAL_PTR(ret, vu);
+ return ret;
+}
+
+char *
+qemuVhostUserFormat(qemuVhostUserPtr vu)
+{
+ VIR_AUTOPTR(virJSONValue) doc =3D NULL;
+
+ if (!vu)
+ return NULL;
+
+ if (!(doc =3D virJSONValueNewObject()))
+ return NULL;
+
+ if (virJSONValueObjectAppendString(doc, "type",
+ qemuVhostUserTypeTypeToString(vu->t=
ype)) < 0)
+ return NULL;
+
+ if (virJSONValueObjectAppendString(doc, "binary", vu->binary) < 0)
+ return NULL;
+
+ return virJSONValueToString(doc, true);
+}
+
+int
+qemuVhostUserFetchConfigs(char ***configs,
+ bool privileged)
+{
+ return qemuFetchConfigs("vhost-user", configs, privileged);
+}
+
+static ssize_t
+qemuVhostUserFetchParsedConfigs(bool privileged,
+ qemuVhostUserPtr **vhostuserRet,
+ char ***pathsRet)
+{
+ VIR_AUTOSTRINGLIST paths =3D NULL;
+ size_t npaths;
+ qemuVhostUserPtr *vus =3D NULL;
+ size_t i;
+
+ if (qemuVhostUserFetchConfigs(&paths, privileged) < 0)
+ return -1;
+
+ npaths =3D virStringListLength((const char **)paths);
+
+ if (VIR_ALLOC_N(vus, npaths) < 0)
+ return -1;
+
+ for (i =3D 0; i < npaths; i++) {
+ if (!(vus[i] =3D qemuVhostUserParse(paths[i])))
+ goto error;
+ }
+
+ VIR_STEAL_PTR(*vhostuserRet, vus);
+ if (pathsRet)
+ VIR_STEAL_PTR(*pathsRet, paths);
+ return npaths;
+
+error:
+ while (i > 0)
+ qemuVhostUserFree(vus[--i]);
+ VIR_FREE(vus);
+ return -1;
+}
+
+
+static int
+qemuVhostUserGPUFillCapabilities(qemuVhostUserPtr vu,
+ virJSONValuePtr doc)
+{
+ qemuVhostUserGPUPtr gpu =3D &vu->capabilities.gpu;
+ virJSONValuePtr featuresJSON;
+ size_t nfeatures;
+ size_t i;
+ VIR_AUTOPTR(qemuVhostUserGPUFeature) features =3D NULL;
+
+ if (!(featuresJSON =3D virJSONValueObjectGetArray(doc, "features"))) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("failed to get features from '%s'"),
+ vu->binary);
+ return -1;
+ }
+
+ nfeatures =3D virJSONValueArraySize(featuresJSON);
+ if (VIR_ALLOC_N(features, nfeatures) < 0)
+ return -1;
+
+ for (i =3D 0; i < nfeatures; i++) {
+ virJSONValuePtr item =3D virJSONValueArrayGet(featuresJSON, i);
+ const char *tmpStr =3D virJSONValueGetString(item);
+ int tmp;
+
+ if ((tmp =3D qemuVhostUserGPUFeatureTypeFromString(tmpStr)) <=3D 0=
) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unknown feature %s"),
+ tmpStr);
+ continue;
+ }
+
+ features[i] =3D tmp;
+ }
+
+ VIR_STEAL_PTR(gpu->features, features);
+ gpu->nfeatures =3D nfeatures;
+
+ return 0;
+}
+
+
+static bool
+qemuVhostUserGPUHasFeature(qemuVhostUserGPUPtr gpu,
+ qemuVhostUserGPUFeature feature)
+{
+ size_t i;
+
+ for (i =3D 0; i < gpu->nfeatures; i++) {
+ if (gpu->features[i] =3D=3D feature)
+ return true;
+ }
+
+ return false;
+}
+
+
+int
+qemuVhostUserFillDomainGPU(virQEMUDriverPtr driver,
+ virDomainVideoDefPtr video)
+{
+ qemuVhostUserPtr *vus =3D NULL;
+ ssize_t nvus =3D 0;
+ ssize_t i;
+ int ret =3D -1;
+
+ if ((nvus =3D qemuVhostUserFetchParsedConfigs(driver->privileged,
+ &vus, NULL)) < 0)
+ goto end;
+
+ for (i =3D 0; i < nvus; i++) {
+ qemuVhostUserPtr vu =3D vus[i];
+ VIR_AUTOPTR(virJSONValue) doc =3D NULL;
+ VIR_AUTOFREE(char *) output =3D NULL;
+ VIR_AUTOPTR(virCommand) cmd =3D NULL;
+
+ if (vu->type !=3D QEMU_VHOST_USER_TYPE_GPU)
+ continue;
+
+ cmd =3D virCommandNewArgList(vu->binary, "--print-capabilities", N=
ULL);
+ virCommandSetOutputBuffer(cmd, &output);
+ if (virCommandRun(cmd, NULL) < 0)
+ continue;
+
+ if (!(doc =3D virJSONValueFromString(output))) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("unable to parse json capabilities '%s'"),
+ vu->binary);
+ continue;
+ }
+
+ if (qemuVhostUserGPUFillCapabilities(vu, doc) < 0)
+ continue;
+
+ if (video->accel) {
+ if (video->accel->accel3d &&
+ !qemuVhostUserGPUHasFeature(&vu->capabilities.gpu,
+ QEMU_VHOST_USER_GPU_FEATURE_VI=
RGL))
+ continue;
+
+ if (video->accel->rendernode &&
+ !qemuVhostUserGPUHasFeature(&vu->capabilities.gpu,
+ QEMU_VHOST_USER_GPU_FEATURE_RE=
NDER_NODE))
+ continue;
+ }
+
+ VIR_FREE(video->info.vhost_user_binary);
+ if (VIR_STRDUP(video->info.vhost_user_binary, vu->binary) < 0)
+ goto end;
+
+ ret =3D 0;
+ break;
+ }
+
+ if (i =3D=3D nvus) {
+ virReportError(VIR_ERR_OPERATION_FAILED,
+ _("Unable to find a satisfying vhost-user-gpu"));
+ }
+
+end:
+ for (i =3D 0; i < nvus; i++)
+ qemuVhostUserFree(vus[i]);
+ VIR_FREE(vus);
+ return ret;
+}
diff --git a/src/qemu/qemu_vhost_user.h b/src/qemu/qemu_vhost_user.h
new file mode 100644
index 0000000000..ff0d0d4f5c
--- /dev/null
+++ b/src/qemu/qemu_vhost_user.h
@@ -0,0 +1,51 @@
+/*
+ * qemu_vhost_user.h: QEMU vhost-user
+ *
+ * Copyright (C) 2019 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * .
+ */
+
+#ifndef LIBVIRT_QEMU_VHOST_USER_H
+# define LIBVIRT_QEMU_VHOST_USER_H
+
+# include "domain_conf.h"
+# include "qemu_conf.h"
+# include "virautoclean.h"
+# include "virarch.h"
+
+typedef struct _qemuVhostUser qemuVhostUser;
+typedef qemuVhostUser *qemuVhostUserPtr;
+
+void
+qemuVhostUserFree(qemuVhostUserPtr fw);
+
+VIR_DEFINE_AUTOPTR_FUNC(qemuVhostUser, qemuVhostUserFree);
+
+qemuVhostUserPtr
+qemuVhostUserParse(const char *path);
+
+char *
+qemuVhostUserFormat(qemuVhostUserPtr fw);
+
+int
+qemuVhostUserFetchConfigs(char ***configs,
+ bool privileged);
+
+int
+qemuVhostUserFillDomainGPU(virQEMUDriverPtr driver,
+ virDomainVideoDefPtr video);
+
+#endif /* LIBVIRT_QEMU_VHOST_USER_H */
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6b17d99501..0f2c870380 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -284,6 +284,7 @@ test_programs +=3D qemuxml2argvtest qemuxml2xmltest \
qemumigparamstest \
qemusecuritytest \
qemufirmwaretest \
+ qemuvhostusertest \
$(NULL)
test_helpers +=3D qemucapsprobe
test_libraries +=3D libqemumonitortestutils.la \
@@ -694,6 +695,13 @@ qemufirmwaretest_SOURCES =3D \
$(NULL)
qemufirmwaretest_LDADD =3D $(qemu_LDADDS) $(LDADDS)
=20
+qemuvhostusertest_SOURCES =3D \
+ qemuvhostusertest.c \
+ testutils.h testutils.c \
+ virfilewrapper.c virfilewrapper.h \
+ $(NULL)
+qemuvhostusertest_LDADD =3D $(qemu_LDADDS) $(LDADDS)
+
else ! WITH_QEMU
EXTRA_DIST +=3D qemuxml2argvtest.c qemuxml2xmltest.c qemuargv2xmltest.c \
domainsnapshotxml2xmltest.c \
@@ -708,6 +716,7 @@ EXTRA_DIST +=3D qemuxml2argvtest.c qemuxml2xmltest.c qe=
muargv2xmltest.c \
qemusecuritytest.c qemusecuritytest.h \
qemusecuritymock.c \
qemufirmwaretest.c \
+ qemuvhostusertest.c \
$(QEMUMONITORTESTUTILS_SOURCES)
endif ! WITH_QEMU
=20
diff --git a/tests/qemuvhostuserdata/etc/qemu/vhost-user/40-gpu.json b/test=
s/qemuvhostuserdata/etc/qemu/vhost-user/40-gpu.json
new file mode 120000
index 0000000000..aa93864aa7
--- /dev/null
+++ b/tests/qemuvhostuserdata/etc/qemu/vhost-user/40-gpu.json
@@ -0,0 +1 @@
+../../../usr/share/qemu/vhost-user/50-gpu.json
\ No newline at end of file
diff --git a/tests/qemuvhostuserdata/etc/qemu/vhost-user/50-gpu.json b/test=
s/qemuvhostuserdata/etc/qemu/vhost-user/50-gpu.json
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/tests/qemuvhostuserdata/usr/libexec/qemu/vhost-user/test-vhost=
-user-gpu b/tests/qemuvhostuserdata/usr/libexec/qemu/vhost-user/test-vhost-=
user-gpu
new file mode 100755
index 0000000000..a2c2ee0713
--- /dev/null
+++ b/tests/qemuvhostuserdata/usr/libexec/qemu/vhost-user/test-vhost-user-g=
pu
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+cat <
+
+#include
+
+#include "testutils.h"
+#include "virfilewrapper.h"
+#include "qemu/qemu_vhost_user.h"
+#include "configmake.h"
+
+#define VIR_FROM_THIS VIR_FROM_QEMU
+
+/* A very basic test. Parse given JSON vhostuser description into
+ * an internal structure, format it back and compare with the
+ * contents of the file (minus some keys that are not parsed).
+ */
+static int
+testParseFormatVU(const void *opaque)
+{
+ const char *filename =3D opaque;
+ VIR_AUTOFREE(char *) path =3D NULL;
+ VIR_AUTOPTR(qemuVhostUser) vu =3D NULL;
+ VIR_AUTOFREE(char *) buf =3D NULL;
+ VIR_AUTOPTR(virJSONValue) json =3D NULL;
+ VIR_AUTOFREE(char *) expected =3D NULL;
+ VIR_AUTOFREE(char *) actual =3D NULL;
+
+ if (virAsprintf(&path, "%s/qemuvhostuserdata/%s",
+ abs_srcdir, filename) < 0)
+ return -1;
+
+ if (!(vu =3D qemuVhostUserParse(path)))
+ return -1;
+
+ if (virFileReadAll(path,
+ 1024 * 1024, /* 1MiB */
+ &buf) < 0)
+ return -1;
+
+ if (!(json =3D virJSONValueFromString(buf)))
+ return -1;
+
+ /* Description and tags are not parsed. */
+ if (virJSONValueObjectRemoveKey(json, "description", NULL) < 0 ||
+ virJSONValueObjectRemoveKey(json, "tags", NULL) < 0)
+ return -1;
+
+ if (!(expected =3D virJSONValueToString(json, true)))
+ return -1;
+
+ if (!(actual =3D qemuVhostUserFormat(vu)))
+ return -1;
+
+ return virTestCompareToString(expected, actual);
+}
+
+
+static int
+testVUPrecedence(const void *opaque ATTRIBUTE_UNUSED)
+{
+ VIR_AUTOFREE(char *) fakehome =3D NULL;
+ VIR_AUTOSTRINGLIST vuList =3D NULL;
+ size_t nvuList;
+ size_t i;
+ const char *expected[] =3D {
+ PREFIX "/share/qemu/vhost-user/30-gpu.json",
+ SYSCONFDIR "/qemu/vhost-user/40-gpu.json",
+ PREFIX "/share/qemu/vhost-user/60-gpu.json",
+ };
+ const size_t nexpected =3D ARRAY_CARDINALITY(expected);
+
+ if (VIR_STRDUP(fakehome, abs_srcdir "/qemuvhostuserdata/home/user/.con=
fig") < 0)
+ return -1;
+
+ setenv("XDG_CONFIG_HOME", fakehome, 1);
+
+ if (qemuVhostUserFetchConfigs(&vuList, false) < 0)
+ return -1;
+
+ if (!vuList) {
+ fprintf(stderr, "Expected a non-NULL result, but got a NULL result=
\n");
+ return -1;
+ }
+
+ nvuList =3D virStringListLength((const char **)vuList);
+
+ for (i =3D 0; i < MAX(nvuList, nexpected); i++) {
+ const char *e =3D i < nexpected ? expected[i] : NULL;
+ const char *f =3D i < nvuList ? vuList[i] : NULL;
+
+ if (STRNEQ_NULLABLE(e, f)) {
+ fprintf(stderr,
+ "Unexpected path (i=3D%zu). Expected %s got %s \n",
+ i, NULLSTR(e), NULLSTR(f));
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+
+static int
+mymain(void)
+{
+ int ret =3D 0;
+
+ virFileWrapperAddPrefix(SYSCONFDIR "/qemu/vhost-user",
+ abs_srcdir "/qemuvhostuserdata/etc/qemu/vhost-=
user");
+ virFileWrapperAddPrefix(PREFIX "/share/qemu/vhost-user",
+ abs_srcdir "/qemuvhostuserdata/usr/share/qemu/=
vhost-user");
+ virFileWrapperAddPrefix("/home/user/.config/qemu/vhost-user",
+ abs_srcdir "/qemuvhostuserdata/home/user/.conf=
ig/qemu/vhost-user");
+
+#define DO_PARSE_TEST(filename) \
+ do { \
+ if (virTestRun("QEMU vhost-user " filename, \
+ testParseFormatVU, filename) < 0) \
+ ret =3D -1; \
+ } while (0)
+
+ DO_PARSE_TEST("usr/share/qemu/vhost-user/50-gpu.json");
+
+ if (virTestRun("QEMU vhost-user precedence test", testVUPrecedence, NU=
LL) < 0)
+ ret =3D -1;
+
+ virFileWrapperClearPrefixes();
+
+ return ret =3D=3D 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+
+
+VIR_TEST_MAIN(mymain)
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 17:37:59 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=1559730847; cv=none;
d=zoho.com; s=zohoarc;
b=exdmW8AGiHD57WPiE8H34AyJ/OzpRQZxCgZKViuWmkBZcbOAbesY5iS+rjfyHt3Ilak+UoleWv+vJILxMoGu2Gw31l22iGfv2rD/E2pscjw3JweDZhM9+XCEv9hLW8st8+CQ6VrUC5StlDSQ4dt0O6hfZMEcVBBE1ovUpzNOF0c=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730847;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=3lUJfcnheWCmU+H7Tx3zXRGphbs7koiwtSZ2yRtximQ=;
b=bGesjwKjm4490g3SnHeiZtFWhSfgaCBNHOM8vER4Cjv14GFJ5HwRi7fbSxWc4iHnML8KoW7S4I4fKqEAV6ZHpj3IUtIy9eAhsK1pYXNEwr3JbETNaSDZyvc+zr4kl9NlHqIdGrrIYMc++dmgybJCuBEb5Kav5/unV4ry36nOKrg=
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 1559730847462448.9794625214954;
Wed, 5 Jun 2019 03:34:07 -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 C111430860D1;
Wed, 5 Jun 2019 10:34:05 +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 99B3061984;
Wed, 5 Jun 2019 10:34:05 +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 539EA24AFA;
Wed, 5 Jun 2019 10:34:05 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com
[10.5.11.22])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x55AWdIU020370 for ;
Wed, 5 Jun 2019 06:32:39 -0400
Received: by smtp.corp.redhat.com (Postfix)
id C65341010F63; Wed, 5 Jun 2019 10:32:39 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id C30F11001E81;
Wed, 5 Jun 2019 10:32:34 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:31:11 +0200
Message-Id: <20190605103117.19047-14-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 13/19] qemu: add qemuSecurityStartVhostUserGPU
helper
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-Type: text/plain; charset="utf-8"
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.44]);
Wed, 05 Jun 2019 10:34:06 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
See function documentation. Used in a following patch.
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_security.c | 48 ++++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_security.h | 6 +++++
2 files changed, 54 insertions(+)
diff --git a/src/qemu/qemu_security.c b/src/qemu/qemu_security.c
index 229581a757..8eba7829ca 100644
--- a/src/qemu/qemu_security.c
+++ b/src/qemu/qemu_security.c
@@ -414,6 +414,54 @@ qemuSecurityRestoreChardevLabel(virQEMUDriverPtr drive=
r,
}
=20
=20
+/*
+ * qemuSecurityStartVhostUserGPU:
+ *
+ * @driver: the QEMU driver
+ * @vm: the domain object
+ * @cmd: the command to run
+ * @existstatus: pointer to int returning exit status of process
+ * @cmdret: pointer to int returning result of virCommandRun
+ *
+ * Start the vhost-user-gpu process with approriate labels.
+ * This function returns -1 on security setup error, 0 if all the
+ * setup was done properly. In case the virCommand failed to run
+ * 0 is returned but cmdret is set appropriately with the process
+ * exitstatus also set.
+ */
+int
+qemuSecurityStartVhostUserGPU(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ virCommandPtr cmd,
+ int *exitstatus,
+ int *cmdret)
+{
+ int ret =3D -1;
+
+ if (virSecurityManagerSetChildProcessLabel(driver->securityManager,
+ vm->def, cmd) < 0)
+ goto cleanup;
+
+ if (virSecurityManagerPreFork(driver->securityManager) < 0)
+ goto cleanup;
+
+ ret =3D 0;
+
+ *cmdret =3D virCommandRun(cmd, exitstatus);
+
+ virSecurityManagerPostFork(driver->securityManager);
+
+ if (*cmdret < 0)
+ goto cleanup;
+
+ return 0;
+
+cleanup:
+
+ return ret;
+}
+
+
/*
* qemuSecurityStartTPMEmulator:
*
diff --git a/src/qemu/qemu_security.h b/src/qemu/qemu_security.h
index 546a66f284..c1908b070c 100644
--- a/src/qemu/qemu_security.h
+++ b/src/qemu/qemu_security.h
@@ -74,6 +74,12 @@ int qemuSecurityRestoreChardevLabel(virQEMUDriverPtr dri=
ver,
virDomainObjPtr vm,
virDomainChrDefPtr chr);
=20
+int qemuSecurityStartVhostUserGPU(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ virCommandPtr cmd,
+ int *exitstatus,
+ int *cmdret);
+
int qemuSecurityStartTPMEmulator(virQEMUDriverPtr driver,
virDomainObjPtr vm,
virCommandPtr cmd,
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 17:37:59 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=1559730789; cv=none;
d=zoho.com; s=zohoarc;
b=JUIc7BXvQH3/15cONTj5UrTKw5fT9LFb40XjHLS1qW0va5Xm/yy7+BEODDGLAInbVODY/nSpyM80a1wr5qqUMF9h5U3tu0m8qRATVv2lFCIXXy4fGxCwWMuI1Sk93kn/ad4optnYg2L2eltdH9nPko8EsgNaLPkI2Dm+QMGkEw8=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730789;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=5nPWPPp3heToQvCis9wxR25fJxTsdurBJYMpGmflfPs=;
b=j2LU1vXTAD0XMNS05ubx0+Hb3+YhyoN059rvlzO8CCMUIS+agoqwHdDxEZ2trizTdvLmjxBwZ3wiuIeOr6Tk0hZpr4FUN57TcCAhTCA4Rxs4eAW32IcSsgqA2KIE91TdYwJ0niLEWRV3M4osxf7sdmt9d20NleAkobe1t5TRntQ=
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 1559730789494669.8482701129325;
Wed, 5 Jun 2019 03:33:09 -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 AD639A3B5F;
Wed, 5 Jun 2019 10:33:07 +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 83EAE1B454;
Wed, 5 Jun 2019 10:33:05 +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 47C40206D7;
Wed, 5 Jun 2019 10:33:05 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com
[10.5.11.15])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x55AWkbV020384 for ;
Wed, 5 Jun 2019 06:32:46 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 577D85B68B; Wed, 5 Jun 2019 10:32:46 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id 8670A5D739;
Wed, 5 Jun 2019 10:32:41 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:31:12 +0200
Message-Id: <20190605103117.19047-15-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 14/19] qemu: add vhost-user-gpu helper unit
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-Type: text/plain; charset="utf-8"
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.30]);
Wed, 05 Jun 2019 10:33:08 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
Similar to the qemu_tpm.c, add a unit with a few functions to
start/stop and setup the cgroup of the external vhost-user-gpu
process. See function documentation.
Since the vhost-user connection fd isn't necessarily specific to QEMU,
it was easier to add it to virDomainDeviceInfo, although a reasonable
place could be qemuDomainObjPrivate (with an associate hashtable
device-info -> qemu-device-info for example).
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/conf/device_conf.h | 1 +
src/qemu/Makefile.inc.am | 2 +
src/qemu/qemu_vhost_user_gpu.c | 307 +++++++++++++++++++++++++++++++++
src/qemu/qemu_vhost_user_gpu.h | 54 ++++++
4 files changed, 364 insertions(+)
create mode 100644 src/qemu/qemu_vhost_user_gpu.c
create mode 100644 src/qemu/qemu_vhost_user_gpu.h
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index 75a3ae8c5c..aea6b1c707 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -181,6 +181,7 @@ struct _virDomainDeviceInfo {
* locking the isolation group */
bool isolationGroupLocked;
char *vhost_user_binary;
+ int vhost_user_fd;
};
=20
void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info);
diff --git a/src/qemu/Makefile.inc.am b/src/qemu/Makefile.inc.am
index fdbcbc2413..a95005eb6f 100644
--- a/src/qemu/Makefile.inc.am
+++ b/src/qemu/Makefile.inc.am
@@ -64,6 +64,8 @@ QEMU_DRIVER_SOURCES =3D \
qemu/qemu_tpm.h \
qemu/qemu_vhost_user.c \
qemu/qemu_vhost_user.h \
+ qemu/qemu_vhost_user_gpu.c \
+ qemu/qemu_vhost_user_gpu.h \
$(NULL)
=20
=20
diff --git a/src/qemu/qemu_vhost_user_gpu.c b/src/qemu/qemu_vhost_user_gpu.c
new file mode 100644
index 0000000000..c16c06e1be
--- /dev/null
+++ b/src/qemu/qemu_vhost_user_gpu.c
@@ -0,0 +1,307 @@
+/*
+ * qemu_vhost_user_gpu.c: QEMU vhost-user GPU support
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * .
+ *
+ * Author: Marc-Andr=C3=A9 Lureau
+ */
+
+#include
+
+#include "qemu_vhost_user_gpu.h"
+#include "qemu_vhost_user.h"
+#include "qemu_extdevice.h"
+
+#include "conf/domain_conf.h"
+#include "configmake.h"
+#include "vircommand.h"
+#include "viralloc.h"
+#include "virlog.h"
+#include "virutil.h"
+#include "virfile.h"
+#include "virstring.h"
+#include "virtime.h"
+#include "virpidfile.h"
+
+#define VIR_FROM_THIS VIR_FROM_NONE
+
+VIR_LOG_INIT("qemu.vhost-user-gpu");
+
+
+static char *
+qemuVhostUserGPUCreatePidFilename(const char *stateDir,
+ const char *shortName,
+ const char *alias)
+{
+ char *pidfile =3D NULL;
+ char *devicename =3D NULL;
+
+ if (virAsprintf(&devicename, "%s-%s-vhost-user-gpu", shortName, alias)=
< 0)
+ return NULL;
+
+ pidfile =3D virPidFileBuildPath(stateDir, devicename);
+
+ VIR_FREE(devicename);
+
+ return pidfile;
+}
+
+
+/*
+ * qemuVhostUserGPUGetPid:
+ * @binpath: path of executable associated with the pidfile
+ * @stateDir: the directory where vhost-user-gpu writes the pidfile into
+ * @shortName: short name of the domain
+ * @alias: video device alias
+ * @pid: pointer to pid
+ *
+ * Return -errno upon error, or zero on successful reading of the pidfile.
+ * If the PID was not still alive, zero will be returned, and @pid will be
+ * set to -1;
+ */
+static int
+qemuVhostUserGPUGetPid(const char *binPath,
+ const char *stateDir,
+ const char *shortName,
+ const char *alias,
+ pid_t *pid)
+{
+ int ret;
+ char *pidfile =3D qemuVhostUserGPUCreatePidFilename(stateDir, shortNam=
e, alias);
+ if (!pidfile)
+ return -ENOMEM;
+
+ ret =3D virPidFileReadPathIfAlive(pidfile, pid, binPath);
+
+ VIR_FREE(pidfile);
+
+ return ret;
+}
+
+
+int qemuExtVhostUserGPUPrepareDomain(virQEMUDriverPtr driver,
+ virDomainVideoDefPtr video)
+{
+ return qemuVhostUserFillDomainGPU(driver, video);
+}
+
+
+/*
+ * qemuExtVhostUserGPUStart:
+ * @driver: QEMU driver
+ * @vm: the VM domain
+ * @video: the video device
+ * @logCtxt: log context
+ *
+ * Start the external vhost-user-gpu process:
+ * - open a socketpair for vhost-user communication
+ * - have the command line built
+ * - start the external process and sync with it before QEMU start
+ */
+int qemuExtVhostUserGPUStart(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ virDomainVideoDefPtr video,
+ qemuDomainLogContextPtr logCtxt)
+{
+ int ret =3D -1;
+ virCommandPtr cmd =3D NULL;
+ int exitstatus =3D 0;
+ char *errbuf =3D NULL;
+ virQEMUDriverConfigPtr cfg;
+ char *pidfile =3D NULL, *shortName =3D virDomainDefGetShortName(vm->de=
f);
+ virTimeBackOffVar timebackoff;
+ const unsigned long long timeout =3D 500 * 1000; /* ms */
+ int cmdret =3D 0, rc;
+ int pair[2] =3D { -1, -1 };
+
+ pid_t pid;
+
+ if (!shortName)
+ return -1;
+
+ cfg =3D virQEMUDriverGetConfig(driver);
+
+ /* stop any left-over for this VM */
+ qemuExtVhostUserGPUStop(driver, vm, video);
+
+ if (!(pidfile =3D qemuVhostUserGPUCreatePidFilename(
+ cfg->stateDir, shortName, video->info.alias)))
+ goto error;
+
+ if (qemuSecuritySetSocketLabel(driver->securityManager, vm->def) < 0)
+ goto cleanup;
+
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, pair) < 0) {
+ virReportSystemError(errno, "%s", _("failed to create socket"));
+ goto error;
+ }
+
+ if (qemuSecurityClearSocketLabel(driver->securityManager, vm->def) < 0)
+ goto cleanup;
+
+ cmd =3D virCommandNew(video->info.vhost_user_binary);
+ if (!cmd)
+ goto error;
+
+ virCommandClearCaps(cmd);
+ virCommandSetPidFile(cmd, pidfile);
+ virCommandDaemonize(cmd);
+
+ if (qemuExtDeviceLogCommand(logCtxt, cmd, "vhost-user-gpu") < 0)
+ goto error;
+
+ virCommandAddArgFormat(cmd, "--fd=3D%d", pair[0]);
+ virCommandPassFD(cmd, pair[0], VIR_COMMAND_PASS_FD_CLOSE_PARENT);
+ pair[0] =3D -1;
+
+ if (video->accel) {
+ if (video->accel->accel3d)
+ virCommandAddArg(cmd, "--virgl");
+
+ if (video->accel->rendernode)
+ virCommandAddArgFormat(cmd, "--render-node=3D%s", video->accel=
->rendernode);
+ }
+ if (qemuSecurityStartVhostUserGPU(driver, vm, cmd,
+ &exitstatus, &cmdret) < 0)
+ goto error;
+
+ if (cmdret < 0 || exitstatus !=3D 0) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Could not start 'vhost-user-gpu'. exitstatus: %d=
, "
+ "error: %s"), exitstatus, errbuf);
+ goto cleanup;
+ }
+
+ /* check that the helper has written its pid into the file */
+ if (virTimeBackOffStart(&timebackoff, 1, timeout) < 0)
+ goto error;
+ while (virTimeBackOffWait(&timebackoff)) {
+ rc =3D qemuVhostUserGPUGetPid(video->info.vhost_user_binary,
+ cfg->stateDir, shortName, video->info.=
alias, &pid);
+ if (rc < 0)
+ continue;
+ if (rc =3D=3D 0 && pid =3D=3D (pid_t)-1)
+ goto error;
+ break;
+ }
+
+ ret =3D 0;
+ video->info.vhost_user_fd =3D pair[1];
+ pair[1] =3D -1;
+
+cleanup:
+ VIR_FORCE_CLOSE(pair[0]);
+ VIR_FORCE_CLOSE(pair[1]);
+ virObjectUnref(cfg);
+ VIR_FREE(pidfile);
+ virCommandFree(cmd);
+
+ return ret;
+
+error:
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("vhost-user-gpu failed to start"));
+ goto cleanup;
+}
+
+
+/*
+ * qemuExtVhostUserGPUStop:
+ *
+ * @driver: QEMU driver
+ * @vm: the VM domain
+ * @video: the video device
+ *
+ * Check if vhost-user process pidfile is around, kill the process,
+ * and remove the pidfile.
+ */
+void qemuExtVhostUserGPUStop(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ virDomainVideoDefPtr video)
+{
+ virErrorPtr orig_err;
+ char *pidfile, *shortName =3D virDomainDefGetShortName(vm->def);
+ virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver);
+
+ if (!(pidfile =3D qemuVhostUserGPUCreatePidFilename(
+ cfg->stateDir, shortName, video->info.alias))) {
+ VIR_WARN("Unable to construct vhost-user-gpu pidfile path");
+ return;
+ }
+
+ virErrorPreserveLast(&orig_err);
+ if (virPidFileForceCleanupPath(pidfile) < 0) {
+ VIR_WARN("Unable to kill vhost-user-gpu process");
+ } else {
+ if (unlink(pidfile) < 0 &&
+ errno !=3D ENOENT) {
+ virReportSystemError(errno,
+ _("Unable to remove stale pidfile %s"),
+ pidfile);
+ }
+ }
+ virErrorRestore(&orig_err);
+
+ VIR_FREE(pidfile);
+}
+
+
+/*
+ * qemuExtVhostUserGPUSetupCgroup:
+ *
+ * @driver: QEMU driver
+ * @def: domain definition
+ * @video: the video device
+ * @cgroupe: a cgroup
+ *
+ * Add the vhost-user-gpu PID to the given cgroup.
+ */
+int
+qemuExtVhostUserGPUSetupCgroup(virQEMUDriverPtr driver,
+ virDomainDefPtr def,
+ virDomainVideoDefPtr video,
+ virCgroupPtr cgroup)
+{
+ virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver);
+ char *pidfile =3D NULL;
+ char *shortName =3D NULL;
+ int ret =3D -1, rc;
+ pid_t pid;
+
+ shortName =3D virDomainDefGetShortName(def);
+ if (!shortName)
+ goto cleanup;
+
+ rc =3D qemuVhostUserGPUGetPid(video->info.vhost_user_binary,
+ cfg->stateDir, shortName, video->info.alia=
s, &pid);
+ if (rc < 0 || (rc =3D=3D 0 && pid =3D=3D (pid_t)-1)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Could not get process id of vhost-user-gpu"));
+ goto cleanup;
+ }
+ if (virCgroupAddProcess(cgroup, pid) < 0)
+ goto cleanup;
+
+ ret =3D 0;
+
+ cleanup:
+ VIR_FREE(pidfile);
+ VIR_FREE(shortName);
+ virObjectUnref(cfg);
+
+ return ret;
+}
diff --git a/src/qemu/qemu_vhost_user_gpu.h b/src/qemu/qemu_vhost_user_gpu.h
new file mode 100644
index 0000000000..bf6ab4d2e9
--- /dev/null
+++ b/src/qemu/qemu_vhost_user_gpu.h
@@ -0,0 +1,54 @@
+/*
+ * qemu_vhost_user_gpu.h: QEMU vhost-user GPU support
+ *
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * .
+ *
+ * Author: Marc-Andr=C3=A9 Lureau
+ */
+#ifndef __QEMU_VHOST_USER_GPU_H__
+# define __QEMU_VHOST_USER_GPU_H__
+
+# include "domain_conf.h"
+# include "qemu_domain.h"
+# include "qemu_security.h"
+
+int qemuExtVhostUserGPUPrepareDomain(virQEMUDriverPtr driver,
+ virDomainVideoDefPtr video)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
+ ATTRIBUTE_RETURN_CHECK;
+
+int qemuExtVhostUserGPUStart(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ virDomainVideoDefPtr video,
+ qemuDomainLogContextPtr logCtxt)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
+ ATTRIBUTE_RETURN_CHECK;
+
+void qemuExtVhostUserGPUStop(virQEMUDriverPtr driver,
+ virDomainObjPtr def,
+ virDomainVideoDefPtr video)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+
+int
+qemuExtVhostUserGPUSetupCgroup(virQEMUDriverPtr driver,
+ virDomainDefPtr def,
+ virDomainVideoDefPtr video,
+ virCgroupPtr cgroup)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
+ ATTRIBUTE_RETURN_CHECK;
+
+#endif /* __QEMU_VHOST_USER_GPU_H__ */
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 17:37:59 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=1559730799; cv=none;
d=zoho.com; s=zohoarc;
b=ZEQGyRfxPoiELrHWw/M7WKmGVoiL8YVIK0Uhajsu47oPBRKyLVH2+Y5fA25m0QzxlibBwKLo8cMwragzCRoj1qfxMgwLS6yjt1LY117ujdrI+Ezc4IH9eTNEOFbvR4L3wn1WvFKRb4fdZl/JM6y2YKxrLz4/82gzr3Zms1yvUtQ=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730799;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=FyfymtNoAvbpWdHbI4QWTUgyaFGmjzWbzQ6P6xDIE6g=;
b=VT6+bwb1eUgQrtovJLB1I972Qs3F4PDIfCgIrCz9MnkRxwGuVOo2qamcAKUKRaUjWkGkWbKGX/nO0HKERkdUZXrrRHvHXNqKpwnB852JucT07tUWmkchJwxN5tMW+mZSAy3hZYp72AdCDfZj10wbaVQ+UBWBACNE8OHLdWzQ0lE=
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 1559730799218119.43561876467231;
Wed, 5 Jun 2019 03:33:19 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com
[10.5.11.16])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 99F3010C94;
Wed, 5 Jun 2019 10:33:17 +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 758895C22C;
Wed, 5 Jun 2019 10:33:17 +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 3CEFD206D3;
Wed, 5 Jun 2019 10:33:17 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com
[10.5.11.15])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x55AWmXA020394 for ;
Wed, 5 Jun 2019 06:32:48 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 4985A5B689; Wed, 5 Jun 2019 10:32:48 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id CD2575D739;
Wed, 5 Jun 2019 10:32:47 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:31:13 +0200
Message-Id: <20190605103117.19047-16-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 15/19] qemu: prepare domain for vhost-user GPU
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-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Sender: libvir-list-bounces@redhat.com
Errors-To: libvir-list-bounces@redhat.com
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]);
Wed, 05 Jun 2019 10:33:18 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
Call qemuExtVhostUserGPUPrepareDomain() to fill the domain with the
location of the vhost-user binary to start.
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_extdevice.c | 30 ++++++++++++++++++++++++++++++
src/qemu/qemu_extdevice.h | 5 +++++
src/qemu/qemu_process.c | 4 ++++
3 files changed, 39 insertions(+)
diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c
index a21caefaba..977743d240 100644
--- a/src/qemu/qemu_extdevice.c
+++ b/src/qemu/qemu_extdevice.c
@@ -21,6 +21,7 @@
#include
=20
#include "qemu_extdevice.h"
+#include "qemu_vhost_user_gpu.h"
#include "qemu_domain.h"
#include "qemu_tpm.h"
=20
@@ -92,6 +93,35 @@ qemuExtDevicesInitPaths(virQEMUDriverPtr driver,
}
=20
=20
+/*
+ * qemuExtDevicesPrepareDomain:
+ *
+ * @driver: QEMU driver
+ * @vm: domain
+ *
+ * Code that modifies live XML of a domain which is about to start.
+ */
+int
+qemuExtDevicesPrepareDomain(virQEMUDriverPtr driver,
+ virDomainObjPtr vm)
+{
+ int ret =3D 0;
+ int i;
+
+ for (i =3D 0; i < vm->def->nvideos; i++) {
+ virDomainVideoDefPtr video =3D vm->def->videos[i];
+
+ if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && video->vhos=
tuser) {
+ if ((ret =3D qemuExtVhostUserGPUPrepareDomain(driver, video) <=
0)) {
+ break;
+ }
+ }
+ }
+
+ return ret;
+}
+
+
/*
* qemuExtDevicesPrepareHost:
*
diff --git a/src/qemu/qemu_extdevice.h b/src/qemu/qemu_extdevice.h
index af03c045ff..aeb9e94057 100644
--- a/src/qemu/qemu_extdevice.h
+++ b/src/qemu/qemu_extdevice.h
@@ -30,6 +30,11 @@ int qemuExtDeviceLogCommand(qemuDomainLogContextPtr logC=
txt,
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
ATTRIBUTE_RETURN_CHECK;
=20
+int qemuExtDevicesPrepareDomain(virQEMUDriverPtr driver,
+ virDomainObjPtr vm)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
+ ATTRIBUTE_RETURN_CHECK;
+
int qemuExtDevicesPrepareHost(virQEMUDriverPtr driver,
virDomainDefPtr def)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index f600c4112a..c46f7d4224 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6177,6 +6177,10 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver,
if (qemuFirmwareFillDomain(driver, vm, flags) < 0)
goto cleanup;
=20
+ VIR_DEBUG("Preparing external devices");
+ if (qemuExtDevicesPrepareDomain(driver, vm) < 0)
+ goto cleanup;
+
for (i =3D 0; i < vm->def->nchannels; i++) {
if (qemuDomainPrepareChannel(vm->def->channels[i],
priv->channelTargetDir) < 0)
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 17:37:59 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=1559730922; cv=none;
d=zoho.com; s=zohoarc;
b=doBVi3tmfLlT/yEiSHPpnAYtHJ0Nig+obkgQQg/d9ZD9SBMz9wdSN4Gr+soos2Fy+JkppzfM4HgOpqUKpv1G9xj4sCNNveT+CLsLBAzYin6UhEfXjl4GF6YmG6vSEjhXeBdxPZI3MeU21BeKkqdfG5Nh8Ea97j7SzH0L70ZNbuw=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730922;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=+D1YH343uNRDRwH4MyCa2WwmeEbTXxRt4UoJ2YCqqxo=;
b=gUFvZJjbPDorrFGog4DONHnsBf0kh66VIgCxs+VV8+xj+CJFT+AV9ljuEQ2UpnQMoLhrB/MD1j/xF70HShWt4lunu8vC28in+OI8Z3HAuKu9UOFto9UcKm04y+tknByfmr/87kgUQAqDjzuk5ocf+FjsaINE06jw8WTjHOAaUFI=
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 155973092201154.21818827100981;
Wed, 5 Jun 2019 03:35:22 -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 41B897CB95;
Wed, 5 Jun 2019 10:35:20 +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 1441519749;
Wed, 5 Jun 2019 10:35:20 +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 BD09F1806B15;
Wed, 5 Jun 2019 10:35:19 +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 x55AWtuG020405 for ;
Wed, 5 Jun 2019 06:32:55 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 6A77C3844; Wed, 5 Jun 2019 10:32:55 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id 478895D9CC;
Wed, 5 Jun 2019 10:32:49 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:31:14 +0200
Message-Id: <20190605103117.19047-17-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 16/19] qemu: start/stop the vhost-user-gpu
external device
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-Type: text/plain; charset="utf-8"
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]);
Wed, 05 Jun 2019 10:35:20 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
Each vhost-user-gpu needs its own helper gpu process.
Start/stop them, and apply the emulator cgroup controller.
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_extdevice.c | 49 +++++++++++++++++++++++++++++++++++----
1 file changed, 44 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c
index 977743d240..7e78e10cdd 100644
--- a/src/qemu/qemu_extdevice.c
+++ b/src/qemu/qemu_extdevice.c
@@ -24,6 +24,7 @@
#include "qemu_vhost_user_gpu.h"
#include "qemu_domain.h"
#include "qemu_tpm.h"
+#include "qemu_vhost_user_gpu.h"
=20
#include "viralloc.h"
#include "virlog.h"
@@ -160,11 +161,21 @@ qemuExtDevicesStart(virQEMUDriverPtr driver,
virDomainObjPtr vm,
qemuDomainLogContextPtr logCtxt)
{
- int ret =3D 0;
+ int i, ret =3D 0;
=20
if (qemuExtDevicesInitPaths(driver, vm->def) < 0)
return -1;
=20
+ for (i =3D 0; i < vm->def->nvideos; i++) {
+ virDomainVideoDefPtr video =3D vm->def->videos[i];
+
+ if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && video->vhos=
tuser) {
+ ret =3D qemuExtVhostUserGPUStart(driver, vm, video, logCtxt);
+ if (ret < 0)
+ return ret;
+ }
+ }
+
if (vm->def->tpm)
ret =3D qemuExtTPMStart(driver, vm, logCtxt);
=20
@@ -176,9 +187,19 @@ void
qemuExtDevicesStop(virQEMUDriverPtr driver,
virDomainObjPtr vm)
{
+ int i;
+
if (qemuExtDevicesInitPaths(driver, vm->def) < 0)
return;
=20
+ for (i =3D 0; i < vm->def->nvideos; i++) {
+ virDomainVideoDefPtr video =3D vm->def->videos[i];
+
+ if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && video->vhos=
tuser) {
+ qemuExtVhostUserGPUStop(driver, vm, video);
+ }
+ }
+
if (vm->def->tpm)
qemuExtTPMStop(driver, vm);
}
@@ -187,6 +208,14 @@ qemuExtDevicesStop(virQEMUDriverPtr driver,
bool
qemuExtDevicesHasDevice(virDomainDefPtr def)
{
+ int i;
+
+ for (i =3D 0; i < def->nvideos; i++) {
+ if (def->videos[i]->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
+ def->videos[i]->vhostuser)
+ return true;
+ }
+
if (def->tpm && def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR)
return true;
=20
@@ -199,10 +228,20 @@ qemuExtDevicesSetupCgroup(virQEMUDriverPtr driver,
virDomainDefPtr def,
virCgroupPtr cgroup)
{
- int ret =3D 0;
+ int i;
=20
- if (def->tpm)
- ret =3D qemuExtTPMSetupCgroup(driver, def, cgroup);
+ for (i =3D 0; i < def->nvideos; i++) {
+ virDomainVideoDefPtr video =3D def->videos[i];
=20
- return ret;
+ if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
+ video->vhostuser &&
+ qemuExtVhostUserGPUSetupCgroup(driver, def, video, cgroup) < 0)
+ return -1;
+ }
+
+ if (def->tpm &&
+ qemuExtTPMSetupCgroup(driver, def, cgroup) < 0)
+ return -1;
+
+ return 0;
}
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 17:37:59 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=1559730853; cv=none;
d=zoho.com; s=zohoarc;
b=Xdp48mpaBADWaABhNGiq80jAbVSUQEGYSpWKFs8S/FMh1psHq26A8T5iIqHmEaTmxg0dkT2r9c6DGWgzSKdfIUSnt/kmdVOP+NUXXZojSmG75xnkgGUmrMw4cVMwLlHPsFn7oEznsoxUbvfgg6P1oK2ll0EoWVglq1w5a4ethmQ=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730853;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=Zq9CbCZVgQWMOeheawj3+owDMADjq9l9NvNvVRcFs18=;
b=HUJYa+BEzQnQhaj6ZSBamrxERJ0i1vXdv9jOcEdWAHPbGSRnW4qRFzanecpzCUmBNo1Gy0RHgl23yjGQK4q7GGGbp33k7Rdem00dvOWS2ghe3ggcJNXs/uZuNJibnI8uq+uF9V5TLtAuR5SlWRvN2BUXACLQrewGPKRlkGtC910=
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 1559730853958582.3466662546886;
Wed, 5 Jun 2019 03:34:13 -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 2D83DC066474;
Wed, 5 Jun 2019 10:34:12 +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 F41F717AD4;
Wed, 5 Jun 2019 10:34:11 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id BA00A1806B11;
Wed, 5 Jun 2019 10:34:11 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com
[10.5.11.23])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x55AX2kr020438 for ;
Wed, 5 Jun 2019 06:33:02 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 9AC4C1974B; Wed, 5 Jun 2019 10:33:02 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id 9524919749;
Wed, 5 Jun 2019 10:32:56 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:31:15 +0200
Message-Id: <20190605103117.19047-18-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 17/19] qemu: build vhost-user GPU devices
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-Type: text/plain; charset="utf-8"
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.31]);
Wed, 05 Jun 2019 10:34:12 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
For each vhost-user GPUs,
- build a socket chardev, and pass the vhost-user socket to it
- build a vhost-user video device and associate it with the chardev
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_command.c | 46 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 44 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 0551984a47..b70040b969 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4731,8 +4731,15 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
goto error;
}
=20
- if (STREQ(model, "virtio-gpu")) {
- if (qemuBuildVirtioDevStr(&buf, "virtio-gpu", qemuCaps,
+ if (video->vhostuser) {
+ if (STREQ(model, "virtio-vga"))
+ model =3D "vhost-user-vga";
+ if (STREQ(model, "virtio-gpu"))
+ model =3D "vhost-user-gpu";
+ }
+
+ if (STREQ(model, "virtio-gpu") || STREQ(model, "vhost-user-gpu")) {
+ if (qemuBuildVirtioDevStr(&buf, model, qemuCaps,
VIR_DOMAIN_DEVICE_VIDEO, video) < 0) {
goto error;
}
@@ -4774,6 +4781,10 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
if (video->heads)
virBufferAsprintf(&buf, ",max_outputs=3D%u", video->heads);
}
+ } else if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && video->v=
hostuser) {
+ if (video->heads)
+ virBufferAsprintf(&buf, ",max_outputs=3D%u", video->heads);
+ virBufferAsprintf(&buf, ",chardev=3Dchr-vu-%s", video->info.alias);
} else if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_MAX_OUTPUTS)) {
if (video->heads)
@@ -4887,6 +4898,23 @@ qemuBuildVgaVideoCommand(virCommandPtr cmd,
}
=20
=20
+static char *
+qemuBuildVhostUserChardevStr(const char *alias,
+ int *fd,
+ virCommandPtr cmd)
+{
+ char *chardev =3D NULL;
+
+ if (virAsprintf(&chardev, "socket,id=3Dchr-vu-%s,fd=3D%d", alias, *fd)=
< 0)
+ return NULL;
+
+ virCommandPassFD(cmd, *fd, VIR_COMMAND_PASS_FD_CLOSE_PARENT);
+ *fd =3D -1;
+
+ return chardev;
+}
+
+
static int
qemuBuildVideoCommandLine(virCommandPtr cmd,
const virDomainDef *def,
@@ -4894,6 +4922,20 @@ qemuBuildVideoCommandLine(virCommandPtr cmd,
{
size_t i;
=20
+ for (i =3D 0; i < def->nvideos; i++) {
+ VIR_AUTOFREE(char *) chardev =3D NULL;
+ virDomainVideoDefPtr video =3D def->videos[i];
+
+ if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && video->vhos=
tuser) {
+ if (!(chardev =3D qemuBuildVhostUserChardevStr(video->info.ali=
as,
+ &video->info.vhos=
t_user_fd,
+ cmd)))
+ return -1;
+
+ virCommandAddArgList(cmd, "-chardev", chardev, NULL);
+ }
+ }
+
for (i =3D 0; i < def->nvideos; i++) {
char *str =3D NULL;
virDomainVideoDefPtr video =3D def->videos[i];
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 17:37:59 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=1559730809; cv=none;
d=zoho.com; s=zohoarc;
b=RJlsIB4wyNL6sfvNHDVXhkh7sy79bOtGdRjhiSHJaEFa6focbAYfPDJdf2Z+l2bCOJDZ3nGEb0i1qUmLt7zNPyW3gfkZZNrQUXBuP6iyF0mgDSpspPeCcQHFjS/FhbmB82Q9mC9sJRRgTgJLMTNEs0WM9bkJAGXi8qwdrimyLpA=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730809;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=Hhn/qKSllFbAcuZIQiJ/SCY4fX+5abwVzWcL+5P/WwE=;
b=NpOtahDNhWVWONKPrFrXQzzsAZpNavw90BlC+rVFPff/gRLleJQ4tUhfIvFbXNIQry3636mrOuErDl27ceV5w+vRiNgS9Tn/eP2hHeq+DkKCGHxEcZKxGnxMmzb4iogDofX4ONZyQ+R4qHNIUotRmzqENaXeap7C7ljtvyUm9Kk=
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 1559730809487838.8190123221581;
Wed, 5 Jun 2019 03:33:29 -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 B9EBEC18B2CA;
Wed, 5 Jun 2019 10:33:27 +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 8AF425D71A;
Wed, 5 Jun 2019 10:33:27 +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 4977A54D3D;
Wed, 5 Jun 2019 10:33:27 +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 x55AX9Ow020461 for ;
Wed, 5 Jun 2019 06:33:09 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 9CC0260C91; Wed, 5 Jun 2019 10:33:09 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id D11071B45D;
Wed, 5 Jun 2019 10:33:03 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:31:16 +0200
Message-Id: <20190605103117.19047-19-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 18/19] tests: mock execv/execve
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-Type: text/plain; charset="utf-8"
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]);
Wed, 05 Jun 2019 10:33:28 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
Learn to override the paths to the program to execute (vhost-user
helpers are executed to check for runtime capabilities).
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
tests/virfilewrapper.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/tests/virfilewrapper.c b/tests/virfilewrapper.c
index 067cb30657..c12d2a9cb4 100644
--- a/tests/virfilewrapper.c
+++ b/tests/virfilewrapper.c
@@ -44,6 +44,8 @@ static FILE *(*real_fopen)(const char *path, const char *=
mode);
static int (*real_access)(const char *path, int mode);
static int (*real_mkdir)(const char *path, mode_t mode);
static DIR *(*real_opendir)(const char *path);
+static int (*real_execv)(const char *path, char *const argv[]);
+static int (*real_execve)(const char *path, char *const argv[], char *cons=
t envp[]);
=20
static void init_syms(void)
{
@@ -55,6 +57,8 @@ static void init_syms(void)
VIR_MOCK_REAL_INIT(mkdir);
VIR_MOCK_REAL_INIT(open);
VIR_MOCK_REAL_INIT(opendir);
+ VIR_MOCK_REAL_INIT(execv);
+ VIR_MOCK_REAL_INIT(execve);
}
=20
=20
@@ -186,4 +190,22 @@ DIR *opendir(const char *path)
return real_opendir(newpath ? newpath : path);
}
=20
+int execv(const char *path, char *const argv[])
+{
+ VIR_AUTOFREE(char *) newpath =3D NULL;
+
+ PATH_OVERRIDE(newpath, path);
+
+ return real_execv(newpath ? newpath : path, argv);
+}
+
+int execve(const char *path, char *const argv[], char *const envp[])
+{
+ VIR_AUTOFREE(char *) newpath =3D NULL;
+
+ PATH_OVERRIDE(newpath, path);
+
+ return real_execve(newpath ? newpath : path, argv, envp);
+}
+
#endif
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Fri Apr 19 17:37:59 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=1559730929; cv=none;
d=zoho.com; s=zohoarc;
b=NV2ffqFryBLgqdbezTQbJO7lDBfRhLnRthRTybURqVMiAAsjiqLQtUwnoWmL+Q5w0h1V5kTSBwta7Wn1eJUhG0SKaW1bplwdsJA8y7ilJnGfUjFF/IlF0M92ocre23Jrcqddch0lUNtxsWWejbXnfkmCIfLlI8ehYB+iy8qlBoM=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com;
s=zohoarc;
t=1559730929;
h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results;
bh=dgwe8HlafV9VWzAMkD+k7zafnqv9DyiVdgTnqzjvZtc=;
b=in0DaO2Iuu9zVWeGh/zKwhy59/Ldp4KRgHYGWSxWNO7olvrSgUAPutDn6CmTqFVDBJCxiEOLIfD2j030Rps+qMOTxja9Bz5Q00FJNkVk+WpCpzvZOpNw9MmsJEqRkdr24+iXzj5U51wtDyczcBM2MBZ6DexepOlzh3bSAm4jPuk=
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 1559730929342149.68182646613195;
Wed, 5 Jun 2019 03:35:29 -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 A91AE30BC58E;
Wed, 5 Jun 2019 10:35:27 +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 826AC19741;
Wed, 5 Jun 2019 10:35:27 +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 230761806B16;
Wed, 5 Jun 2019 10:35:27 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com
[10.5.11.22])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id x55AXGdB020477 for ;
Wed, 5 Jun 2019 06:33:16 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 1482E1001E79; Wed, 5 Jun 2019 10:33:16 +0000 (UTC)
Received: from localhost (ovpn-112-54.ams2.redhat.com [10.36.112.54])
by smtp.corp.redhat.com (Postfix) with ESMTP id 6109F1018A0D;
Wed, 5 Jun 2019 10:33:10 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Wed, 5 Jun 2019 12:31:17 +0200
Message-Id: <20190605103117.19047-20-marcandre.lureau@redhat.com>
In-Reply-To: <20190605103117.19047-1-marcandre.lureau@redhat.com>
References: <20190605103117.19047-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [PATCH 19/19] tests: add vhost-user-gpu xml2argv tests
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-Type: text/plain; charset="utf-8"
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.49]);
Wed, 05 Jun 2019 10:35:28 +0000 (UTC)
From: Marc-Andr=C3=A9 Lureau
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
.../vhost-user-gpu-secondary.args | 35 +++++++++++++++
.../vhost-user-gpu-secondary.xml | 44 +++++++++++++++++++
tests/qemuxml2argvdata/vhost-user-vga.args | 32 ++++++++++++++
tests/qemuxml2argvdata/vhost-user-vga.xml | 41 +++++++++++++++++
tests/qemuxml2argvtest.c | 21 +++++++++
5 files changed, 173 insertions(+)
create mode 100644 tests/qemuxml2argvdata/vhost-user-gpu-secondary.args
create mode 100644 tests/qemuxml2argvdata/vhost-user-gpu-secondary.xml
create mode 100644 tests/qemuxml2argvdata/vhost-user-vga.args
create mode 100644 tests/qemuxml2argvdata/vhost-user-vga.xml
diff --git a/tests/qemuxml2argvdata/vhost-user-gpu-secondary.args b/tests/q=
emuxml2argvdata/vhost-user-gpu-secondary.args
new file mode 100644
index 0000000000..413de05370
--- /dev/null
+++ b/tests/qemuxml2argvdata/vhost-user-gpu-secondary.args
@@ -0,0 +1,35 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/tmp/lib/domain--1-QEMUGuest1 \
+USER=3Dtest \
+LOGNAME=3Dtest \
+XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=3Dnone \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \
+-m 214 \
+-realtime mlock=3Doff \
+-smp 1,sockets=3D1,cores=3D1,threads=3D1 \
+-object memory-backend-memfd,id=3Dram-node0,share=3Dyes,size=3D224395264 \
+-numa node,nodeid=3D0,cpus=3D0,memdev=3Dram-node0 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni=
tor.sock,server,nowait \
+-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \
+-rtc base=3Dutc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide=
0-0-0 \
+-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b=
ootindex=3D1 \
+-chardev socket,id=3Dchr-vu-video0,fd=3D0 \
+-chardev socket,id=3Dchr-vu-video1,fd=3D0 \
+-device vhost-user-vga,id=3Dvideo0,max_outputs=3D1,chardev=3Dchr-vu-video0=
,bus=3Dpci.0,addr=3D0x2 \
+-device vhost-user-gpu-pci,id=3Dvideo1,max_outputs=3D1,chardev=3Dchr-vu-vi=
deo1,bus=3Dpci.0,addr=3D0x4 \
+-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3
diff --git a/tests/qemuxml2argvdata/vhost-user-gpu-secondary.xml b/tests/qe=
muxml2argvdata/vhost-user-gpu-secondary.xml
new file mode 100644
index 0000000000..2142497d6e
--- /dev/null
+++ b/tests/qemuxml2argvdata/vhost-user-gpu-secondary.xml
@@ -0,0 +1,44 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+
+
+
+ 1
+
+
+
+
+
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-i686
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvdata/vhost-user-vga.args b/tests/qemuxml2arg=
vdata/vhost-user-vga.args
new file mode 100644
index 0000000000..7f6a1a6a58
--- /dev/null
+++ b/tests/qemuxml2argvdata/vhost-user-vga.args
@@ -0,0 +1,32 @@
+LC_ALL=3DC PATH=3D/bin \
+HOME=3D/tmp/lib/domain--1-QEMUGuest1 \
+USER=3Dtest \
+LOGNAME=3Dtest \
+XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \
+QEMU_AUDIO_DRV=3Dnone \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \
+-m 214 \
+-realtime mlock=3Doff \
+-smp 1,sockets=3D1,cores=3D1,threads=3D1 \
+-object memory-backend-memfd,id=3Dram-node0,share=3Dyes,size=3D224395264 \
+-numa node,nodeid=3D0,cpus=3D0,memdev=3Dram-node0 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni=
tor.sock,server,nowait \
+-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \
+-rtc base=3Dutc \
+-no-shutdown \
+-no-acpi \
+-usb \
+-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide=
0-0-0 \
+-device ide-hd,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-0,b=
ootindex=3D1 \
+-chardev socket,id=3Dchr-vu-video0,fd=3D0 \
+-device vhost-user-vga,id=3Dvideo0,max_outputs=3D1,chardev=3Dchr-vu-video0=
,bus=3Dpci.0,addr=3D0x2 \
+-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3
diff --git a/tests/qemuxml2argvdata/vhost-user-vga.xml b/tests/qemuxml2argv=
data/vhost-user-vga.xml
new file mode 100644
index 0000000000..81b1e7643e
--- /dev/null
+++ b/tests/qemuxml2argvdata/vhost-user-vga.xml
@@ -0,0 +1,41 @@
+
+ QEMUGuest1
+ c7a5fdbd-edaf-9455-926a-d65c16db1809
+ 219136
+ 219136
+
+
+
+ 1
+
+
+
+
+
+
+ hvm
+
+
+
+ destroy
+ restart
+ destroy
+
+ /usr/bin/qemu-system-i686
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 49220733ae..da684df3c0 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -674,6 +674,15 @@ mymain(void)
virFileWrapperAddPrefix("/home/user/.config/qemu/firmware",
abs_srcdir "/qemufirmwaredata/home/user/.confi=
g/qemu/firmware");
=20
+ virFileWrapperAddPrefix(SYSCONFDIR "/qemu/vhost-user",
+ abs_srcdir "/qemuvhostuserdata/etc/qemu/vhost-=
user");
+ virFileWrapperAddPrefix(PREFIX "/share/qemu/vhost-user",
+ abs_srcdir "/qemuvhostuserdata/usr/share/qemu/=
vhost-user");
+ virFileWrapperAddPrefix("/home/user/.config/qemu/vhost-user",
+ abs_srcdir "/qemuvhostuserdata/home/user/.conf=
ig/qemu/vhost-user");
+ virFileWrapperAddPrefix("/usr/libexec/qemu/vhost-user",
+ abs_srcdir "/qemuvhostuserdata/usr/libexec/qem=
u/vhost-user");
+
/**
* The following set of macros allows testing of XML -> argv conversion wi=
th a
* real set of capabilities gathered from a real qemu copy. It is desired =
to use
@@ -2959,6 +2968,18 @@ mymain(void)
DO_TEST_CAPS_LATEST("os-firmware-efi-secboot");
DO_TEST_CAPS_ARCH_LATEST("aarch64-os-firmware-efi", "aarch64");
=20
+ DO_TEST("vhost-user-vga",
+ QEMU_CAPS_OBJECT_MEMORY_MEMFD,
+ QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+ QEMU_CAPS_DEVICE_VHOST_USER_GPU,
+ QEMU_CAPS_DEVICE_VHOST_USER_VGA);
+
+ DO_TEST("vhost-user-gpu-secondary",
+ QEMU_CAPS_OBJECT_MEMORY_MEMFD,
+ QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
+ QEMU_CAPS_DEVICE_VHOST_USER_GPU,
+ QEMU_CAPS_DEVICE_VHOST_USER_VGA);
+
if (getenv("LIBVIRT_SKIP_CLEANUP") =3D=3D NULL)
virFileDeleteTree(fakerootdir);
=20
--=20
2.22.0.rc2.384.g1a9a72ea1d
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list