From nobody Mon Feb 9 21:36:54 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571412640; cv=none; d=zoho.com; s=zohoarc; b=BN4SCiE0kvSb3g6nvKu3D83doLnKkch5aOkVqoaLWePHPmEysXdjLIirMvZebjc36QMnMUPToDKsxphK3ZaLv6gmqrTsgOLaDgdBNQeJBfMbaHVsN83OyTPWoWE36rf+2SYpdw8uVbaH3svtue5aLcxOMcGR+/UGERX9dc0nYYA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571412640; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=diWfQ4PHF3ffbKLgrsqrrnwBbrC4NdUen7iPq0xSa/s=; b=XZnIXSTpl0+2KgPU0KamCgULj3SDeqFFOj0ESTIYrgjpFTqhX4EZk2BxIHZ3Nf7cGwsiRgL4t2BWYGUbpIRieC8pj67by2d/dC4HYECxj7VGsSgiBJ8HS70yBA/UbJnM3Gvj5J45f9KMp7qY0Kplj9IvoxuSyWupUKDUUTgkGLY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571412640195454.11994971792035; Fri, 18 Oct 2019 08:30:40 -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 8A0D9307B18E; Fri, 18 Oct 2019 15:30: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 5917260600; Fri, 18 Oct 2019 15:30: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 0CFDB4EE6E; Fri, 18 Oct 2019 15:30:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9IFUN1V001399 for ; Fri, 18 Oct 2019 11:30:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 377B45EE1D; Fri, 18 Oct 2019 15:30:23 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-116-193.phx2.redhat.com [10.3.116.193]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EF4235D772; Fri, 18 Oct 2019 15:30:22 +0000 (UTC) From: Jonathon Jongsma To: libvir-list@redhat.com Date: Fri, 18 Oct 2019 10:30:14 -0500 Message-Id: <20191018153017.4819-7-jjongsma@redhat.com> In-Reply-To: <20191018153017.4819-1-jjongsma@redhat.com> References: <20191018153017.4819-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: crobinso@redhat.com Subject: [libvirt] [PATCH v3 6/9] qemu: validate vhost-user video backend in qemu_domain.c X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 18 Oct 2019 15:30:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The goal is to move all of the video device validation to a single place and use domain caps to validate the supported video device models. Since qemuDomainDeviceDefValidateVideo() is called from qemuProcessStartValidate(), these changes should not change anny behavior. Signed-off-by: Jonathon Jongsma --- src/qemu/qemu_domain.c | 14 ++++++++++++-- src/qemu/qemu_process.c | 9 +-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 39ab424873..0a6d774437 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5704,7 +5704,8 @@ qemuDomainDeviceDefValidateHostdev(const virDomainHos= tdevDef *hostdev, =20 =20 static int -qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video) +qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video, + virQEMUCapsPtr qemuCaps) { switch ((virDomainVideoType) video->type) { case VIR_DOMAIN_VIDEO_TYPE_NONE: @@ -5784,6 +5785,15 @@ qemuDomainDeviceDefValidateVideo(const virDomainVide= oDef *video) } } =20 + if (video->backend =3D=3D VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) { + if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_USER_GPU)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this QEMU does not support 'vhost-user' vide= o device")); + return -1; + } + } + return 0; } =20 @@ -7245,7 +7255,7 @@ qemuDomainDeviceDefValidate(const virDomainDeviceDef = *dev, break; =20 case VIR_DOMAIN_DEVICE_VIDEO: - ret =3D qemuDomainDeviceDefValidateVideo(dev->data.video); + ret =3D qemuDomainDeviceDefValidateVideo(dev->data.video, qemuCaps= ); break; =20 case VIR_DOMAIN_DEVICE_DISK: diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 9eaea4edfd..25465f05e2 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5251,14 +5251,7 @@ qemuProcessStartValidateVideo(virDomainObjPtr vm, for (i =3D 0; i < vm->def->nvideos; i++) { video =3D vm->def->videos[i]; =20 - if (video->backend =3D=3D VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER)= { - if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_USER_GPU)= ) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this QEMU does not support 'vhost-user' = video device")); - return -1; - } - } else { + if (video->backend !=3D VIR_DOMAIN_VIDEO_BACKEND_TYPE_VHOSTUSER) { if ((video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VGA && !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VGA)) || (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_CIRRUS && --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list