mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 01:34:11 +03:00
qemu: caps: Separate capabilities based on qemu version
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 <pkrempa@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
cbc6ee722b
commit
87b906811b
@ -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 >= 1006000)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
|
||||
|
||||
/* vmport option is supported v2.2.0 onwards */
|
||||
if (qemuCaps->version >= 2002000)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_VMPORT_OPT);
|
||||
|
||||
/* -cpu ...,aarch64=off supported in v2.3.0 and onwards. But it
|
||||
isn't detectable via qmp at this point */
|
||||
if (qemuCaps->arch == VIR_ARCH_AARCH64 &&
|
||||
qemuCaps->version >= 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 >= 2004000)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_VHOSTUSER_MULTIQUEUE);
|
||||
|
||||
/* smm option is supported from v2.4.0 */
|
||||
if (qemuCaps->version >= 2004000)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_SMM_OPT);
|
||||
|
||||
/* sdl -gl option is supported from v2.4.0 (qemu commit id 0b71a5d5) */
|
||||
if (qemuCaps->version >= 2004000)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_SDL_GL);
|
||||
|
||||
/* Since 2.4.50 ARM virt machine supports gic-version option */
|
||||
if (qemuCaps->version >= 2004050)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACH_VIRT_GIC_VERSION);
|
||||
|
||||
/* no way to query if -machine kernel_irqchip supports split */
|
||||
if (qemuCaps->version >= 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 >= 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 >= 2010000)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_EGL_HEADLESS);
|
||||
|
||||
/* no way to query for -numa dist */
|
||||
if (qemuCaps->version >= 2010000)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_NUMA_DIST);
|
||||
|
||||
/* no way to query max-cpu-compat */
|
||||
if (qemuCaps->version >= 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 >= 1006000)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
|
||||
|
||||
/* vmport option is supported v2.2.0 onwards */
|
||||
if (qemuCaps->version >= 2002000)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_VMPORT_OPT);
|
||||
|
||||
/* -cpu ...,aarch64=off supported in v2.3.0 and onwards. But it
|
||||
isn't detectable via qmp at this point */
|
||||
if (qemuCaps->arch == VIR_ARCH_AARCH64 &&
|
||||
qemuCaps->version >= 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 >= 2004000)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_VHOSTUSER_MULTIQUEUE);
|
||||
|
||||
/* smm option is supported from v2.4.0 */
|
||||
if (qemuCaps->version >= 2004000)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_SMM_OPT);
|
||||
|
||||
/* sdl -gl option is supported from v2.4.0 (qemu commit id 0b71a5d5) */
|
||||
if (qemuCaps->version >= 2004000)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_SDL_GL);
|
||||
|
||||
/* Since 2.4.50 ARM virt machine supports gic-version option */
|
||||
if (qemuCaps->version >= 2004050)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACH_VIRT_GIC_VERSION);
|
||||
|
||||
/* no way to query if -machine kernel_irqchip supports split */
|
||||
if (qemuCaps->version >= 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 >= 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 >= 2010000)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_EGL_HEADLESS);
|
||||
|
||||
/* no way to query for -numa dist */
|
||||
if (qemuCaps->version >= 2010000)
|
||||
virQEMUCapsSet(qemuCaps, QEMU_CAPS_NUMA_DIST);
|
||||
|
||||
/* no way to query max-cpu-compat */
|
||||
if (qemuCaps->version >= 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;
|
||||
|
Loading…
Reference in New Issue
Block a user