From nobody Sun May 19 05:57:52 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
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1531488513570944.1345477673982;
Fri, 13 Jul 2018 06:28:33 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com
[10.5.11.27])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id D6D18C047B8C;
Fri, 13 Jul 2018 13:28:31 +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 983E4C2466;
Fri, 13 Jul 2018 13:28:31 +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 4AA311841C4A;
Fri, 13 Jul 2018 13:28:31 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com
[10.11.54.6])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w6DDSRgU032452 for ;
Fri, 13 Jul 2018 09:28:27 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 65A9821565E2; Fri, 13 Jul 2018 13:28:27 +0000 (UTC)
Received: from localhost (unknown [10.36.112.12])
by smtp.corp.redhat.com (Postfix) with ESMTP id 02E6E21565E1;
Fri, 13 Jul 2018 13:28:26 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Fri, 13 Jul 2018 15:28:08 +0200
Message-Id: <20180713132824.8655-2-marcandre.lureau@redhat.com>
In-Reply-To: <20180713132824.8655-1-marcandre.lureau@redhat.com>
References: <20180713132824.8655-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [RFC PATCH 01/17] qemu: setup shared memory without
explicit numa configuration
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.27
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]);
Fri, 13 Jul 2018 13:28:32 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
From: Marc-Andr=C3=A9 Lureau
When a domain is configured with 'shared' memory backing:
But no explicit NUMA configuration, let's configure a shared memory
backend associated with default -numa.
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_command.c | 100 ++++++++++++------
.../fd-memory-no-numa-topology.args | 4 +
2 files changed, 73 insertions(+), 31 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 44ae8dcef7..f1235099b2 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3254,26 +3254,21 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backen=
dProps,
=20
=20
static int
-qemuBuildMemoryCellBackendStr(virDomainDefPtr def,
- virQEMUDriverConfigPtr cfg,
- size_t cell,
- qemuDomainObjPrivatePtr priv,
- virBufferPtr buf)
+qemuBuildMemoryBackendStr(virDomainDefPtr def,
+ virQEMUDriverConfigPtr cfg,
+ const char *alias,
+ int targetNode,
+ unsigned long long memsize,
+ qemuDomainObjPrivatePtr priv,
+ virBufferPtr buf)
{
virJSONValuePtr props =3D NULL;
- char *alias =3D NULL;
- int ret =3D -1;
- int rc;
virDomainMemoryDef mem =3D { 0 };
- unsigned long long memsize =3D virDomainNumaGetNodeMemorySize(def->num=
a,
- cell);
-
- if (virAsprintf(&alias, "ram-node%zu", cell) < 0)
- goto cleanup;
+ int rc, ret =3D -1;
=20
mem.size =3D memsize;
- mem.targetNode =3D cell;
- mem.info.alias =3D alias;
+ mem.targetNode =3D targetNode;
+ mem.info.alias =3D (char *)alias;
=20
if ((rc =3D qemuBuildMemoryBackendProps(&props, alias, cfg, priv->qemu=
Caps,
def, &mem, priv->autoNodeset, fa=
lse)) < 0)
@@ -3284,9 +3279,30 @@ qemuBuildMemoryCellBackendStr(virDomainDefPtr def,
=20
ret =3D rc;
=20
+cleanup:
+ virJSONValueFree(props);
+ return ret;
+}
+
+
+static int
+qemuBuildMemoryCellBackendStr(virDomainDefPtr def,
+ virQEMUDriverConfigPtr cfg,
+ size_t cell,
+ qemuDomainObjPrivatePtr priv,
+ virBufferPtr buf)
+{
+ char *alias =3D NULL;
+ int ret =3D -1;
+ unsigned long long memsize =3D virDomainNumaGetNodeMemorySize(def->num=
a, cell);
+
+ if (virAsprintf(&alias, "ram-node%zu", cell) < 0)
+ goto cleanup;
+
+ ret =3D qemuBuildMemoryBackendStr(def, cfg, alias, cell, memsize, priv=
, buf);
+
cleanup:
VIR_FREE(alias);
- virJSONValueFree(props);
=20
return ret;
}
@@ -7590,6 +7606,17 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
size_t ncells =3D virDomainNumaGetNodeCount(def->numa);
const long system_page_size =3D virGetSystemPageSizeKB();
bool numa_distances =3D false;
+ bool implicit =3D false;
+
+ if (ncells =3D=3D 0) {
+ if (def->mem.access =3D=3D VIR_DOMAIN_MEMORY_ACCESS_SHARED) {
+ ncells =3D 1;
+ implicit =3D true;
+ } else {
+ ret =3D 0;
+ goto cleanup;
+ }
+ }
=20
if (virDomainNumatuneHasPerNodeBinding(def->numa) &&
!(virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_RAM) ||
@@ -7645,14 +7672,22 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_RAM) ||
virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE)) {
=20
- if ((rc =3D qemuBuildMemoryCellBackendStr(def, cfg, i, priv,
- &nodeBackends[i])) < 0)
+
+ if (implicit)
+ rc =3D qemuBuildMemoryBackendStr(def, cfg, "ram-node", -1,
+ def->mem.total_memory,
+ priv, &nodeBackends[i]);
+ else
+ rc =3D qemuBuildMemoryCellBackendStr(def, cfg, i,
+ priv, &nodeBackends[i]);
+ if (rc < 0)
goto cleanup;
=20
if (rc =3D=3D 0)
needBackend =3D true;
} else {
- if (virDomainNumaGetNodeMemoryAccessMode(def->numa, i)) {
+ if (implicit ||
+ virDomainNumaGetNodeMemoryAccessMode(def->numa, i)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Shared memory mapping is not supported "
"with this QEMU"));
@@ -7667,15 +7702,18 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
=20
for (i =3D 0; i < ncells; i++) {
VIR_FREE(cpumask);
- if (!(cpumask =3D virBitmapFormat(virDomainNumaGetNodeCpumask(def-=
>numa, i))))
- goto cleanup;
=20
- if (strchr(cpumask, ',') &&
- !virQEMUCapsGet(qemuCaps, QEMU_CAPS_NUMA)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("disjoint NUMA cpu ranges are not supported "
- "with this QEMU"));
- goto cleanup;
+ if (!implicit) {
+ if (!(cpumask =3D virBitmapFormat(virDomainNumaGetNodeCpumask(=
def->numa, i))))
+ goto cleanup;
+
+ if (strchr(cpumask, ',') &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_NUMA)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("disjoint NUMA cpu ranges are not support=
ed "
+ "with this QEMU"));
+ goto cleanup;
+ }
}
=20
if (needBackend) {
@@ -7694,7 +7732,8 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
}
=20
if (needBackend)
- virBufferAsprintf(&buf, ",memdev=3Dram-node%zu", i);
+ virBufferAsprintf(&buf, implicit ?
+ ",memdev=3Dram-node" : ",memdev=3Dram-node%z=
u", i);
else
virBufferAsprintf(&buf, ",mem=3D%llu",
virDomainNumaGetNodeMemorySize(def->numa, i)=
/ 1024);
@@ -7717,7 +7756,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
break;
}
=20
- if (numa_distances) {
+ if (!implicit && numa_distances) {
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NUMA_DIST)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("setting NUMA distances is not "
@@ -10303,8 +10342,7 @@ qemuBuildCommandLine(virQEMUDriverPtr driver,
if (qemuBuildIOThreadCommandLine(cmd, def) < 0)
goto error;
=20
- if (virDomainNumaGetNodeCount(def->numa) &&
- qemuBuildNumaArgStr(cfg, def, cmd, priv) < 0)
+ if (qemuBuildNumaArgStr(cfg, def, cmd, priv) < 0)
goto error;
=20
if (qemuBuildMemoryDeviceCommandLine(cmd, cfg, def, priv) < 0)
diff --git a/tests/qemuxml2argvdata/fd-memory-no-numa-topology.args b/tests=
/qemuxml2argvdata/fd-memory-no-numa-topology.args
index bd88daaa3b..400fb39cc6 100644
--- a/tests/qemuxml2argvdata/fd-memory-no-numa-topology.args
+++ b/tests/qemuxml2argvdata/fd-memory-no-numa-topology.args
@@ -11,6 +11,10 @@ QEMU_AUDIO_DRV=3Dnone \
-m 14336 \
-mem-prealloc \
-smp 8,sockets=3D8,cores=3D1,threads=3D1 \
+-object memory-backend-file,id=3Dram-node,\
+mem-path=3D/var/lib/libvirt/qemu/ram/libvirt/qemu/-1-instance-00000092/ram=
-node,\
+share=3Dyes,size=3D15032385536 \
+-numa node,nodeid=3D0,memdev=3Dram-node \
-uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \
-display none \
-no-user-config \
--=20
2.18.0.129.ge3331758f1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sun May 19 05:57:52 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
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1531488522234427.15264341483874;
Fri, 13 Jul 2018 06:28:42 -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 CEE1B81E05;
Fri, 13 Jul 2018 13:28: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 76294600C6;
Fri, 13 Jul 2018 13:28:40 +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 228501841C57;
Fri, 13 Jul 2018 13:28:40 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
[10.11.54.4])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w6DDSTng032463 for ;
Fri, 13 Jul 2018 09:28:29 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 135882026D76; Fri, 13 Jul 2018 13:28:29 +0000 (UTC)
Received: from localhost (unknown [10.36.112.12])
by smtp.corp.redhat.com (Postfix) with ESMTP id 9CDA22026D6B;
Fri, 13 Jul 2018 13:28:28 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Fri, 13 Jul 2018 15:28:09 +0200
Message-Id: <20180713132824.8655-3-marcandre.lureau@redhat.com>
In-Reply-To: <20180713132824.8655-1-marcandre.lureau@redhat.com>
References: <20180713132824.8655-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [RFC PATCH 02/17] qemu: add memory-backend-memfd
capability check
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.25]);
Fri, 13 Jul 2018 13:28:41 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
From: Marc-Andr=C3=A9 Lureau
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml | 1 +
8 files changed, 9 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 23b483349f..4ffd2d6257 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -503,6 +503,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"machine.pseries.cap-hpt-max-page-size",
"machine.pseries.cap-htm",
"usb-storage.werror",
+ "memory-backend-memfd",
);
=20
=20
@@ -1144,6 +1145,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[=
] =3D {
{ "vhost-vsock-device", QEMU_CAPS_DEVICE_VHOST_VSOCK },
{ "mch", QEMU_CAPS_DEVICE_MCH },
{ "sev-guest", QEMU_CAPS_SEV_GUEST },
+ { "memory-backend-memfd", QEMU_CAPS_OBJECT_MEMORY_MEMFD },
};
=20
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[]=
=3D {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 1fa0ebfea3..ed612595e0 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -487,6 +487,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for =
syntax-check */
QEMU_CAPS_MACHINE_PSERIES_CAP_HPT_MAX_PAGE_SIZE, /* -machine pseries.c=
ap-hpt-max-page-size */
QEMU_CAPS_MACHINE_PSERIES_CAP_HTM, /* -machine pseries.cap-htm */
QEMU_CAPS_USB_STORAGE_WERROR, /* -device usb-storage,werror=3D..,rerro=
r=3D.. */
+ QEMU_CAPS_OBJECT_MEMORY_MEMFD, /* -object memory-backend-memfd */
=20
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml b/tests/qem=
ucapabilitiesdata/caps_2.12.0.aarch64.xml
index ecc029f403..e66b8a22ff 100644
--- a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
@@ -169,6 +169,7 @@
+
2011090
0
347550
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml b/tests/qemuc=
apabilitiesdata/caps_2.12.0.ppc64.xml
index 7139179304..b62cd41bc0 100644
--- a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml
@@ -167,6 +167,7 @@
+
2011090
0
428334
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml b/tests/qemuc=
apabilitiesdata/caps_2.12.0.s390x.xml
index 87d189e58d..1d2f802040 100644
--- a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml
@@ -133,6 +133,7 @@
+
2012000
0
375999
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml b/tests/qemu=
capabilitiesdata/caps_2.12.0.x86_64.xml
index 9c1f6c327c..0fd2d812dd 100644
--- a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml
@@ -211,6 +211,7 @@
+
2011090
0
416196
diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml b/tests/qemuca=
pabilitiesdata/caps_3.0.0.ppc64.xml
index 33cd00e613..c6a783353e 100644
--- a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml
@@ -167,6 +167,7 @@
+
2012050
0
446771
diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml b/tests/qemuc=
apabilitiesdata/caps_3.0.0.x86_64.xml
index d7c25c65dd..37e44499ef 100644
--- a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml
@@ -210,6 +210,7 @@
+
2012050
0
437827
--=20
2.18.0.129.ge3331758f1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sun May 19 05:57:52 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
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 153148851979156.28823696357006;
Fri, 13 Jul 2018 06:28:39 -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 0AFCA3082271;
Fri, 13 Jul 2018 13:28:38 +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 BBCCD608F7;
Fri, 13 Jul 2018 13:28:37 +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 703271841C5A;
Fri, 13 Jul 2018 13:28:37 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com
[10.11.54.3])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w6DDSZHV032480 for ;
Fri, 13 Jul 2018 09:28:35 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 6A51510FFE54; Fri, 13 Jul 2018 13:28:35 +0000 (UTC)
Received: from localhost (unknown [10.36.112.12])
by smtp.corp.redhat.com (Postfix) with ESMTP id A479710FFE50;
Fri, 13 Jul 2018 13:28:30 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Fri, 13 Jul 2018 15:28:10 +0200
Message-Id: <20180713132824.8655-4-marcandre.lureau@redhat.com>
In-Reply-To: <20180713132824.8655-1-marcandre.lureau@redhat.com>
References: <20180713132824.8655-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [RFC PATCH 03/17] qemu: use memory-backend-memfd if
possible
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.45]);
Fri, 13 Jul 2018 13:28:38 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
From: Marc-Andr=C3=A9 Lureau
When the memory is shared and the source isn't specified to be a file,
we can make use of memory-backend-memfd. Sealing is enabled by default
in qemu, hugepage is easier to setup, which makes it a better choice
than memory-backend-file.
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_command.c | 20 ++++++++++++++++---
tests/qemuxml2argvdata/memfd.args | 28 +++++++++++++++++++++++++++
tests/qemuxml2argvdata/memfd.xml | 32 +++++++++++++++++++++++++++++++
tests/qemuxml2argvtest.c | 2 ++
4 files changed, 79 insertions(+), 3 deletions(-)
create mode 100644 tests/qemuxml2argvdata/memfd.args
create mode 100644 tests/qemuxml2argvdata/memfd.xml
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f1235099b2..45ab1f85ae 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3137,7 +3137,21 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backend=
Props,
if (!(props =3D virJSONValueNewObject()))
return -1;
=20
- if (useHugepage || mem->nvdimmPath || memAccess ||
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_MEMFD) &&
+ memAccess =3D=3D VIR_DOMAIN_MEMORY_ACCESS_SHARED &&
+ !mem->nvdimmPath &&
+ def->mem.source !=3D VIR_DOMAIN_MEMORY_SOURCE_FILE) {
+
+ backendType =3D "memory-backend-memfd";
+
+ if (useHugepage &&
+ virJSONValueObjectAdd(props,
+ "b:hugetlb", true,
+ "U:hugetlbsize", pagesize * 1024,
+ NULL) < 0)
+ goto cleanup;
+
+ } else if (useHugepage || mem->nvdimmPath || memAccess ||
def->mem.source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_FILE) {
=20
if (useHugepage) {
@@ -7670,8 +7684,8 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
* need to check which approach to use */
for (i =3D 0; i < ncells; i++) {
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_RAM) ||
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE)) {
-
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE) ||
+ virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_MEMFD)) {
=20
if (implicit)
rc =3D qemuBuildMemoryBackendStr(def, cfg, "ram-node", -1,
diff --git a/tests/qemuxml2argvdata/memfd.args b/tests/qemuxml2argvdata/mem=
fd.args
new file mode 100644
index 0000000000..dda8e272ea
--- /dev/null
+++ b/tests/qemuxml2argvdata/memfd.args
@@ -0,0 +1,28 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/home/test \
+USER=3Dtest \
+LOGNAME=3Dtest \
+QEMU_AUDIO_DRV=3Dnone \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \
+-m 214 \
+-smp 1,sockets=3D1,cores=3D1,threads=3D1 \
+-object memory-backend-memfd,id=3Dram-node,size=3D224395264 \
+-numa node,nodeid=3D0,memdev=3Dram-node \
+-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 \
+-boot c \
+-usb \
+-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide=
0-0-0 \
+-device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-=
0 \
+-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3
diff --git a/tests/qemuxml2argvdata/memfd.xml b/tests/qemuxml2argvdata/memf=
d.xml
new file mode 100644
index 0000000000..c60b169169
--- /dev/null
+++ b/tests/qemuxml2argvdata/memfd.xml
@@ -0,0 +1,32 @@
+
+ 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 a929e4314e..47bd2ab867 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -945,6 +945,8 @@ mymain(void)
DO_TEST("pmu-feature", NONE);
DO_TEST("pmu-feature-off", NONE);
=20
+ DO_TEST("memfd",
+ QEMU_CAPS_OBJECT_MEMORY_MEMFD);
DO_TEST("hugepages", NONE);
DO_TEST("hugepages-numa",
QEMU_CAPS_PIIX_DISABLE_S3, QEMU_CAPS_PIIX_DISABLE_S4,
--=20
2.18.0.129.ge3331758f1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sun May 19 05:57:52 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
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1531488526710234.40385507735232;
Fri, 13 Jul 2018 06:28:46 -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 2E01330E6872;
Fri, 13 Jul 2018 13:28: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 E440B26332;
Fri, 13 Jul 2018 13:28:44 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 944DF4A46C;
Fri, 13 Jul 2018 13:28:44 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
[10.11.54.4])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w6DDSbh5032489 for ;
Fri, 13 Jul 2018 09:28:37 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 0657C2026D76; Fri, 13 Jul 2018 13:28:37 +0000 (UTC)
Received: from localhost (unknown [10.36.112.12])
by smtp.corp.redhat.com (Postfix) with ESMTP id B1CCC2026D6B;
Fri, 13 Jul 2018 13:28:36 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Fri, 13 Jul 2018 15:28:11 +0200
Message-Id: <20180713132824.8655-5-marcandre.lureau@redhat.com>
In-Reply-To: <20180713132824.8655-1-marcandre.lureau@redhat.com>
References: <20180713132824.8655-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [RFC PATCH 04/17] qemu: add vhost-user-gpu capabilities
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.46]);
Fri, 13 Jul 2018 13:28:45 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
From: Marc-Andr=C3=A9 Lureau
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 4ffd2d6257..a6c00308a2 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -504,6 +504,10 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"machine.pseries.cap-htm",
"usb-storage.werror",
"memory-backend-memfd",
+
+ /* 315 */
+ "vhost-user-gpu",
+ "vhost-user-vga",
);
=20
=20
@@ -1146,6 +1150,8 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[=
] =3D {
{ "mch", QEMU_CAPS_DEVICE_MCH },
{ "sev-guest", QEMU_CAPS_SEV_GUEST },
{ "memory-backend-memfd", QEMU_CAPS_OBJECT_MEMORY_MEMFD },
+ { "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 ed612595e0..ee1a19282a 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -489,6 +489,10 @@ typedef enum { /* virQEMUCapsFlags grouping marker for=
syntax-check */
QEMU_CAPS_USB_STORAGE_WERROR, /* -device usb-storage,werror=3D..,rerro=
r=3D.. */
QEMU_CAPS_OBJECT_MEMORY_MEMFD, /* -object memory-backend-memfd */
=20
+ /* 315 */
+ 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.18.0.129.ge3331758f1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sun May 19 05:57:52 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
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1531488534991622.0222943215856;
Fri, 13 Jul 2018 06:28: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 68250308A956;
Fri, 13 Jul 2018 13:28:53 +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 23616608F0;
Fri, 13 Jul 2018 13:28:53 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id BB08B1841C4B;
Fri, 13 Jul 2018 13:28:52 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com
[10.11.54.6])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w6DDScfH032501 for ;
Fri, 13 Jul 2018 09:28:38 -0400
Received: by smtp.corp.redhat.com (Postfix)
id BF0C221565E2; Fri, 13 Jul 2018 13:28:38 +0000 (UTC)
Received: from localhost (unknown [10.36.112.12])
by smtp.corp.redhat.com (Postfix) with ESMTP id 5A28321565E1;
Fri, 13 Jul 2018 13:28:38 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Fri, 13 Jul 2018 15:28:12 +0200
Message-Id: <20180713132824.8655-6-marcandre.lureau@redhat.com>
In-Reply-To: <20180713132824.8655-1-marcandre.lureau@redhat.com>
References: <20180713132824.8655-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [RFC PATCH 05/17] domain: add "vhost-user" 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.13
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]);
Fri, 13 Jul 2018 13:28:54 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
From: Marc-Andr=C3=A9 Lureau
Learn to accept "vhost-user" model type:
(fill the required enum and switches to compile successfully)
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
docs/formatdomain.html.in | 5 +++--
docs/schemas/domaincommon.rng | 1 +
src/conf/domain_conf.c | 4 +++-
src/conf/domain_conf.h | 1 +
src/qemu/qemu_command.c | 9 ++++++---
src/qemu/qemu_domain.c | 1 +
src/qemu/qemu_domain_address.c | 1 +
tests/domaincapsschemadata/full.xml | 1 +
8 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index a3afe137bf..8bd0d81dbd 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -6620,8 +6620,9 @@ qemu-kvm -net nic,model=3D? /dev/null
The model
element has a mandatory type
attribute which takes the value "vga", "cirrus", "vmvga", "xen",
"vbox", "qxl" (since 0.8.6),
- "virtio" (since 1.3.0)
- or "gop" (since 3.2.0)
+ "virtio" (since 1.3.0),
+ "gop" (since 3.2.0) or
+ "vhost-user" (since 4.6.0)
depending on the hypervisor features available.
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index f24a56392a..88dcc5404d 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -3451,6 +3451,7 @@
vbox
virtio
gop
+ vhost-user
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7396616eda..93c33263ad 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -590,7 +590,8 @@ VIR_ENUM_IMPL(virDomainVideo, VIR_DOMAIN_VIDEO_TYPE_LAS=
T,
"qxl",
"parallels",
"virtio",
- "gop")
+ "gop",
+ "vhost-user")
=20
VIR_ENUM_IMPL(virDomainVideoVGAConf, VIR_DOMAIN_VIDEO_VGACONF_LAST,
"io",
@@ -15022,6 +15023,7 @@ virDomainVideoDefaultRAM(const virDomainDef *def,
case VIR_DOMAIN_VIDEO_TYPE_VBOX:
case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
+ case VIR_DOMAIN_VIDEO_TYPE_VHOST_USER:
case VIR_DOMAIN_VIDEO_TYPE_GOP:
case VIR_DOMAIN_VIDEO_TYPE_LAST:
default:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 0f10e242fd..4e608b6ae2 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1423,6 +1423,7 @@ typedef enum {
VIR_DOMAIN_VIDEO_TYPE_PARALLELS, /* pseudo device for VNC in container=
s */
VIR_DOMAIN_VIDEO_TYPE_VIRTIO,
VIR_DOMAIN_VIDEO_TYPE_GOP,
+ VIR_DOMAIN_VIDEO_TYPE_VHOST_USER,
=20
VIR_DOMAIN_VIDEO_TYPE_LAST
} virDomainVideoType;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 45ab1f85ae..e78a534628 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -105,7 +105,8 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
"qxl",
"", /* don't support parallels */
"", /* no need for virtio */
- "" /* don't support gop */);
+ "", /* don't support gop */
+ "", /* no need for virtio */);
=20
VIR_ENUM_DECL(qemuDeviceVideo)
=20
@@ -119,7 +120,8 @@ VIR_ENUM_IMPL(qemuDeviceVideo, VIR_DOMAIN_VIDEO_TYPE_LA=
ST,
"qxl-vga",
"", /* don't support parallels */
"virtio-vga",
- "" /* don't support gop */);
+ "", /* don't support gop */
+ "vhost-user-vga");
=20
VIR_ENUM_DECL(qemuDeviceVideoSecondary)
=20
@@ -133,7 +135,8 @@ VIR_ENUM_IMPL(qemuDeviceVideoSecondary, VIR_DOMAIN_VIDE=
O_TYPE_LAST,
"qxl",
"", /* don't support parallels */
"virtio-gpu",
- "" /* don't support gop */);
+ "", /* don't support gop */
+ "vhost-user-gpu");
=20
VIR_ENUM_DECL(qemuSoundCodec)
=20
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index ed76495309..b8b5919795 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4485,6 +4485,7 @@ qemuDomainDeviceDefValidateVideo(const virDomainVideo=
Def *video)
case VIR_DOMAIN_VIDEO_TYPE_VMVGA:
case VIR_DOMAIN_VIDEO_TYPE_QXL:
case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
+ case VIR_DOMAIN_VIDEO_TYPE_VHOST_USER:
case VIR_DOMAIN_VIDEO_TYPE_LAST:
break;
}
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 6ea80616af..df98d7384f 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -786,6 +786,7 @@ qemuDomainDeviceCalculatePCIConnectFlags(virDomainDevic=
eDefPtr dev,
case VIR_DOMAIN_DEVICE_VIDEO:
switch ((virDomainVideoType)dev->data.video->type) {
case VIR_DOMAIN_VIDEO_TYPE_VIRTIO:
+ case VIR_DOMAIN_VIDEO_TYPE_VHOST_USER:
return virtioFlags;
=20
case VIR_DOMAIN_VIDEO_TYPE_VGA:
diff --git a/tests/domaincapsschemadata/full.xml b/tests/domaincapsschemada=
ta/full.xml
index d3faf38da0..2038fad272 100644
--- a/tests/domaincapsschemadata/full.xml
+++ b/tests/domaincapsschemadata/full.xml
@@ -73,6 +73,7 @@
parallels
virtio
gop
+ vhost-user
--=20
2.18.0.129.ge3331758f1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sun May 19 05:57:52 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
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1531488526487333.1360566887388;
Fri, 13 Jul 2018 06:28:46 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com
[10.5.11.25])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id E1F23308FBB0;
Fri, 13 Jul 2018 13:28:44 +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 A9DD92010CC9;
Fri, 13 Jul 2018 13:28:44 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 586C84A465;
Fri, 13 Jul 2018 13:28:44 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
[10.11.54.4])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w6DDSem0032508 for ;
Fri, 13 Jul 2018 09:28:40 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 815362026D76; Fri, 13 Jul 2018 13:28:40 +0000 (UTC)
Received: from localhost (unknown [10.36.112.12])
by smtp.corp.redhat.com (Postfix) with ESMTP id 3789B2026D6B;
Fri, 13 Jul 2018 13:28:39 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Fri, 13 Jul 2018 15:28:13 +0200
Message-Id: <20180713132824.8655-7-marcandre.lureau@redhat.com>
In-Reply-To: <20180713132824.8655-1-marcandre.lureau@redhat.com>
References: <20180713132824.8655-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [RFC PATCH 06/17] qemu: fill the vhost-user video type
capability
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.25
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]);
Fri, 13 Jul 2018 13:28:45 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
From: Marc-Andr=C3=A9 Lureau
If vhost-user-gpu is supported, vhost-user video type is.
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_capabilities.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index a6c00308a2..b517477709 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -5036,6 +5036,8 @@ virQEMUCapsFillDomainDeviceVideoCaps(virQEMUCapsPtr q=
emuCaps,
VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_QXL=
);
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU))
VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_VIR=
TIO);
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_USER_GPU))
+ VIR_DOMAIN_CAPS_ENUM_SET(dev->modelType, VIR_DOMAIN_VIDEO_TYPE_VHO=
ST_USER);
=20
return 0;
}
--=20
2.18.0.129.ge3331758f1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sun May 19 05:57:52 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
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 153148854162686.68117367843922;
Fri, 13 Jul 2018 06:29:01 -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 CCDC830E6841;
Fri, 13 Jul 2018 13:28:58 +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 994A926330;
Fri, 13 Jul 2018 13:28:58 +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 4F0381841C4A;
Fri, 13 Jul 2018 13:28:58 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com
[10.11.54.6])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w6DDSglT032521 for ;
Fri, 13 Jul 2018 09:28:42 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 22EA421565E2; Fri, 13 Jul 2018 13:28:42 +0000 (UTC)
Received: from localhost (unknown [10.36.112.12])
by smtp.corp.redhat.com (Postfix) with ESMTP id CD61F21565E1;
Fri, 13 Jul 2018 13:28:41 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Fri, 13 Jul 2018 15:28:14 +0200
Message-Id: <20180713132824.8655-8-marcandre.lureau@redhat.com>
In-Reply-To: <20180713132824.8655-1-marcandre.lureau@redhat.com>
References: <20180713132824.8655-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [RFC PATCH 07/17] 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.23
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]);
Fri, 13 Jul 2018 13:29:00 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
From: Marc-Andr=C3=A9 Lureau
To support VGA, we need vhost-user-vga device, for "vhost-user" model.
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_domain.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index b8b5919795..20da58d978 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -10488,6 +10488,10 @@ qemuDomainSupportsVideoVga(virDomainVideoDefPtr vi=
deo,
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_VGA))
return false;
=20
+ if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VHOST_USER &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_USER_VGA))
+ return false;
+
return true;
}
=20
--=20
2.18.0.129.ge3331758f1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sun May 19 05:57:52 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
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1531488546247349.13109433610634;
Fri, 13 Jul 2018 06:29:06 -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 5C371552C7;
Fri, 13 Jul 2018 13:29:03 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 24DD95B687;
Fri, 13 Jul 2018 13:29: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 BD268239;
Fri, 13 Jul 2018 13:29:02 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com
[10.11.54.5])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w6DDSlK6032540 for ;
Fri, 13 Jul 2018 09:28:47 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 194D31C731; Fri, 13 Jul 2018 13:28:47 +0000 (UTC)
Received: from localhost (unknown [10.36.112.12])
by smtp.corp.redhat.com (Postfix) with ESMTP id 08BFB1C730;
Fri, 13 Jul 2018 13:28:43 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Fri, 13 Jul 2018 15:28:15 +0200
Message-Id: <20180713132824.8655-9-marcandre.lureau@redhat.com>
In-Reply-To: <20180713132824.8655-1-marcandre.lureau@redhat.com>
References: <20180713132824.8655-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [RFC PATCH 08/17] qemu: vhost-user is valid as
non-primary video 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.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.29]);
Fri, 13 Jul 2018 13:29:05 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
From: Marc-Andr=C3=A9 Lureau
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_domain.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 20da58d978..59c63fa2a4 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -4492,7 +4492,8 @@ qemuDomainDeviceDefValidateVideo(const virDomainVideo=
Def *video)
=20
if (!video->primary &&
video->type !=3D VIR_DOMAIN_VIDEO_TYPE_QXL &&
- video->type !=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO) {
+ video->type !=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
+ video->type !=3D VIR_DOMAIN_VIDEO_TYPE_VHOST_USER) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("video type '%s' is only valid as primary "
"video device"),
--=20
2.18.0.129.ge3331758f1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sun May 19 05:57:53 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
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1531488538324635.4855495761755;
Fri, 13 Jul 2018 06:28:58 -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 7A5411EB26;
Fri, 13 Jul 2018 13:28:56 +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 3CF1C10694F2;
Fri, 13 Jul 2018 13:28:56 +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 E3C3C4A465;
Fri, 13 Jul 2018 13:28:55 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com
[10.11.54.3])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w6DDSrEQ032554 for ;
Fri, 13 Jul 2018 09:28:53 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 22D3E10FFE54; Fri, 13 Jul 2018 13:28:53 +0000 (UTC)
Received: from localhost (unknown [10.36.112.12])
by smtp.corp.redhat.com (Postfix) with ESMTP id A068F10FFE50;
Fri, 13 Jul 2018 13:28:48 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Fri, 13 Jul 2018 15:28:16 +0200
Message-Id: <20180713132824.8655-10-marcandre.lureau@redhat.com>
In-Reply-To: <20180713132824.8655-1-marcandre.lureau@redhat.com>
References: <20180713132824.8655-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [RFC PATCH 09/17] qemu: validate vhost-user 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.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.26]);
Fri, 13 Jul 2018 13:28:57 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
From: Marc-Andr=C3=A9 Lureau
Check qemu capability, and accept 3d acceleration.
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_process.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index c903a8e5c8..ee4c3445fb 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -4973,6 +4973,8 @@ qemuProcessStartValidateVideo(virDomainObjPtr vm,
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL)) ||
(video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO &&
!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIRTIO_GPU)) ||
+ (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VHOST_USER &&
+ !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))) {
@@ -4983,7 +4985,9 @@ qemuProcessStartValidateVideo(virDomainObjPtr vm,
}
=20
if (video->accel) {
- if (video->accel->accel3d =3D=3D VIR_TRISTATE_SWITCH_ON &&
+ if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VHOST_USER) {
+ continue;
+ } else 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))) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
--=20
2.18.0.129.ge3331758f1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sun May 19 05:57:53 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
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1531488544944759.785852858347;
Fri, 13 Jul 2018 06:29:04 -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 B0EA23082A2A;
Fri, 13 Jul 2018 13:29: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 E73941073028;
Fri, 13 Jul 2018 13:29:01 +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 89AF81841C66;
Fri, 13 Jul 2018 13:29:01 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
[10.11.54.4])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w6DDStdS032559 for ;
Fri, 13 Jul 2018 09:28:55 -0400
Received: by smtp.corp.redhat.com (Postfix)
id F103A2026D76; Fri, 13 Jul 2018 13:28:54 +0000 (UTC)
Received: from localhost (unknown [10.36.112.12])
by smtp.corp.redhat.com (Postfix) with ESMTP id 6E3EE2026D6B;
Fri, 13 Jul 2018 13:28:54 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Fri, 13 Jul 2018 15:28:17 +0200
Message-Id: <20180713132824.8655-11-marcandre.lureau@redhat.com>
In-Reply-To: <20180713132824.8655-1-marcandre.lureau@redhat.com>
References: <20180713132824.8655-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [RFC PATCH 10/17] 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.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.45]);
Fri, 13 Jul 2018 13:29:04 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
From: Marc-Andr=C3=A9 Lureau
See function documentation, used in 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 af3be42854..c722d19ca4 100644
--- a/src/qemu/qemu_security.c
+++ b/src/qemu/qemu_security.c
@@ -426,6 +426,54 @@ qemuSecurityRestoreChardevLabel(virQEMUDriverPtr drive=
r,
}
=20
=20
+/*
+ * qemuSecurityStartVhostUserGPU:
+ *
+ * @driver: the QEMU driver
+ * @def: the domain definition
+ * @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,
+ virDomainDefPtr def,
+ virCommandPtr cmd,
+ int *exitstatus,
+ int *cmdret)
+{
+ int ret =3D -1;
+
+ if (virSecurityManagerSetChildProcessLabel(driver->securityManager,
+ 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 a189b63828..75131120b9 100644
--- a/src/qemu/qemu_security.h
+++ b/src/qemu/qemu_security.h
@@ -84,6 +84,12 @@ int qemuSecurityRestoreChardevLabel(virQEMUDriverPtr dri=
ver,
virDomainObjPtr vm,
virDomainChrDefPtr chr);
=20
+int qemuSecurityStartVhostUserGPU(virQEMUDriverPtr driver,
+ virDomainDefPtr def,
+ virCommandPtr cmd,
+ int *exitstatus,
+ int *cmdret);
+
int qemuSecurityStartTPMEmulator(virQEMUDriverPtr driver,
virDomainDefPtr def,
virCommandPtr cmd,
--=20
2.18.0.129.ge3331758f1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sun May 19 05:57:53 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
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 153148854804013.695620601881501;
Fri, 13 Jul 2018 06:29:08 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com
[10.5.11.27])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id BE86D308212A;
Fri, 13 Jul 2018 13:29:06 +0000 (UTC)
Received: from colo-mx.corp.redhat.com
(colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 8224BC6A34;
Fri, 13 Jul 2018 13:29:06 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 35D0D1841C6E;
Fri, 13 Jul 2018 13:29:06 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com
[10.11.54.6])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w6DDSuvo032569 for ;
Fri, 13 Jul 2018 09:28:56 -0400
Received: by smtp.corp.redhat.com (Postfix)
id AF49F21565E2; Fri, 13 Jul 2018 13:28:56 +0000 (UTC)
Received: from localhost (unknown [10.36.112.12])
by smtp.corp.redhat.com (Postfix) with ESMTP id 2857321565E1;
Fri, 13 Jul 2018 13:28:56 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Fri, 13 Jul 2018 15:28:18 +0200
Message-Id: <20180713132824.8655-12-marcandre.lureau@redhat.com>
In-Reply-To: <20180713132824.8655-1-marcandre.lureau@redhat.com>
References: <20180713132824.8655-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [RFC PATCH 11/17] 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.84 on 10.5.11.27
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]);
Fri, 13 Jul 2018 13:29:07 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
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.
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 | 318 +++++++++++++++++++++++++++++++++
src/qemu/qemu_vhost_user_gpu.h | 48 +++++
4 files changed, 369 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 a31ce9c376..544fd33a33 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -175,6 +175,7 @@ struct _virDomainDeviceInfo {
* cases we might want to prevent that from happening by
* locking the isolation group */
bool isolationGroupLocked;
+ int vhost_user_fd;
};
=20
int virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst,
diff --git a/src/qemu/Makefile.inc.am b/src/qemu/Makefile.inc.am
index 2afa67f195..28daf9d426 100644
--- a/src/qemu/Makefile.inc.am
+++ b/src/qemu/Makefile.inc.am
@@ -56,6 +56,8 @@ QEMU_DRIVER_SOURCES =3D \
qemu/qemu_qapi.h \
qemu/qemu_tpm.c \
qemu/qemu_tpm.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..9007614020
--- /dev/null
+++ b/src/qemu/qemu_vhost_user_gpu.c
@@ -0,0 +1,318 @@
+/*
+ * 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_extdevice.h"
+#include "qemu_domain.h"
+#include "qemu_security.h"
+
+#include "conf/domain_conf.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"
+#include "qemu_vhost_user_gpu.h"
+
+#define VIR_FROM_THIS VIR_FROM_NONE
+
+VIR_LOG_INIT("qemu.vhost-user-gpu")
+
+/*
+ * Look up the vhost-user-gpu executable; to be found on the host
+ */
+static char *vhost_user_gpu_path;
+
+static int
+qemuVhostUserGPUInit(void)
+{
+ if (!vhost_user_gpu_path) {
+ vhost_user_gpu_path =3D virFindFileInPath("vhost-user-gpu");
+ if (!vhost_user_gpu_path) {
+ virReportSystemError(ENOENT, "%s",
+ _("Unable to find 'vhost-user-gpu' binary=
in $PATH"));
+ return -1;
+ }
+ if (!virFileIsExecutable(vhost_user_gpu_path)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("vhost-user-gpu %s is not an executable"),
+ vhost_user_gpu_path);
+ VIR_FREE(vhost_user_gpu_path);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+
+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
+ *
+ * @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 *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, vhost_user_gpu_path);
+
+ VIR_FREE(pidfile);
+
+ return ret;
+}
+
+
+/*
+ * qemuExtVhostUserGPUStart:
+ *
+ * @driver: QEMU driver
+ * @def: domain definition
+ * @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,
+ virDomainDefPtr def,
+ virDomainVideoDefPtr video,
+ qemuDomainLogContextPtr logCtxt)
+{
+ int ret =3D -1;
+ virCommandPtr cmd =3D NULL;
+ int exitstatus =3D 0;
+ char *errbuf =3D NULL;
+ virQEMUDriverConfigPtr cfg;
+ char *pidfile, *shortName =3D virDomainDefGetShortName(def);
+ virTimeBackOffVar timebackoff;
+ const unsigned long long timeout =3D 500000; /* 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, def, video);
+
+ if (!(pidfile =3D qemuVhostUserGPUCreatePidFilename(
+ cfg->stateDir, shortName, video->info.alias)))
+ goto error;
+
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, pair) < 0) {
+ virReportSystemError(errno, "%s", _("failed to create socket"));
+ goto error;
+ }
+
+ cmd =3D virCommandNew(vhost_user_gpu_path);
+ if (!cmd)
+ goto error;
+
+ virCommandClearCaps(cmd);
+ virCommandDaemonize(cmd);
+
+ if (qemuExtDeviceLogCommand(logCtxt, cmd, "vhost-user-gpu") < 0)
+ goto error;
+
+ virCommandAddArgList(cmd, "--pid", pidfile, NULL);
+ virCommandAddArgFormat(cmd, "--fd=3D%d", pair[0]);
+ virCommandPassFD(cmd, pair[0], VIR_COMMAND_PASS_FD_CLOSE_PARENT);
+ pair[0] =3D -1;
+
+ if (video->accel && video->accel->accel3d) {
+ virCommandAddArg(cmd, "--virgl");
+ }
+ if (qemuSecurityStartVhostUserGPU(driver, def, 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(cfg->stateDir, shortName, video->inf=
o.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
+ * @def: domain definition
+ * @video: the video device
+ *
+ * Check if vhost-user process pidfile is around, kill the process,
+ * and remove the pidfile.
+ */
+void qemuExtVhostUserGPUStop(virQEMUDriverPtr driver,
+ virDomainDefPtr def,
+ virDomainVideoDefPtr video)
+{
+ virErrorPtr orig_err;
+ char *pidfile, *shortName =3D virDomainDefGetShortName(def);
+ virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver);
+
+ if (qemuVhostUserGPUInit() < 0)
+ return;
+
+ 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(cfg->stateDir, shortName, video->info.al=
ias, &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 (virCgroupAddTask(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..0f5331cce8
--- /dev/null
+++ b/src/qemu/qemu_vhost_user_gpu.h
@@ -0,0 +1,48 @@
+/*
+ * 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 "qemu_conf.h"
+# include "vircommand.h"
+
+int qemuExtVhostUserGPUStart(virQEMUDriverPtr driver,
+ virDomainDefPtr def,
+ virDomainVideoDefPtr video,
+ qemuDomainLogContextPtr logCtxt)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
+ ATTRIBUTE_RETURN_CHECK;
+
+void qemuExtVhostUserGPUStop(virQEMUDriverPtr driver,
+ virDomainDefPtr 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.18.0.129.ge3331758f1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sun May 19 05:57:53 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
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1531488544356583.752978888864;
Fri, 13 Jul 2018 06:29:04 -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 A81728111D;
Fri, 13 Jul 2018 13:29:01 +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 7156B5D76F;
Fri, 13 Jul 2018 13:29:01 +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 188FF4A469;
Fri, 13 Jul 2018 13:29:01 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
[10.11.54.4])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w6DDSw3L032577 for ;
Fri, 13 Jul 2018 09:28:58 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 2A8412026D76; Fri, 13 Jul 2018 13:28:58 +0000 (UTC)
Received: from localhost (unknown [10.36.112.12])
by smtp.corp.redhat.com (Postfix) with ESMTP id D70F42026D6B;
Fri, 13 Jul 2018 13:28:57 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Fri, 13 Jul 2018 15:28:19 +0200
Message-Id: <20180713132824.8655-13-marcandre.lureau@redhat.com>
In-Reply-To: <20180713132824.8655-1-marcandre.lureau@redhat.com>
References: <20180713132824.8655-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [RFC PATCH 12/17] qemu: restrict 'virgl=' option to
'virtio' 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.15
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]);
Fri, 13 Jul 2018 13:29:03 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
From: Marc-Andr=C3=A9 Lureau
vhost-user doesn't have a virgl option, it's given 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 e78a534628..e85c5c3c1e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4330,9 +4330,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) {
+ 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.18.0.129.ge3331758f1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sun May 19 05:57:53 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
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1531488550246578.1432881199112;
Fri, 13 Jul 2018 06:29:10 -0700 (PDT)
Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com
[10.5.11.26])
(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
(No client certificate requested)
by mx1.redhat.com (Postfix) with ESMTPS id 2667D308124C;
Fri, 13 Jul 2018 13:29: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 E0E75308332E;
Fri, 13 Jul 2018 13:29:06 +0000 (UTC)
Received: from lists01.pubmisc.prod.ext.phx2.redhat.com
(lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33])
by colo-mx.corp.redhat.com (Postfix) with ESMTP id 873E41841C69;
Fri, 13 Jul 2018 13:29:06 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com
[10.11.54.5])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w6DDSxWO032590 for ;
Fri, 13 Jul 2018 09:28:59 -0400
Received: by smtp.corp.redhat.com (Postfix)
id A366F1C730; Fri, 13 Jul 2018 13:28:59 +0000 (UTC)
Received: from localhost (unknown [10.36.112.12])
by smtp.corp.redhat.com (Postfix) with ESMTP id 57D081C734;
Fri, 13 Jul 2018 13:28:59 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Fri, 13 Jul 2018 15:28:20 +0200
Message-Id: <20180713132824.8655-14-marcandre.lureau@redhat.com>
In-Reply-To: <20180713132824.8655-1-marcandre.lureau@redhat.com>
References: <20180713132824.8655-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [RFC PATCH 13/17] qemu: set default address type on
vhost-user 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.84 on 10.5.11.26
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]);
Fri, 13 Jul 2018 13:29:09 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
From: Marc-Andr=C3=A9 Lureau
It's a virtio device, like virtio-gpu.
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_domain_address.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index df98d7384f..476ee2d4a5 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -329,7 +329,8 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr de=
f,
virDomainVideoDefPtr video =3D def->videos[i];
=20
if (video->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
- video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO)
+ (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO ||
+ video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VHOST_USER))
video->info.type =3D type;
}
=20
--=20
2.18.0.129.ge3331758f1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sun May 19 05:57:53 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
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1531488554141994.5658399274571;
Fri, 13 Jul 2018 06:29:14 -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 9EAFB3001FC7;
Fri, 13 Jul 2018 13:29: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 685925FCA9;
Fri, 13 Jul 2018 13:29:12 +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 127011841C7A;
Fri, 13 Jul 2018 13:29:12 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com
[10.11.54.5])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w6DDT5k1032648 for ;
Fri, 13 Jul 2018 09:29:05 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 1A3571C731; Fri, 13 Jul 2018 13:29:05 +0000 (UTC)
Received: from localhost (unknown [10.36.112.12])
by smtp.corp.redhat.com (Postfix) with ESMTP id D27AA1C730;
Fri, 13 Jul 2018 13:29:00 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Fri, 13 Jul 2018 15:28:21 +0200
Message-Id: <20180713132824.8655-15-marcandre.lureau@redhat.com>
In-Reply-To: <20180713132824.8655-1-marcandre.lureau@redhat.com>
References: <20180713132824.8655-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [RFC PATCH 14/17] 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.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]);
Fri, 13 Jul 2018 13:29:13 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
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 | 47 ++++++++++++++++++++++++++++++++++-----
1 file changed, 42 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c
index d982922470..8ec703a9b0 100644
--- a/src/qemu/qemu_extdevice.c
+++ b/src/qemu/qemu_extdevice.c
@@ -25,6 +25,7 @@
#include "qemu_extdevice.h"
#include "qemu_domain.h"
#include "qemu_tpm.h"
+#include "qemu_vhost_user_gpu.h"
=20
#include "viralloc.h"
#include "virlog.h"
@@ -132,11 +133,21 @@ qemuExtDevicesStart(virQEMUDriverPtr driver,
virDomainDefPtr def,
qemuDomainLogContextPtr logCtxt)
{
- int ret =3D 0;
+ int i, ret =3D 0;
=20
if (qemuExtDevicesInitPaths(driver, def) < 0)
return -1;
=20
+ for (i =3D 0; i < def->nvideos; i++) {
+ virDomainVideoDefPtr video =3D def->videos[i];
+
+ if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VHOST_USER) {
+ ret =3D qemuExtVhostUserGPUStart(driver, def, video, logCtxt);
+ if (ret < 0)
+ return ret;
+ }
+ }
+
if (def->tpm)
ret =3D qemuExtTPMStart(driver, def, logCtxt);
=20
@@ -148,9 +159,19 @@ void
qemuExtDevicesStop(virQEMUDriverPtr driver,
virDomainDefPtr def)
{
+ int i;
+
if (qemuExtDevicesInitPaths(driver, def) < 0)
return;
=20
+ for (i =3D 0; i < def->nvideos; i++) {
+ virDomainVideoDefPtr video =3D def->videos[i];
+
+ if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VHOST_USER) {
+ qemuExtVhostUserGPUStop(driver, def, video);
+ }
+ }
+
if (def->tpm)
qemuExtTPMStop(driver, def);
}
@@ -159,6 +180,13 @@ 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_VHOST_USER)
+ return true;
+ }
+
if (def->tpm && def->tpm->type =3D=3D VIR_DOMAIN_TPM_TYPE_EMULATOR)
return true;
=20
@@ -171,10 +199,19 @@ 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_VHOST_USER &&
+ qemuExtVhostUserGPUSetupCgroup(driver, def, video, cgroup) < 0)
+ return -1;
+ }
+
+ if (def->tpm &&
+ qemuExtTPMSetupCgroup(driver, def, cgroup) < 0)
+ return -1;
+
+ return 0;
}
--=20
2.18.0.129.ge3331758f1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sun May 19 05:57:53 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
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1531488553457822.0681179461584;
Fri, 13 Jul 2018 06:29: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 3DEAD30E6875;
Fri, 13 Jul 2018 13:29:12 +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 F170E5D969;
Fri, 13 Jul 2018 13:29: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 A35863FA54;
Fri, 13 Jul 2018 13:29:11 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com
[10.11.54.4])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w6DDT6MW032664 for ;
Fri, 13 Jul 2018 09:29:06 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 9DD242026D76; Fri, 13 Jul 2018 13:29:06 +0000 (UTC)
Received: from localhost (unknown [10.36.112.12])
by smtp.corp.redhat.com (Postfix) with ESMTP id 519932026D6B;
Fri, 13 Jul 2018 13:29:06 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Fri, 13 Jul 2018 15:28:22 +0200
Message-Id: <20180713132824.8655-16-marcandre.lureau@redhat.com>
In-Reply-To: <20180713132824.8655-1-marcandre.lureau@redhat.com>
References: <20180713132824.8655-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [RFC PATCH 15/17] qemu: build vhost-user-backend 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.14
X-Greylist: Sender IP whitelisted,
not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]);
Fri, 13 Jul 2018 13:29:12 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
From: Marc-Andr=C3=A9 Lureau
Pass the vhost-user socket to a chardev, and associate a
vhost-user-backend with it for each vhost-user-gpu.
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_command.c | 50 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index e85c5c3c1e..b3a2bba28e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4475,6 +4475,38 @@ qemuBuildVgaVideoCommand(virCommandPtr cmd,
}
=20
=20
+static char *
+qemuBuildVhostUserBackendStr(virDomainVideoDefPtr video,
+ virCommandPtr cmd,
+ char **chardev)
+{
+ virBuffer buf =3D VIR_BUFFER_INITIALIZER;
+
+ if (virAsprintf(chardev, "socket,id=3Dchr-vu-%s,fd=3D%d",
+ video->info.alias, video->info.vhost_user_fd) < 0)
+ goto error;
+
+ virCommandPassFD(cmd, video->info.vhost_user_fd,
+ VIR_COMMAND_PASS_FD_CLOSE_PARENT);
+
+ video->info.vhost_user_fd =3D -1;
+
+ virBufferAsprintf(&buf, "vhost-user-backend,id=3Dvu-%s,chardev=3Dchr-v=
u-%s",
+ video->info.alias, video->info.alias);
+
+ if (virBufferCheckError(&buf) < 0)
+ goto error;
+
+ return virBufferContentAndReset(&buf);
+
+error:
+ VIR_FREE(*chardev);
+ virBufferFreeAndReset(&buf);
+ return NULL;
+
+}
+
+
static int
qemuBuildVideoCommandLine(virCommandPtr cmd,
const virDomainDef *def,
@@ -4482,6 +4514,24 @@ qemuBuildVideoCommandLine(virCommandPtr cmd,
{
size_t i;
=20
+ for (i =3D 0; i < def->nvideos; i++) {
+ char *optstr;
+ char *chardev =3D NULL;
+ virDomainVideoDefPtr video =3D def->videos[i];
+
+ if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VHOST_USER) {
+
+ if (!(optstr =3D qemuBuildVhostUserBackendStr(video, cmd, &cha=
rdev)))
+ return -1;
+
+ virCommandAddArgList(cmd, "-chardev", chardev, NULL);
+ virCommandAddArgList(cmd, "-object", optstr, NULL);
+
+ VIR_FREE(optstr);
+ VIR_FREE(chardev);
+ }
+ }
+
for (i =3D 0; i < def->nvideos; i++) {
char *str =3D NULL;
virDomainVideoDefPtr video =3D def->videos[i];
--=20
2.18.0.129.ge3331758f1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sun May 19 05:57:53 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
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 153148856115457.04095764327485;
Fri, 13 Jul 2018 06:29:21 -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 163F381121;
Fri, 13 Jul 2018 13:29:17 +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 C59DD26DD3;
Fri, 13 Jul 2018 13:29:16 +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 7413118434AB;
Fri, 13 Jul 2018 13:29:16 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com
[10.11.54.3])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w6DDTCVh032711 for ;
Fri, 13 Jul 2018 09:29:12 -0400
Received: by smtp.corp.redhat.com (Postfix)
id C558C10FFE50; Fri, 13 Jul 2018 13:29:12 +0000 (UTC)
Received: from localhost (unknown [10.36.112.12])
by smtp.corp.redhat.com (Postfix) with ESMTP id 1EDD610FFE54;
Fri, 13 Jul 2018 13:29:07 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Fri, 13 Jul 2018 15:28:23 +0200
Message-Id: <20180713132824.8655-17-marcandre.lureau@redhat.com>
In-Reply-To: <20180713132824.8655-1-marcandre.lureau@redhat.com>
References: <20180713132824.8655-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [RFC PATCH 16/17] qemu: build vhost-user-gpu video device
arguments
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.28]);
Fri, 13 Jul 2018 13:29:20 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
From: Marc-Andr=C3=A9 Lureau
Change the model name to "vhost-user-gpu-pci" if running on PCI.
Set the "max_outputs" property.
Associate the device with the "vhost-user" backend.
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
src/qemu/qemu_command.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index b3a2bba28e..b4afcd2e8c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4319,7 +4319,7 @@ qemuBuildDeviceVideoStr(const virDomainDef *def,
goto error;
}
=20
- if (STREQ(model, "virtio-gpu")) {
+ if (STREQ(model, "virtio-gpu") || STREQ(model, "vhost-user-gpu")) {
if (video->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW)
virBufferAsprintf(&buf, "%s-ccw", model);
else
@@ -4367,6 +4367,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_VHOST_USER) {
+ if (video->heads)
+ virBufferAsprintf(&buf, ",max_outputs=3D%u", video->heads);
+ virBufferAsprintf(&buf, ",vhost-user=3Dvu-%s", video->info.alias);
} else if (video->vram &&
((video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VGA &&
virQEMUCapsGet(qemuCaps, QEMU_CAPS_VGA_VGAMEM)) ||
--=20
2.18.0.129.ge3331758f1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
From nobody Sun May 19 05:57:53 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
Return-Path:
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by
mx.zohomail.com
with SMTPS id 1531488562396919.8916836512786;
Fri, 13 Jul 2018 06:29:22 -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 14CD7307DA2B;
Fri, 13 Jul 2018 13:29:21 +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 CA99760177;
Fri, 13 Jul 2018 13:29: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 73C311800542;
Fri, 13 Jul 2018 13:29:20 +0000 (UTC)
Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com
[10.11.54.5])
by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
id w6DDTEhY032719 for ;
Fri, 13 Jul 2018 09:29:14 -0400
Received: by smtp.corp.redhat.com (Postfix)
id 6A73F1C731; Fri, 13 Jul 2018 13:29:14 +0000 (UTC)
Received: from localhost (unknown [10.36.112.12])
by smtp.corp.redhat.com (Postfix) with ESMTP id 052AA1C730;
Fri, 13 Jul 2018 13:29:13 +0000 (UTC)
From: marcandre.lureau@redhat.com
To: libvir-list@redhat.com
Date: Fri, 13 Jul 2018 15:28:24 +0200
Message-Id: <20180713132824.8655-18-marcandre.lureau@redhat.com>
In-Reply-To: <20180713132824.8655-1-marcandre.lureau@redhat.com>
References: <20180713132824.8655-1-marcandre.lureau@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5
X-loop: libvir-list@redhat.com
Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?=
Subject: [libvirt] [RFC PATCH 17/17] 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.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.41]);
Fri, 13 Jul 2018 13:29:21 +0000 (UTC)
X-ZohoMail: RSF_0 Z_629925259 SPT_0
From: Marc-Andr=C3=A9 Lureau
Signed-off-by: Marc-Andr=C3=A9 Lureau
---
.../vhost-user-gpu-secondary.args | 34 +++++++++++++++++
.../vhost-user-gpu-secondary.xml | 38 +++++++++++++++++++
tests/qemuxml2argvdata/vhost-user-vga.args | 31 +++++++++++++++
tests/qemuxml2argvdata/vhost-user-vga.xml | 35 +++++++++++++++++
tests/qemuxml2argvtest.c | 12 ++++++
5 files changed, 150 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..0aee4f50ec
--- /dev/null
+++ b/tests/qemuxml2argvdata/vhost-user-gpu-secondary.args
@@ -0,0 +1,34 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/home/test \
+USER=3Dtest \
+LOGNAME=3Dtest \
+QEMU_AUDIO_DRV=3Dnone \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \
+-m 214 \
+-smp 1,sockets=3D1,cores=3D1,threads=3D1 \
+-object memory-backend-memfd,id=3Dram-node,size=3D224395264 \
+-numa node,nodeid=3D0,memdev=3Dram-node \
+-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 \
+-boot c \
+-usb \
+-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide=
0-0-0 \
+-device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-=
0 \
+-chardev socket,id=3Dchr-vu-video0,fd=3D0 \
+-object vhost-user-backend,id=3Dvu-video0,chardev=3Dchr-vu-video0 \
+-chardev socket,id=3Dchr-vu-video1,fd=3D0 \
+-object vhost-user-backend,id=3Dvu-video1,chardev=3Dchr-vu-video1 \
+-device vhost-user-vga,id=3Dvideo0,max_outputs=3D1,vhost-user=3Dvu-video0,=
bus=3Dpci.0,addr=3D0x2 \
+-device vhost-user-gpu-pci,id=3Dvideo1,max_outputs=3D1,vhost-user=3Dvu-vid=
eo1,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..f91be819f6
--- /dev/null
+++ b/tests/qemuxml2argvdata/vhost-user-gpu-secondary.xml
@@ -0,0 +1,38 @@
+
+ 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..fbaea7e371
--- /dev/null
+++ b/tests/qemuxml2argvdata/vhost-user-vga.args
@@ -0,0 +1,31 @@
+LC_ALL=3DC \
+PATH=3D/bin \
+HOME=3D/home/test \
+USER=3Dtest \
+LOGNAME=3Dtest \
+QEMU_AUDIO_DRV=3Dnone \
+/usr/bin/qemu-system-i686 \
+-name QEMUGuest1 \
+-S \
+-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \
+-m 214 \
+-smp 1,sockets=3D1,cores=3D1,threads=3D1 \
+-object memory-backend-memfd,id=3Dram-node,size=3D224395264 \
+-numa node,nodeid=3D0,memdev=3Dram-node \
+-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 \
+-boot c \
+-usb \
+-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide=
0-0-0 \
+-device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-=
0 \
+-chardev socket,id=3Dchr-vu-video0,fd=3D0 \
+-object vhost-user-backend,id=3Dvu-video0,chardev=3Dchr-vu-video0 \
+-device vhost-user-vga,id=3Dvideo0,max_outputs=3D1,vhost-user=3Dvu-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..db38b5a45e
--- /dev/null
+++ b/tests/qemuxml2argvdata/vhost-user-vga.xml
@@ -0,0 +1,35 @@
+
+ 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 47bd2ab867..d78caa6a37 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2921,6 +2921,18 @@ mymain(void)
QEMU_CAPS_KVM,
QEMU_CAPS_SEV_GUEST);
=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.18.0.129.ge3331758f1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list