From nobody Mon Feb 9 01:48:31 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1553862407529675.5806824901744; Fri, 29 Mar 2019 05:26:47 -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 D882E3099FC9; Fri, 29 Mar 2019 12:26:45 +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 B3FB11001DD6; Fri, 29 Mar 2019 12:26:45 +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 EFAEF180338A; Fri, 29 Mar 2019 12:26:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x2TCQeU0011875 for ; Fri, 29 Mar 2019 08:26:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id DDC3F83E8A; Fri, 29 Mar 2019 12:26:40 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6454783E89 for ; Fri, 29 Mar 2019 12:26:40 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 29 Mar 2019 13:26:29 +0100 Message-Id: <31b4d1bc31b0a394fb2370086da3b372d0eca578.1553862332.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/6] qemu: caps: Separate capabilities based on qemu version 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.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.41]); Fri, 29 Mar 2019 12:26:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" virQEMUCapsInitQMPMonitor is massive now since it collects calls to the various probing functions and also version based capabilities. Split out the version based caps into a separate function. Signed-off-by: Peter Krempa Reviewed-by: Erik Skultety --- src/qemu/qemu_capabilities.c | 124 +++++++++++++++++++---------------- 1 file changed, 69 insertions(+), 55 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 56228e7a36..04199b1a76 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4145,6 +4145,73 @@ virQEMUCapsInitQMPBasicArch(virQEMUCapsPtr qemuCaps) } +/** + * virQEMUCapsInitQMPVersionCaps: + * @qemuCaps: QEMU capabilities + * + * Add all QEMU capabilities based on version of QEMU. + */ +static void +virQEMUCapsInitQMPVersionCaps(virQEMUCapsPtr qemuCaps) +{ + if (qemuCaps->version >=3D 1006000) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY); + + /* vmport option is supported v2.2.0 onwards */ + if (qemuCaps->version >=3D 2002000) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_VMPORT_OPT); + + /* -cpu ...,aarch64=3Doff supported in v2.3.0 and onwards. But it + isn't detectable via qmp at this point */ + if (qemuCaps->arch =3D=3D VIR_ARCH_AARCH64 && + qemuCaps->version >=3D 2003000) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_AARCH64_OFF); + + /* vhost-user supports multi-queue from v2.4.0 onwards, + * but there is no way to query for that capability */ + if (qemuCaps->version >=3D 2004000) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_VHOSTUSER_MULTIQUEUE); + + /* smm option is supported from v2.4.0 */ + if (qemuCaps->version >=3D 2004000) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_SMM_OPT); + + /* sdl -gl option is supported from v2.4.0 (qemu commit id 0b71a5d5) */ + if (qemuCaps->version >=3D 2004000) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_SDL_GL); + + /* Since 2.4.50 ARM virt machine supports gic-version option */ + if (qemuCaps->version >=3D 2004050) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACH_VIRT_GIC_VERSION); + + /* no way to query if -machine kernel_irqchip supports split */ + if (qemuCaps->version >=3D 2006000) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT); + + /* HPT resizing is supported since QEMU 2.10 on ppc64; unfortunately + * there's no sane way to probe for it */ + if (qemuCaps->version >=3D 2010000 && + ARCH_IS_PPC64(qemuCaps->arch)) { + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); + } + + /* '-display egl-headless' cmdline option is supported since QEMU 2.10= , but + * there's no way to probe it */ + if (qemuCaps->version >=3D 2010000) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_EGL_HEADLESS); + + /* no way to query for -numa dist */ + if (qemuCaps->version >=3D 2010000) + virQEMUCapsSet(qemuCaps, QEMU_CAPS_NUMA_DIST); + + /* no way to query max-cpu-compat */ + if (qemuCaps->version >=3D 2010000 && + ARCH_IS_PPC64(qemuCaps->arch)) { + virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT); + } +} + + static int virQEMUCapsProbeQMPSchemaCapabilities(virQEMUCapsPtr qemuCaps, qemuMonitorPtr mon) @@ -4223,61 +4290,8 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, virQEMUCapsInitQMPBasicArch(qemuCaps); - if (qemuCaps->version >=3D 1006000) - virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY); - - /* vmport option is supported v2.2.0 onwards */ - if (qemuCaps->version >=3D 2002000) - virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_VMPORT_OPT); - - /* -cpu ...,aarch64=3Doff supported in v2.3.0 and onwards. But it - isn't detectable via qmp at this point */ - if (qemuCaps->arch =3D=3D VIR_ARCH_AARCH64 && - qemuCaps->version >=3D 2003000) - virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_AARCH64_OFF); - - /* vhost-user supports multi-queue from v2.4.0 onwards, - * but there is no way to query for that capability */ - if (qemuCaps->version >=3D 2004000) - virQEMUCapsSet(qemuCaps, QEMU_CAPS_VHOSTUSER_MULTIQUEUE); - - /* smm option is supported from v2.4.0 */ - if (qemuCaps->version >=3D 2004000) - virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_SMM_OPT); - - /* sdl -gl option is supported from v2.4.0 (qemu commit id 0b71a5d5) */ - if (qemuCaps->version >=3D 2004000) - virQEMUCapsSet(qemuCaps, QEMU_CAPS_SDL_GL); - - /* Since 2.4.50 ARM virt machine supports gic-version option */ - if (qemuCaps->version >=3D 2004050) - virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACH_VIRT_GIC_VERSION); - - /* no way to query if -machine kernel_irqchip supports split */ - if (qemuCaps->version >=3D 2006000) - virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_KERNEL_IRQCHIP_SPLIT); - - /* HPT resizing is supported since QEMU 2.10 on ppc64; unfortunately - * there's no sane way to probe for it */ - if (qemuCaps->version >=3D 2010000 && - ARCH_IS_PPC64(qemuCaps->arch)) { - virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_RESIZE_HPT); - } - - /* '-display egl-headless' cmdline option is supported since QEMU 2.10= , but - * there's no way to probe it */ - if (qemuCaps->version >=3D 2010000) - virQEMUCapsSet(qemuCaps, QEMU_CAPS_EGL_HEADLESS); - - /* no way to query for -numa dist */ - if (qemuCaps->version >=3D 2010000) - virQEMUCapsSet(qemuCaps, QEMU_CAPS_NUMA_DIST); - - /* no way to query max-cpu-compat */ - if (qemuCaps->version >=3D 2010000 && - ARCH_IS_PPC64(qemuCaps->arch)) { - virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_PSERIES_MAX_CPU_COMPAT); - } + /* initiate all capapbilities based on qemu version */ + virQEMUCapsInitQMPVersionCaps(qemuCaps); if (virQEMUCapsProbeQMPCommands(qemuCaps, mon) < 0) goto cleanup; --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list