diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index b1245ad5dd7a33fa47927494c18e768c5467a3a5..134be6605e81f3f3942e21406f554db9c9df8688 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4261,18 +4261,25 @@ virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps) virQEMUCapsSet(qemuCaps, QEMU_CAPS_DISPLAY); } -/* Capabilities that are architecture depending - * initialized for QEMU. + +/** + * virQEMUCapsInitQMPArch: + * @qemuCaps: QEMU capabilities + * @mon: QEMU monitor + * + * Initialize the architecture for @qemuCaps by asking @mon. + * + * Returns: 0 on success, <0 on failure */ static int -virQEMUCapsInitArchQMPBasic(virQEMUCapsPtr qemuCaps, +virQEMUCapsInitQMPArch(virQEMUCapsPtr qemuCaps, qemuMonitorPtr mon) { char *archstr = NULL; int ret = -1; if (!(archstr = qemuMonitorGetTargetArch(mon))) - return -1; + goto cleanup; if ((qemuCaps->arch = virQEMUCapsArchFromString(archstr)) == VIR_ARCH_NONE) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -4280,18 +4287,29 @@ virQEMUCapsInitArchQMPBasic(virQEMUCapsPtr qemuCaps, goto cleanup; } + ret = 0; + + cleanup: + VIR_FREE(archstr); + return ret; +} + + +/** + * virQEMUCapsInitQMPBasicArch: + * @qemuCaps: QEMU capabilities + * + * Initialize @qemuCaps with basic architecture-dependent capabilities. + */ +static void +virQEMUCapsInitQMPBasicArch(virQEMUCapsPtr qemuCaps) +{ /* ACPI/HPET/KVM PIT are x86 specific */ if (ARCH_IS_X86(qemuCaps->arch)) { virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_ACPI); virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_HPET); virQEMUCapsSet(qemuCaps, QEMU_CAPS_NO_KVM_PIT); } - - ret = 0; - - cleanup: - VIR_FREE(archstr); - return ret; } @@ -4516,9 +4534,11 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps, virQEMUCapsInitQMPBasic(qemuCaps); - if (virQEMUCapsInitArchQMPBasic(qemuCaps, mon) < 0) + if (virQEMUCapsInitQMPArch(qemuCaps, mon) < 0) goto cleanup; + virQEMUCapsInitQMPBasicArch(qemuCaps); + /* USB option is supported v1.3.0 onwards */ if (qemuCaps->version >= 1003000) virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_USB_OPT);