On Tue, Aug 06, 2019 at 01:25:37PM +0200, Ján Tomko wrote:
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.
Or even the VIR_CPU_x86_HV_STIMER_DIRECT string instead.
One more thing, qemuxml2argvtest is using DO_TEST:
DO_TEST("hyperv", NONE);
DO_TEST("hyperv-off", NONE);
DO_TEST("hyperv-panic", NONE);
which manually enumarate the used QEMU capabilities (although there are
none here)
DO_TEST_CAPS_LATEST is the way to test against QEMU capabilites
gathered from a real binary - if you use that macro for testing,
it will have the QEMU_CAPS_CANONICAL_CPU_FEATURES capability and all the
included features will use '-' instead of '_' as the separator.
Jano
With that changed:
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano
--
libvir-list mailing list
libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list