From nobody Mon Apr 29 16:17:19 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 1535492389664424.793798792663; Tue, 28 Aug 2018 14:39:49 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6859F3086262; Tue, 28 Aug 2018 21:39:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F806694AE; Tue, 28 Aug 2018 21:39:47 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 95D1F4BB75; Tue, 28 Aug 2018 21:39:45 +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 w7SLdi8P020589 for ; Tue, 28 Aug 2018 17:39:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2012A101040A; Tue, 28 Aug 2018 21:39:44 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD0C0101040F; Tue, 28 Aug 2018 21:39:39 +0000 (UTC) From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Date: Tue, 28 Aug 2018 23:39:19 +0200 Message-Id: <20180828213934.29749-2-marcandre.lureau@redhat.com> In-Reply-To: <20180828213934.29749-1-marcandre.lureau@redhat.com> References: <20180828213934.29749-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: phrdina@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mprivozn@redhat.com Subject: [libvirt] [RFC v2 01/16] 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 28 Aug 2018 21:39:48 +0000 (UTC) X-ZohoMail: RDMRC_0 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.riscv32.xml | 1 + tests/qemucapabilitiesdata/caps_3.0.0.riscv64.xml | 1 + tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml | 1 + 10 files changed, 11 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index a075677421..2c2f193aae 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -508,6 +508,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, /* 315 */ "vfio-pci.display", "blockdev", + "memory-backend-memfd", ); =20 =20 @@ -1148,6 +1149,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 3d3a978759..24ce4545a4 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -492,6 +492,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ /* 315 */ QEMU_CAPS_VFIO_PCI_DISPLAY, /* -device vfio-pci.display */ QEMU_CAPS_BLOCKDEV, /* -blockdev and blockdev-add are supported */ + 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 3c1a704100..a1f5111fc4 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 347144 diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.ppc64.xml b/tests/qemuc= apabilitiesdata/caps_2.12.0.ppc64.xml index 877362eaef..c246e5c94a 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 427928 diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.s390x.xml b/tests/qemuc= apabilitiesdata/caps_2.12.0.s390x.xml index b8e46a970a..2e6baf42a7 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 375593 diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.x86_64.xml b/tests/qemu= capabilitiesdata/caps_2.12.0.x86_64.xml index edf944bc35..4b410997d1 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 415790 diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_3.0.0.ppc64.xml index 6892c9bd64..a9967d67a3 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 446365 diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.riscv32.xml b/tests/qemu= capabilitiesdata/caps_3.0.0.riscv32.xml index 39cc480dd2..183ad7cc6c 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.riscv32.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.riscv32.xml @@ -104,6 +104,7 @@ + 3000000 0 0 diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.riscv64.xml b/tests/qemu= capabilitiesdata/caps_3.0.0.riscv64.xml index 344740879e..f2f32e3025 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.riscv64.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.riscv64.xml @@ -104,6 +104,7 @@ + 3000000 0 0 diff --git a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_3.0.0.x86_64.xml index 747f51b799..e4665af165 100644 --- a/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_3.0.0.x86_64.xml @@ -213,6 +213,7 @@ + 3000000 0 427391 --=20 2.19.0.rc0.48.gb9dfa238d5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 16:17:19 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 1535492390456946.9528961079; Tue, 28 Aug 2018 14:39:50 -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 6609D3082DD0; Tue, 28 Aug 2018 21:39:48 +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 2CC5060F85; Tue, 28 Aug 2018 21:39:48 +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 DFC524BB7F; Tue, 28 Aug 2018 21:39:47 +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 w7SLdjGP020597 for ; Tue, 28 Aug 2018 17:39:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id ADA5B10073B2; Tue, 28 Aug 2018 21:39:45 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3219510EE787; Tue, 28 Aug 2018 21:39:45 +0000 (UTC) From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Date: Tue, 28 Aug 2018 23:39:20 +0200 Message-Id: <20180828213934.29749-3-marcandre.lureau@redhat.com> In-Reply-To: <20180828213934.29749-1-marcandre.lureau@redhat.com> References: <20180828213934.29749-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: phrdina@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mprivozn@redhat.com Subject: [libvirt] [RFC v2 02/16] qemu: add memfd memory backing 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.46]); Tue, 28 Aug 2018 21:39:48 +0000 (UTC) X-ZohoMail: RDMRC_0 RSF_0 Z_629925259 SPT_0 From: Marc-Andr=C3=A9 Lureau Add a new memoryBacking source type "memfd", support by QEMU (when the capability is available). Sealing is enabled by default in qemu, and hugepage is easier to setup, which makes it often a better choice than memory-backend-file. Signed-off-by: Marc-Andr=C3=A9 Lureau --- docs/formatdomain.html.in | 8 ++- docs/schemas/domaincommon.rng | 1 + src/conf/domain_conf.c | 3 +- src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 62 +++++++++++++------ tests/qemuxml2argvdata/memfd-memory-numa.args | 27 ++++++++ tests/qemuxml2argvdata/memfd-memory-numa.xml | 33 ++++++++++ tests/qemuxml2argvtest.c | 3 + 8 files changed, 116 insertions(+), 22 deletions(-) create mode 100644 tests/qemuxml2argvdata/memfd-memory-numa.args create mode 100644 tests/qemuxml2argvdata/memfd-memory-numa.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index eb619a1656..ca656c9f7e 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1099,7 +1099,7 @@ </hugepages> <nosharepages/> <locked/> - <source type=3D"file|anonymous"/> + <source type=3D"file|anonymous|memfd"/> <access mode=3D"shared|private"/> <allocation mode=3D"immediate|ondemand"/> <discard/> @@ -1150,8 +1150,10 @@ suitable for the specific environment at the same time to mitigate the risks described above. Since 1.0.6
source
-
In this attribute you can switch to file memorybacking or keep - default anonymous.
+
In this attribute you can switch to file memorybacking or + keep default anonymous. Since 4.8.0, + you may choose memfd backing. (QEMU/KVM only) +
access
Specify if memory is shared or private. This can be overridden = per numa node by memAccess
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 3796eb4b5e..04d7b69dd7 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -655,6 +655,7 @@ file anonymous + memfd diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 38cac07913..b3a1158e75 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -908,7 +908,8 @@ VIR_ENUM_IMPL(virDomainDiskMirrorState, VIR_DOMAIN_DISK= _MIRROR_STATE_LAST, VIR_ENUM_IMPL(virDomainMemorySource, VIR_DOMAIN_MEMORY_SOURCE_LAST, "none", "file", - "anonymous") + "anonymous", + "memfd") =20 VIR_ENUM_IMPL(virDomainMemoryAllocation, VIR_DOMAIN_MEMORY_ALLOCATION_LAST, "none", diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 8a3673361a..e72b824226 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -607,6 +607,7 @@ typedef enum { VIR_DOMAIN_MEMORY_SOURCE_NONE =3D 0, /* No memory source defined */ VIR_DOMAIN_MEMORY_SOURCE_FILE, /* Memory source is set as file */ VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS, /* Memory source is set as anonymo= us */ + VIR_DOMAIN_MEMORY_SOURCE_MEMFD, /* Memory source is set as memfd */ =20 VIR_DOMAIN_MEMORY_SOURCE_LAST, } virDomainMemorySource; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 8aa20496bc..830695a147 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3100,6 +3100,24 @@ qemuBuildControllerDevCommandLine(virCommandPtr cmd, return ret; } =20 +static int +qemuBuildMemoryBackendPropsShare(virJSONValuePtr props, + virDomainMemoryAccess memAccess) +{ + switch (memAccess) { + case VIR_DOMAIN_MEMORY_ACCESS_SHARED: + return virJSONValueObjectAdd(props, "b:share", true, NULL); + + case VIR_DOMAIN_MEMORY_ACCESS_PRIVATE: + return virJSONValueObjectAdd(props, "b:share", false, NULL); + + case VIR_DOMAIN_MEMORY_ACCESS_DEFAULT: + case VIR_DOMAIN_MEMORY_ACCESS_LAST: + break; + } + + return 0; +} =20 /** * qemuBuildMemoryBackendProps: @@ -3246,7 +3264,18 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backend= Props, if (!(props =3D virJSONValueNewObject())) return -1; =20 - if (useHugepage || mem->nvdimmPath || memAccess || + if (def->mem.source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_MEMFD) { + backendType =3D "memory-backend-memfd"; + + if (qemuBuildMemoryBackendPropsShare(props, memAccess) < 0) { + goto cleanup; + } + if (useHugepage && + (virJSONValueObjectAdd(props, "b:hugetlb", useHugepage, NULL) = < 0 || + virJSONValueObjectAdd(props, "U:hugetlbsize", pagesize << 10,= NULL) < 0)) { + goto cleanup; + } + } else if (useHugepage || mem->nvdimmPath || memAccess || def->mem.source =3D=3D VIR_DOMAIN_MEMORY_SOURCE_FILE) { =20 if (mem->nvdimmPath) { @@ -3284,20 +3313,8 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backend= Props, goto cleanup; } =20 - switch (memAccess) { - case VIR_DOMAIN_MEMORY_ACCESS_SHARED: - if (virJSONValueObjectAdd(props, "b:share", true, NULL) < 0) - goto cleanup; - break; - - case VIR_DOMAIN_MEMORY_ACCESS_PRIVATE: - if (virJSONValueObjectAdd(props, "b:share", false, NULL) < 0) - goto cleanup; - break; - - case VIR_DOMAIN_MEMORY_ACCESS_DEFAULT: - case VIR_DOMAIN_MEMORY_ACCESS_LAST: - break; + if (qemuBuildMemoryBackendPropsShare(props, memAccess) < 0) { + goto cleanup; } } else { backendType =3D "memory-backend-ram"; @@ -3346,6 +3363,12 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backend= Props, _("this qemu doesn't support the " "memory-backend-ram object")); goto cleanup; + } else if (STREQ(backendType, "memory-backend-memfd") && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_MEMFD= )) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this qemu doesn't support the " + "memory-backend-memfd object")); + goto cleanup; } =20 ret =3D 0; @@ -7650,7 +7673,8 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, =20 if (virDomainNumatuneHasPerNodeBinding(def->numa) && !(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))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Per-node memory binding is not supported " "with this QEMU")); @@ -7659,7 +7683,8 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg, =20 if (def->mem.nhugepages && def->mem.hugepages[0].size !=3D system_page_size && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE)) { + !(virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_FILE) || + virQEMUCapsGet(qemuCaps, QEMU_CAPS_OBJECT_MEMORY_MEMFD))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("huge pages per NUMA node are not " "supported with this QEMU")); @@ -7676,7 +7701,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 ((rc =3D qemuBuildMemoryCellBackendStr(def, cfg, i, priv, &nodeBackends[i])) < 0) diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.args b/tests/qemuxml2= argvdata/memfd-memory-numa.args new file mode 100644 index 0000000000..04b28a8085 --- /dev/null +++ b/tests/qemuxml2argvdata/memfd-memory-numa.args @@ -0,0 +1,27 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-x86_64 \ +-name instance-00000092 \ +-S \ +-machine pc-i440fx-wily,accel=3Dkvm,usb=3Doff,dump-guest-core=3Doff \ +-m 14336 \ +-mem-prealloc \ +-smp 20,sockets=3D1,cores=3D8,threads=3D1 \ +-object memory-backend-memfd,id=3Dram-node0,share=3Dyes,hugetlb=3Dyes,huge= tlbsize=3D2097152,size=3D15032385536 \ +-numa node,nodeid=3D0,cpus=3D0-7,memdev=3Dram-node0 \ +-uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,\ +path=3D/tmp/lib/domain--1-instance-00000092/monitor.sock,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.xml b/tests/qemuxml2a= rgvdata/memfd-memory-numa.xml new file mode 100644 index 0000000000..868e3c765f --- /dev/null +++ b/tests/qemuxml2argvdata/memfd-memory-numa.xml @@ -0,0 +1,33 @@ + + instance-00000092 + 126f2720-6f8e-45ab-a886-ec9277079a67 + 14680064 + 14680064 + + + + + + + + + 20 + + hvm + + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 16c3540798..84edbe7230 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2921,6 +2921,9 @@ mymain(void) DO_TEST("fd-memory-no-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_KVM); =20 + DO_TEST("memfd-memory-numa", QEMU_CAPS_OBJECT_MEMORY_MEMFD, + QEMU_CAPS_KVM); + DO_TEST("cpu-check-none", QEMU_CAPS_KVM); DO_TEST("cpu-check-partial", QEMU_CAPS_KVM); DO_TEST("cpu-check-full", QEMU_CAPS_KVM); --=20 2.19.0.rc0.48.gb9dfa238d5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 16:17:19 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 1535492431545453.79436731328076; Tue, 28 Aug 2018 14:40:31 -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 74D93307D847; Tue, 28 Aug 2018 21:40:29 +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 4303087B1; Tue, 28 Aug 2018 21:40:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id E9FFD181A139; Tue, 28 Aug 2018 21:40:28 +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 w7SLdox2020609 for ; Tue, 28 Aug 2018 17:39:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9EB602027058; Tue, 28 Aug 2018 21:39:50 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 881462026D6B; Tue, 28 Aug 2018 21:39:46 +0000 (UTC) From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Date: Tue, 28 Aug 2018 23:39:21 +0200 Message-Id: <20180828213934.29749-4-marcandre.lureau@redhat.com> In-Reply-To: <20180828213934.29749-1-marcandre.lureau@redhat.com> References: <20180828213934.29749-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: phrdina@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mprivozn@redhat.com Subject: [libvirt] [RFC v2 03/16] qemu: add vhost-user-gpu capabilities checks X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 28 Aug 2018 21:40:30 +0000 (UTC) X-ZohoMail: RDMRC_0 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 | 4 ++++ src/qemu/qemu_capabilities.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 2c2f193aae..c0481b135d 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -509,6 +509,8 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "vfio-pci.display", "blockdev", "memory-backend-memfd", + "vhost-user-gpu", + "vhost-user-vga", ); =20 =20 @@ -1150,6 +1152,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 24ce4545a4..ede38085db 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -493,6 +493,8 @@ typedef enum { /* virQEMUCapsFlags grouping marker for = syntax-check */ QEMU_CAPS_VFIO_PCI_DISPLAY, /* -device vfio-pci.display */ QEMU_CAPS_BLOCKDEV, /* -blockdev and blockdev-add are supported */ QEMU_CAPS_OBJECT_MEMORY_MEMFD, /* -object memory-backend-memfd */ + QEMU_CAPS_DEVICE_VHOST_USER_GPU, /* -device vhost-user-gpu */ + QEMU_CAPS_DEVICE_VHOST_USER_VGA, /* -device vhost-user-vga */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; --=20 2.19.0.rc0.48.gb9dfa238d5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 16:17:19 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 153549240997173.29401086198538; Tue, 28 Aug 2018 14:40:09 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 13A063086248; Tue, 28 Aug 2018 21:40:08 +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 CC018831C2; Tue, 28 Aug 2018 21:40:07 +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 6D5664BB74; Tue, 28 Aug 2018 21:40:07 +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 w7SLdqvK020614 for ; Tue, 28 Aug 2018 17:39:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1A569A30D9; Tue, 28 Aug 2018 21:39:52 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id AEDFBA30A6; Tue, 28 Aug 2018 21:39:51 +0000 (UTC) From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Date: Tue, 28 Aug 2018 23:39:22 +0200 Message-Id: <20180828213934.29749-5-marcandre.lureau@redhat.com> In-Reply-To: <20180828213934.29749-1-marcandre.lureau@redhat.com> References: <20180828213934.29749-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: phrdina@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mprivozn@redhat.com Subject: [libvirt] [RFC v2 04/16] 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 28 Aug 2018 21:40:08 +0000 (UTC) X-ZohoMail: RDMRC_0 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 | 3 ++- 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, 16 insertions(+), 5 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index ca656c9f7e..587ea98993 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -6775,7 +6775,8 @@ qemu-kvm -net nic,model=3D? /dev/null "vbox", "qxl" (since 0.8.6), "virtio" (since 1.3.0), "gop" (since 3.2.0), or - "none" (since 4.6.0) + "none" (since 4.6.0), or + "vhost-user" (since 4.8.0) depending on the hypervisor features available. The purpose of the type none is to instruct libvirt= not to add a default video device in the guest (see the paragraph ab= ove). diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 04d7b69dd7..76475a5c69 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3495,6 +3495,7 @@ virtio gop none + vhost-user diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b3a1158e75..6afc5099f5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -595,7 +595,8 @@ VIR_ENUM_IMPL(virDomainVideo, VIR_DOMAIN_VIDEO_TYPE_LAS= T, "parallels", "virtio", "gop", - "none") + "none", + "vhost-user") =20 VIR_ENUM_IMPL(virDomainVideoVGAConf, VIR_DOMAIN_VIDEO_VGACONF_LAST, "io", @@ -15257,6 +15258,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_NONE: case VIR_DOMAIN_VIDEO_TYPE_LAST: diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e72b824226..7ac39e2159 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1427,6 +1427,7 @@ typedef enum { VIR_DOMAIN_VIDEO_TYPE_VIRTIO, VIR_DOMAIN_VIDEO_TYPE_GOP, VIR_DOMAIN_VIDEO_TYPE_NONE, + 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 830695a147..824e78c0ec 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -106,7 +106,8 @@ VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST, "", /* don't support parallels */ "", /* no need for virtio */ "" /* don't support gop */, - "" /* 'none' doesn't make sense here */); + "" /* 'none' doesn't make sense here */, + "", /* no need for virtio */); =20 VIR_ENUM_DECL(qemuDeviceVideo) =20 @@ -121,7 +122,8 @@ VIR_ENUM_IMPL(qemuDeviceVideo, VIR_DOMAIN_VIDEO_TYPE_LA= ST, "", /* don't support parallels */ "virtio-vga", "" /* don't support gop */, - "" /* 'none' doesn't make sense here */); + "" /* 'none' doesn't make sense here */, + "vhost-user-vga"); =20 VIR_ENUM_DECL(qemuDeviceVideoSecondary) =20 @@ -136,7 +138,8 @@ VIR_ENUM_IMPL(qemuDeviceVideoSecondary, VIR_DOMAIN_VIDE= O_TYPE_LAST, "", /* don't support parallels */ "virtio-gpu", "" /* don't support gop */, - "" /* 'none' doesn't make sense here */); + "" /* 'none' doesn't make sense here */, + "vhost-user-gpu"); =20 VIR_ENUM_DECL(qemuSoundCodec) =20 diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d052bf4ca8..c8ba7f9cd9 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4613,6 +4613,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 dda14adeb3..5aaf77028b 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -815,6 +815,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 eafba1ae5b..1a167de4fb 100644 --- a/tests/domaincapsschemadata/full.xml +++ b/tests/domaincapsschemadata/full.xml @@ -75,6 +75,7 @@ virtio gop none + vhost-user --=20 2.19.0.rc0.48.gb9dfa238d5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 16:17:19 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 1535492414805875.2506020383436; Tue, 28 Aug 2018 14:40:14 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CB9F03082A35; Tue, 28 Aug 2018 21:40: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 88C8A831D2; Tue, 28 Aug 2018 21:40: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 3AF60181A139; Tue, 28 Aug 2018 21:40:12 +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 w7SLdvK0020630 for ; Tue, 28 Aug 2018 17:39:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5A6F32166BA1; Tue, 28 Aug 2018 21:39:57 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A3D42166B41; Tue, 28 Aug 2018 21:39:53 +0000 (UTC) From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Date: Tue, 28 Aug 2018 23:39:23 +0200 Message-Id: <20180828213934.29749-6-marcandre.lureau@redhat.com> In-Reply-To: <20180828213934.29749-1-marcandre.lureau@redhat.com> References: <20180828213934.29749-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: phrdina@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mprivozn@redhat.com Subject: [libvirt] [RFC v2 05/16] 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.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 28 Aug 2018 21:40:13 +0000 (UTC) X-ZohoMail: RDMRC_0 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 c0481b135d..0bf10b32eb 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -5243,6 +5243,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.19.0.rc0.48.gb9dfa238d5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 16:17:19 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 1535492410433819.9805718543073; Tue, 28 Aug 2018 14:40:10 -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 08FFAC050E00; Tue, 28 Aug 2018 21:40:08 +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 B7438170FC; Tue, 28 Aug 2018 21:40:07 +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 5B74E18005DF; Tue, 28 Aug 2018 21:40:07 +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 w7SLe2AF020649 for ; Tue, 28 Aug 2018 17:40:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id AC26F1010409; Tue, 28 Aug 2018 21:40:02 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6ECF3101040F; Tue, 28 Aug 2018 21:39:58 +0000 (UTC) From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Date: Tue, 28 Aug 2018 23:39:24 +0200 Message-Id: <20180828213934.29749-7-marcandre.lureau@redhat.com> In-Reply-To: <20180828213934.29749-1-marcandre.lureau@redhat.com> References: <20180828213934.29749-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: phrdina@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mprivozn@redhat.com Subject: [libvirt] [RFC v2 06/16] 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.32]); Tue, 28 Aug 2018 21:40:08 +0000 (UTC) X-ZohoMail: RDMRC_0 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 c8ba7f9cd9..57a7546d5b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -10768,6 +10768,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.19.0.rc0.48.gb9dfa238d5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 16:17:19 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 1535492435509149.3139063829732; Tue, 28 Aug 2018 14:40:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 487423002061; Tue, 28 Aug 2018 21:40:33 +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 12DE6831C7; Tue, 28 Aug 2018 21:40:33 +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 B73994A472; Tue, 28 Aug 2018 21:40:32 +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 w7SLe5IU020658 for ; Tue, 28 Aug 2018 17:40:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 088212027059; Tue, 28 Aug 2018 21:40:05 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id B27BB2027056; Tue, 28 Aug 2018 21:40:03 +0000 (UTC) From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Date: Tue, 28 Aug 2018 23:39:25 +0200 Message-Id: <20180828213934.29749-8-marcandre.lureau@redhat.com> In-Reply-To: <20180828213934.29749-1-marcandre.lureau@redhat.com> References: <20180828213934.29749-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: phrdina@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mprivozn@redhat.com Subject: [libvirt] [RFC v2 07/16] 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 28 Aug 2018 21:40:34 +0000 (UTC) X-ZohoMail: RDMRC_0 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 57a7546d5b..85e749cb56 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4620,7 +4620,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.19.0.rc0.48.gb9dfa238d5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 16:17:19 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 1535492440265273.32173532511365; Tue, 28 Aug 2018 14:40:40 -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 7017883F51; Tue, 28 Aug 2018 21:40:37 +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 3D197A2771; Tue, 28 Aug 2018 21:40: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 EB3B44A46C; Tue, 28 Aug 2018 21:40:36 +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 w7SLe6hd020668 for ; Tue, 28 Aug 2018 17:40:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7CD2F2166BA8; Tue, 28 Aug 2018 21:40:06 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 232702166BA1; Tue, 28 Aug 2018 21:40:05 +0000 (UTC) From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Date: Tue, 28 Aug 2018 23:39:26 +0200 Message-Id: <20180828213934.29749-9-marcandre.lureau@redhat.com> In-Reply-To: <20180828213934.29749-1-marcandre.lureau@redhat.com> References: <20180828213934.29749-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: phrdina@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mprivozn@redhat.com Subject: [libvirt] [RFC v2 08/16] 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.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 28 Aug 2018 21:40:39 +0000 (UTC) X-ZohoMail: RDMRC_0 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 960c3ed011..027a608367 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5025,6 +5025,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))) { @@ -5035,7 +5037,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.19.0.rc0.48.gb9dfa238d5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 16:17:19 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 1535492444793553.6120153639329; Tue, 28 Aug 2018 14:40:44 -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 8720286672; Tue, 28 Aug 2018 21:40:41 +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 4A8E518976; Tue, 28 Aug 2018 21:40:41 +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 F2F964A476; Tue, 28 Aug 2018 21:40:40 +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 w7SLe7V5020675 for ; Tue, 28 Aug 2018 17:40:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id D4C191010409; Tue, 28 Aug 2018 21:40:07 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8893C10073B2; Tue, 28 Aug 2018 21:40:07 +0000 (UTC) From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Date: Tue, 28 Aug 2018 23:39:27 +0200 Message-Id: <20180828213934.29749-10-marcandre.lureau@redhat.com> In-Reply-To: <20180828213934.29749-1-marcandre.lureau@redhat.com> References: <20180828213934.29749-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: phrdina@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mprivozn@redhat.com Subject: [libvirt] [RFC v2 09/16] qemu: add qemuSecurityStartVhostUserGPU helper X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 28 Aug 2018 21:40:43 +0000 (UTC) X-ZohoMail: RDMRC_0 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.19.0.rc0.48.gb9dfa238d5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 16:17:19 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 153549241881286.42262631193921; Tue, 28 Aug 2018 14:40:18 -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 C9C7281F0E; Tue, 28 Aug 2018 21:40:16 +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 90B7789E8B; Tue, 28 Aug 2018 21:40: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 420B94A469; Tue, 28 Aug 2018 21:40:16 +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 w7SLeD2j020691 for ; Tue, 28 Aug 2018 17:40:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0DC66A9E89; Tue, 28 Aug 2018 21:40:13 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id B3363A30A6; Tue, 28 Aug 2018 21:40:08 +0000 (UTC) From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Date: Tue, 28 Aug 2018 23:39:28 +0200 Message-Id: <20180828213934.29749-11-marcandre.lureau@redhat.com> In-Reply-To: <20180828213934.29749-1-marcandre.lureau@redhat.com> References: <20180828213934.29749-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: phrdina@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mprivozn@redhat.com Subject: [libvirt] [RFC v2 10/16] qemu: add vhost-user-gpu helper unit X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 28 Aug 2018 21:40:17 +0000 (UTC) X-ZohoMail: RDMRC_0 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 ff7d6c9d5f..79a7ea9fe2 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.19.0.rc0.48.gb9dfa238d5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 16:17:19 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 1535492437110304.37124076124746; Tue, 28 Aug 2018 14:40:37 -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 C8990A709; Tue, 28 Aug 2018 21:40:34 +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 974AA3091323; Tue, 28 Aug 2018 21:40:34 +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 4FF83181A369; Tue, 28 Aug 2018 21:40:34 +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 w7SLeIE2020704 for ; Tue, 28 Aug 2018 17:40:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 007C92027058; Tue, 28 Aug 2018 21:40:18 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id DEEDF2026D6B; Tue, 28 Aug 2018 21:40:13 +0000 (UTC) From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Date: Tue, 28 Aug 2018 23:39:29 +0200 Message-Id: <20180828213934.29749-12-marcandre.lureau@redhat.com> In-Reply-To: <20180828213934.29749-1-marcandre.lureau@redhat.com> References: <20180828213934.29749-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: phrdina@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mprivozn@redhat.com Subject: [libvirt] [RFC v2 11/16] 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.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.29]); Tue, 28 Aug 2018 21:40:35 +0000 (UTC) X-ZohoMail: RDMRC_0 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 824e78c0ec..2f3bd2a98e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4432,9 +4432,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.19.0.rc0.48.gb9dfa238d5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 16:17:19 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 1535492423618212.14680781545155; Tue, 28 Aug 2018 14:40:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 073DD30E6842; Tue, 28 Aug 2018 21:40:22 +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 B2903308BDA3; Tue, 28 Aug 2018 21:40:21 +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 6A3464A46E; Tue, 28 Aug 2018 21:40:21 +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 w7SLeJHV020727 for ; Tue, 28 Aug 2018 17:40:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5ACD62027056; Tue, 28 Aug 2018 21:40:19 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 116B22026D6B; Tue, 28 Aug 2018 21:40:18 +0000 (UTC) From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Date: Tue, 28 Aug 2018 23:39:30 +0200 Message-Id: <20180828213934.29749-13-marcandre.lureau@redhat.com> In-Reply-To: <20180828213934.29749-1-marcandre.lureau@redhat.com> References: <20180828213934.29749-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: phrdina@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mprivozn@redhat.com Subject: [libvirt] [RFC v2 12/16] 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.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 28 Aug 2018 21:40:22 +0000 (UTC) X-ZohoMail: RDMRC_0 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 5aaf77028b..978bef59ed 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -330,7 +330,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.19.0.rc0.48.gb9dfa238d5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 16:17:19 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 1535492448057358.4126455648394; Tue, 28 Aug 2018 14:40:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4D74B3082DCE; Tue, 28 Aug 2018 21:40:46 +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 0DF2E308BDA6; Tue, 28 Aug 2018 21:40:46 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B6B44181A12F; Tue, 28 Aug 2018 21:40:45 +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 w7SLeO8d020767 for ; Tue, 28 Aug 2018 17:40:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 63FB82157F49; Tue, 28 Aug 2018 21:40:24 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 48B832166B41; Tue, 28 Aug 2018 21:40:20 +0000 (UTC) From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Date: Tue, 28 Aug 2018 23:39:31 +0200 Message-Id: <20180828213934.29749-14-marcandre.lureau@redhat.com> In-Reply-To: <20180828213934.29749-1-marcandre.lureau@redhat.com> References: <20180828213934.29749-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: phrdina@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mprivozn@redhat.com Subject: [libvirt] [RFC v2 13/16] qemu: start/stop the vhost-user-gpu external device X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 28 Aug 2018 21:40:46 +0000 (UTC) X-ZohoMail: RDMRC_0 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.19.0.rc0.48.gb9dfa238d5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 16:17:19 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 1535492431623817.0780101559048; Tue, 28 Aug 2018 14:40:31 -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 9A76930832D1; Tue, 28 Aug 2018 21:40:29 +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 6928718A87; Tue, 28 Aug 2018 21:40:29 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 250684A46E; Tue, 28 Aug 2018 21:40:29 +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 w7SLePIu020775 for ; Tue, 28 Aug 2018 17:40:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id C22AF2166BA8; Tue, 28 Aug 2018 21:40:25 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 74DEE2166B41; Tue, 28 Aug 2018 21:40:25 +0000 (UTC) From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Date: Tue, 28 Aug 2018 23:39:32 +0200 Message-Id: <20180828213934.29749-15-marcandre.lureau@redhat.com> In-Reply-To: <20180828213934.29749-1-marcandre.lureau@redhat.com> References: <20180828213934.29749-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: phrdina@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mprivozn@redhat.com Subject: [libvirt] [RFC v2 14/16] 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 28 Aug 2018 21:40:30 +0000 (UTC) X-ZohoMail: RDMRC_0 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 2f3bd2a98e..5d08ea7d50 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4577,6 +4577,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, @@ -4584,6 +4616,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.19.0.rc0.48.gb9dfa238d5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 16:17:19 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 1535492441172721.0164099392297; Tue, 28 Aug 2018 14:40:41 -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 B0B465F75D; Tue, 28 Aug 2018 21:40:38 +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 8072010021B1; Tue, 28 Aug 2018 21:40:38 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 338E44A472; Tue, 28 Aug 2018 21:40:38 +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 w7SLeUFJ020790 for ; Tue, 28 Aug 2018 17:40:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id B58AE10EE787; Tue, 28 Aug 2018 21:40:30 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E0FF10073B2; Tue, 28 Aug 2018 21:40:26 +0000 (UTC) From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Date: Tue, 28 Aug 2018 23:39:33 +0200 Message-Id: <20180828213934.29749-16-marcandre.lureau@redhat.com> In-Reply-To: <20180828213934.29749-1-marcandre.lureau@redhat.com> References: <20180828213934.29749-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: phrdina@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mprivozn@redhat.com Subject: [libvirt] [RFC v2 15/16] 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.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 28 Aug 2018 21:40:40 +0000 (UTC) X-ZohoMail: RDMRC_0 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 5d08ea7d50..78535fbd03 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4421,7 +4421,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 @@ -4469,6 +4469,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.19.0.rc0.48.gb9dfa238d5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 16:17:19 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 1535492436451872.5055778445727; Tue, 28 Aug 2018 14:40:36 -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 6BCE43091D52; Tue, 28 Aug 2018 21:40:34 +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 2CD03694AE; Tue, 28 Aug 2018 21:40:34 +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 CE07B181A13B; Tue, 28 Aug 2018 21:40:33 +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 w7SLeWfE020813 for ; Tue, 28 Aug 2018 17:40:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3C32B2156889; Tue, 28 Aug 2018 21:40:32 +0000 (UTC) Received: from localhost (ovpn-112-17.ams2.redhat.com [10.36.112.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id C6F542166B41; Tue, 28 Aug 2018 21:40:31 +0000 (UTC) From: marcandre.lureau@redhat.com To: libvir-list@redhat.com Date: Tue, 28 Aug 2018 23:39:34 +0200 Message-Id: <20180828213934.29749-17-marcandre.lureau@redhat.com> In-Reply-To: <20180828213934.29749-1-marcandre.lureau@redhat.com> References: <20180828213934.29749-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: phrdina@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , mprivozn@redhat.com Subject: [libvirt] [RFC v2 16/16] 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 28 Aug 2018 21:40:35 +0000 (UTC) X-ZohoMail: RDMRC_0 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 | 33 ++++++++++++++ .../vhost-user-gpu-secondary.xml | 44 +++++++++++++++++++ tests/qemuxml2argvdata/vhost-user-vga.args | 30 +++++++++++++ tests/qemuxml2argvdata/vhost-user-vga.xml | 41 +++++++++++++++++ tests/qemuxml2argvtest.c | 12 +++++ 5 files changed, 160 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..bcff234ee2 --- /dev/null +++ b/tests/qemuxml2argvdata/vhost-user-gpu-secondary.args @@ -0,0 +1,33 @@ +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-node0,share=3Dyes,size=3D224395264 \ +-numa node,nodeid=3D0,cpus=3D0,memdev=3Dram-node0 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ +-device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-= 0,bootindex=3D1 \ +-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..52729bcf70 --- /dev/null +++ b/tests/qemuxml2argvdata/vhost-user-gpu-secondary.xml @@ -0,0 +1,44 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + + + + + 1 + + + + + + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + +
+ + + + + + + + + + + diff --git a/tests/qemuxml2argvdata/vhost-user-vga.args b/tests/qemuxml2arg= vdata/vhost-user-vga.args new file mode 100644 index 0000000000..15aab7d7e7 --- /dev/null +++ b/tests/qemuxml2argvdata/vhost-user-vga.args @@ -0,0 +1,30 @@ +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-node0,share=3Dyes,size=3D224395264 \ +-numa node,nodeid=3D0,cpus=3D0,memdev=3Dram-node0 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,path=3D/tmp/lib/domain--1-QEMUGuest1/moni= tor.sock,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-usb \ +-drive file=3D/dev/HostVG/QEMUGuest1,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ +-device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-= 0,bootindex=3D1 \ +-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..39138c7ca3 --- /dev/null +++ b/tests/qemuxml2argvdata/vhost-user-vga.xml @@ -0,0 +1,41 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + + + + + 1 + + + + + + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + +
+ + + + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 84edbe7230..2e5d237608 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -3008,6 +3008,18 @@ mymain(void) DO_TEST("riscv64-virt", QEMU_CAPS_DEVICE_VIRTIO_MMIO); =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.19.0.rc0.48.gb9dfa238d5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list