On Tue, Aug 06, 2019 at 07:52:35AM +0200, Vitaly Kuznetsov wrote:
QEMU-4.1 supports 'Direct Mode' for Hyper-V synthetic timers
(hv-stimer-direct CPU flag): Windows guests can request that timer
expiration notifications are delivered as normal interrupts (and not
VMBus messages). This is used by Hyper-V on KVM.
Signed-off-by: Vitaly Kuznetsov <vkuznets(a)redhat.com>
---
src/qemu/qemu_command.c | 12 ++++++++----
src/qemu/qemu_process.c | 20 ++++++++++++++++++--
tests/qemuxml2argvdata/hyperv.args | 4 ++--
tests/qemuxml2argvdata/hyperv.xml | 4 +++-
tests/qemuxml2xmloutdata/hyperv.xml | 4 +++-
5 files changed, 34 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c8494de785..af913dba34 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7152,10 +7152,10 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
}
if (def->features[VIR_DOMAIN_FEATURE_HYPERV] == VIR_TRISTATE_SWITCH_ON) {
- const char *hvPrefix = "hv-";
+ const char *hvDelimiter = "-";
if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CANONICAL_CPU_FEATURES))
- hvPrefix = "hv_";
+ hvDelimiter = "_";
for (i = 0; i < VIR_DOMAIN_HYPERV_LAST; i++) {
switch ((virDomainHyperv) i) {
@@ -7172,9 +7172,13 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
case VIR_DOMAIN_HYPERV_IPI:
case VIR_DOMAIN_HYPERV_EVMCS:
if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
- virBufferAsprintf(&buf, ",%s%s",
- hvPrefix,
+ virBufferAsprintf(&buf, ",hv%s%s",
+ hvDelimiter,
virDomainHypervTypeToString(i));
+ if ((i == VIR_DOMAIN_HYPERV_STIMER) &&
+ (def->hyperv_stimer_direct == VIR_TRISTATE_SWITCH_ON))
+ virBufferAsprintf(&buf, ",hv%sstimer%sdirect",
hvDelimiter,
+ hvDelimiter);
IIUC this feature will be introduced in QEMU 4.1.0 which is the one
where we stop using the aliases with underscores, so this can be
",hv-stimer-direct" and the hvDelimiter changes are not needed.
With that changed:
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano