From nobody Sun Feb 8 21:46: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=1571394453; cv=none; d=zoho.com; s=zohoarc; b=Md5tdMGcW5GnMzUWHIcqfinrCAQEo5tJLPW+0J2vP6fm3adBfFalsc38RolUzW/NWCjBYeZLwTwlKJ3UywZB2hBCl2ZVjrxoehSeQGfTZvbcmYYS+39vxPXmSm91DkjbykAC/wmqYuzCecwzoM0mlA5voHTOv8HeZuPajEQ+czk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571394453; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=A3WsMkphqHjHZRLwGTR1B0115DkCMM7lCkC0ECA4wQ0=; b=BvMMvTyVTdc4lzZBf6WdpPjWdURJn4Ez2hYbetk7DOcSEhXc+AqnLMpyA7g2/Y1SCy9zyXjOGQKlzL27n1T61iO6lOCtFhteMZzm5W5f5d8oEFnAA65QyFbEWbj+e02WfwjwgsUJve/guwLEqMsfWiEW0eaPSgw/UvzwBQHlW4I= 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 157139445346932.52287174835624; Fri, 18 Oct 2019 03:27:33 -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 D584E30842AF; Fri, 18 Oct 2019 10:27:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ADE8D600C8; Fri, 18 Oct 2019 10:27:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 697F9180085A; Fri, 18 Oct 2019 10:27:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9IARRVa017428 for ; Fri, 18 Oct 2019 06:27:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id AA16A5FCA2; Fri, 18 Oct 2019 10:27:27 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 067AA60BF4; Fri, 18 Oct 2019 10:27:26 +0000 (UTC) From: Pavel Mores To: pmores@redhat.com, libvir-list@redhat.com Date: Fri, 18 Oct 2019 12:27:21 +0200 Message-Id: <20191018102722.1934-2-pmores@redhat.com> In-Reply-To: <20191018102722.1934-1-pmores@redhat.com> References: <20191018102722.1934-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 1/2] qemu: fix type of default 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-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.40]); Fri, 18 Oct 2019 10:27:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" If a graphics device is added to XML that has no video device, libvirt automatically added a video device which was always of type 'cirrus' on x86_64, even if the underlying qemu didn't support cirrus. This patch refines a bit the decision about the type of the video device. Based on QEMU capabilities, cirrus is still preferred but only added if QEMU supports it, otherwise VGA is used if supported by QEMU. There is now no fallback as libvirt only aspires to generate a basic working config and leaves anything more specific up to higher-level management tools. https://bugzilla.redhat.com/show_bug.cgi?id=3D1668141 Signed-off-by: Pavel Mores --- src/qemu/qemu_domain.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b257db44b0..39b2d2da82 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7360,6 +7360,28 @@ qemuDomainDefaultNetModel(const virDomainDef *def, } =20 =20 +static int +qemuDomainDefaultVideoDevice(const virDomainDef *def, + virQEMUCapsPtr qemuCaps) +{ + if (ARCH_IS_PPC64(def->os.arch)) { + return VIR_DOMAIN_VIDEO_TYPE_VGA; + } else if (qemuDomainIsARMVirt(def) || + qemuDomainIsRISCVVirt(def) || + ARCH_IS_S390(def->os.arch)) { + return VIR_DOMAIN_VIDEO_TYPE_VIRTIO; + } else { + if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_CIRRUS_VGA)) { + return VIR_DOMAIN_VIDEO_TYPE_CIRRUS; + } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VGA)) { + return VIR_DOMAIN_VIDEO_TYPE_VGA; + } else { + return VIR_DOMAIN_VIDEO_TYPE_DEFAULT; + } + } +} + + /* * Clear auto generated unix socket paths: * @@ -7821,18 +7843,11 @@ qemuDomainDeviceNetDefPostParse(virDomainNetDefPtr = net, =20 static int qemuDomainDeviceVideoDefPostParse(virDomainVideoDefPtr video, - const virDomainDef *def) + const virDomainDef *def, + virQEMUCapsPtr qemuCaps) { - if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_DEFAULT) { - if (ARCH_IS_PPC64(def->os.arch)) - video->type =3D VIR_DOMAIN_VIDEO_TYPE_VGA; - else if (qemuDomainIsARMVirt(def) || - qemuDomainIsRISCVVirt(def) || - ARCH_IS_S390(def->os.arch)) - video->type =3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO; - else - video->type =3D VIR_DOMAIN_VIDEO_TYPE_CIRRUS; - } + if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_DEFAULT) + video->type =3D qemuDomainDefaultVideoDevice(def, qemuCaps); =20 if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_QXL && !video->vgamem) { @@ -7926,7 +7941,7 @@ qemuDomainDeviceDefPostParse(virDomainDeviceDefPtr de= v, break; =20 case VIR_DOMAIN_DEVICE_VIDEO: - ret =3D qemuDomainDeviceVideoDefPostParse(dev->data.video, def); + ret =3D qemuDomainDeviceVideoDefPostParse(dev->data.video, def, qe= muCaps); break; =20 case VIR_DOMAIN_DEVICE_PANIC: --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list