From nobody Tue Apr 30 07:09:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=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 From nobody Tue Apr 30 07:09:48 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571394457; cv=none; d=zoho.com; s=zohoarc; b=DupI7n27H2CaH+M5pMJi/llSQdAPVkS6Oofgqw85w9MPIpIafJUGdIMpHXa1y/v4OF82lp68/5HwRH3jhVNmV/GTatyRcjBEdP1fqFifq4qpuTzdw1YjtJYPfpm+Ofk4LO0YJLq3A7j9evea4Ap7jiG/MlMRyXuEnqCG34IqF1U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571394457; 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=VuEQd9OVL4HLtEXo/fLCQao49PA324BZAOaBDmfSOlI=; b=FNIqy0CzqfuVDtAvyHE8OF7RK5nma40flbUPNl2P2l3SAYgstydSL8i84PujDlYQz6VRZSFRgwu9ptSVly+bFw9qOVstsb5zrkgWZL6drEXGPu4/4axk8Q12bAqksi3B8pZlWHrNCZ1rObdzSOYpuzJ/BS3Nwqf7Mzs/k768sLs= 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 1571394457136580.8256514318493; Fri, 18 Oct 2019 03:27:37 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 292BBC028320; Fri, 18 Oct 2019 10:27:35 +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 03AB05D9CA; Fri, 18 Oct 2019 10:27:35 +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 B45431803518; Fri, 18 Oct 2019 10:27:34 +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 x9IARS2c017436 for ; Fri, 18 Oct 2019 06:27:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id C827B60BFB; Fri, 18 Oct 2019 10:27:28 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0037660BF1; Fri, 18 Oct 2019 10:27:27 +0000 (UTC) From: Pavel Mores To: pmores@redhat.com, libvir-list@redhat.com Date: Fri, 18 Oct 2019 12:27:22 +0200 Message-Id: <20191018102722.1934-3-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 2/2] qemu: add tests of the default video type selection algorithm 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 18 Oct 2019 10:27:35 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The test case for x86_64 and neither cirrus nor vga capability is of the xml2argv type because it actually fails to parse the XML at all [*] which is something that xml2xml tests don't seem to handle. xml2argv test fails to produce a qemu argv for this case which xml2argv tests can handle. The (unrelated) "graphics-egl-headless-rendernode" had to be adjusted as it expects cirrus to be added as per previous behaviour. It now has to use QEMU_CAPS_DEVICE_CIRRUS_VGA to get that (otherwise it'd end up with vga). [*] This is a consequence of the decision not to have a fallback if the obvious choices (cirrus and vga) aren't viable due to missing QEMU caps. Signed-off-by: Pavel Mores --- .../default-video-type-aarch64.xml | 16 +++++++ .../default-video-type-ppc64.xml | 16 +++++++ .../default-video-type-riscv64.xml | 16 +++++++ .../default-video-type-s390x.xml | 16 +++++++ .../default-video-type-x86_64-caps-test-0.xml | 17 ++++++++ .../default-video-type-x86_64-caps-test-1.xml | 17 ++++++++ tests/qemuxml2argvtest.c | 1 + ...ault-video-type-aarch64.aarch64-latest.xml | 42 +++++++++++++++++++ .../default-video-type-ppc64.ppc64-latest.xml | 31 ++++++++++++++ ...ault-video-type-riscv64.riscv64-latest.xml | 39 +++++++++++++++++ .../default-video-type-s390x.s390x-latest.xml | 32 ++++++++++++++ .../default-video-type-x86_64-caps-test-0.xml | 31 ++++++++++++++ .../default-video-type-x86_64-caps-test-1.xml | 31 ++++++++++++++ tests/qemuxml2xmltest.c | 10 ++++- 14 files changed, 314 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/default-video-type-aarch64.xml create mode 100644 tests/qemuxml2argvdata/default-video-type-ppc64.xml create mode 100644 tests/qemuxml2argvdata/default-video-type-riscv64.xml create mode 100644 tests/qemuxml2argvdata/default-video-type-s390x.xml create mode 100644 tests/qemuxml2argvdata/default-video-type-x86_64-caps-t= est-0.xml create mode 100644 tests/qemuxml2argvdata/default-video-type-x86_64-caps-t= est-1.xml create mode 100644 tests/qemuxml2xmloutdata/default-video-type-aarch64.aar= ch64-latest.xml create mode 100644 tests/qemuxml2xmloutdata/default-video-type-ppc64.ppc64= -latest.xml create mode 100644 tests/qemuxml2xmloutdata/default-video-type-riscv64.ris= cv64-latest.xml create mode 100644 tests/qemuxml2xmloutdata/default-video-type-s390x.s390x= -latest.xml create mode 100644 tests/qemuxml2xmloutdata/default-video-type-x86_64-caps= -test-0.xml create mode 100644 tests/qemuxml2xmloutdata/default-video-type-x86_64-caps= -test-1.xml diff --git a/tests/qemuxml2argvdata/default-video-type-aarch64.xml b/tests/= qemuxml2argvdata/default-video-type-aarch64.xml new file mode 100644 index 0000000000..03326d3c9b --- /dev/null +++ b/tests/qemuxml2argvdata/default-video-type-aarch64.xml @@ -0,0 +1,16 @@ + + default-video-type-aarch64-test + 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f + 1048576 + 1 + + hvm + + + + /usr/bin/qemu-system-aarch64 + + + + + diff --git a/tests/qemuxml2argvdata/default-video-type-ppc64.xml b/tests/qe= muxml2argvdata/default-video-type-ppc64.xml new file mode 100644 index 0000000000..739e07fc19 --- /dev/null +++ b/tests/qemuxml2argvdata/default-video-type-ppc64.xml @@ -0,0 +1,16 @@ + + default-video-type-ppc64-test + 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f + 1048576 + 1 + + hvm + + + + /usr/bin/qemu-system-ppc64 + + + + + diff --git a/tests/qemuxml2argvdata/default-video-type-riscv64.xml b/tests/= qemuxml2argvdata/default-video-type-riscv64.xml new file mode 100644 index 0000000000..55f6fa9391 --- /dev/null +++ b/tests/qemuxml2argvdata/default-video-type-riscv64.xml @@ -0,0 +1,16 @@ + + default-video-type-riscv64-test + 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f + 1048576 + 1 + + hvm + + + + /usr/bin/qemu-system-riscv64 + + + + + diff --git a/tests/qemuxml2argvdata/default-video-type-s390x.xml b/tests/qe= muxml2argvdata/default-video-type-s390x.xml new file mode 100644 index 0000000000..9eda06a3a1 --- /dev/null +++ b/tests/qemuxml2argvdata/default-video-type-s390x.xml @@ -0,0 +1,16 @@ + + default-video-type-s390x-test + 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f + 1048576 + 1 + + hvm + + + + /usr/bin/qemu-system-s390x + + + + + diff --git a/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.x= ml b/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.xml new file mode 100644 index 0000000000..2c753fe227 --- /dev/null +++ b/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-0.xml @@ -0,0 +1,17 @@ + + default-video-type-x86_64-test + 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f + 1048576 + 1 + + hvm + + + + /usr/bin/qemu-system-x86_64 + + + + + + diff --git a/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-1.x= ml b/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-1.xml new file mode 100644 index 0000000000..2c753fe227 --- /dev/null +++ b/tests/qemuxml2argvdata/default-video-type-x86_64-caps-test-1.xml @@ -0,0 +1,17 @@ + + default-video-type-x86_64-test + 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f + 1048576 + 1 + + hvm + + + + /usr/bin/qemu-system-x86_64 + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a84ea0954d..1f50afdc9c 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2088,6 +2088,7 @@ mymain(void) DO_TEST("video-none-device", QEMU_CAPS_VNC); DO_TEST_PARSE_ERROR("video-invalid-multiple-devices", NONE); + DO_TEST_PARSE_ERROR("default-video-type-x86_64-caps-test-0", NONE); =20 DO_TEST("virtio-rng-default", QEMU_CAPS_DEVICE_VIRTIO_RNG, diff --git a/tests/qemuxml2xmloutdata/default-video-type-aarch64.aarch64-la= test.xml b/tests/qemuxml2xmloutdata/default-video-type-aarch64.aarch64-late= st.xml new file mode 100644 index 0000000000..4b660b8d70 --- /dev/null +++ b/tests/qemuxml2xmloutdata/default-video-type-aarch64.aarch64-latest.xml @@ -0,0 +1,42 @@ + + default-video-type-aarch64-test + 6ba410c5-1e5c-4d57-bee7-2228e7ffa32f + 1048576 + 1048576 + 1 + + hvm + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-aarch64 + + + + + +
+ + + + +
+ + + + +