From 8152b6ac3b740bfe1155e3c4c251684cc5b3192e Mon Sep 17 00:00:00 2001 Message-Id: <8152b6ac3b740bfe1155e3c4c251684cc5b3192e@dist-git> From: Andrea Bolognani Date: Fri, 14 Feb 2020 13:12:36 +0100 Subject: [PATCH] qemu: Validate configuration for the armvtimer timer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Its use is limited to certain guest types, and it only supports a subset of all possible tick policies. Signed-off-by: Andrea Bolognani Reviewed-by: Masayoshi Mizuma Reviewed-by: Ján Tomko (cherry picked from commit aeddab230cd1e2a12d5d6352971bb70ea067a1c4) https://bugzilla.redhat.com/show_bug.cgi?id=1762634 Signed-off-by: Andrea Bolognani Message-Id: <20200214121237.623948-6-abologna@redhat.com> Reviewed-by: Ján Tomko --- src/qemu/qemu_domain.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 4de4f9da53..1bed117eb0 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5506,6 +5506,44 @@ qemuDomainDefValidateClockTimers(const virDomainDef *def, break; case VIR_DOMAIN_TIMER_NAME_ARMVTIMER: + if (def->virtType != VIR_DOMAIN_VIRT_KVM || + !qemuDomainIsARMVirt(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Configuring the '%s' timer is not supported " + "for virtType=%s arch=%s machine=%s guests"), + virDomainTimerNameTypeToString(timer->name), + virDomainVirtTypeToString(def->virtType), + virArchToString(def->os.arch), + def->os.machine); + return -1; + } + if (timer->present == 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("The '%s' timer can't be disabled"), + virDomainTimerNameTypeToString(timer->name)); + return -1; + } + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CPU_KVM_NO_ADJVTIME)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Configuring the '%s' timer is not supported " + "with this QEMU binary"), + virDomainTimerNameTypeToString(timer->name)); + return -1; + } + + switch (timer->tickpolicy) { + case -1: + case VIR_DOMAIN_TIMER_TICKPOLICY_DELAY: + case VIR_DOMAIN_TIMER_TICKPOLICY_DISCARD: + break; + case VIR_DOMAIN_TIMER_TICKPOLICY_CATCHUP: + case VIR_DOMAIN_TIMER_TICKPOLICY_MERGE: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("The '%s' timer does not support tickpolicy '%s'"), + virDomainTimerNameTypeToString(timer->name), + virDomainTimerTickpolicyTypeToString(timer->tickpolicy)); + return -1; + } break; } } -- 2.25.0