From 362b4ee61606c2ffa28cc683087d0f380f5d65dd Mon Sep 17 00:00:00 2001 From: Vitaly Kuznetsov Date: Wed, 14 Nov 2018 23:46:07 +0100 Subject: [PATCH] qemu: add support for Hyper-V Enlightened VMCS QEMU 3.1 supports Hyper-V Enlightened VMCS feature which significantly speeds up nested Hyper-V on KVM environments. Reviewed-by: Andrea Bolognani Signed-off-by: Vitaly Kuznetsov --- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_parse_command.c | 2 +- src/qemu/qemu_process.c | 2 +- tests/qemuxml2argvdata/hyperv-off.xml | 1 + tests/qemuxml2argvdata/hyperv.args | 2 +- tests/qemuxml2argvdata/hyperv.xml | 1 + tests/qemuxml2xmloutdata/hyperv-off.xml | 1 + tests/qemuxml2xmloutdata/hyperv.xml | 1 + 8 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 27e77f7d66..d543ada2a1 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6883,6 +6883,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, case VIR_DOMAIN_HYPERV_REENLIGHTENMENT: case VIR_DOMAIN_HYPERV_TLBFLUSH: case VIR_DOMAIN_HYPERV_IPI: + case VIR_DOMAIN_HYPERV_EVMCS: if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON) virBufferAsprintf(&buf, ",hv_%s", virDomainHypervTypeToString(i)); @@ -6900,7 +6901,6 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, def->hyperv_vendor_id); break; - case VIR_DOMAIN_HYPERV_EVMCS: /* coverity[dead_error_begin] */ case VIR_DOMAIN_HYPERV_LAST: break; diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c index a1f8369919..d91fc8d901 100644 --- a/src/qemu/qemu_parse_command.c +++ b/src/qemu/qemu_parse_command.c @@ -1540,6 +1540,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom, case VIR_DOMAIN_HYPERV_REENLIGHTENMENT: case VIR_DOMAIN_HYPERV_TLBFLUSH: case VIR_DOMAIN_HYPERV_IPI: + case VIR_DOMAIN_HYPERV_EVMCS: if (value) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("HyperV feature '%s' should not " @@ -1580,7 +1581,6 @@ qemuParseCommandLineCPU(virDomainDefPtr dom, break; - case VIR_DOMAIN_HYPERV_EVMCS: case VIR_DOMAIN_HYPERV_LAST: break; } diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index fbdd445cd6..874451ce72 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3965,12 +3965,12 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def, case VIR_DOMAIN_HYPERV_REENLIGHTENMENT: case VIR_DOMAIN_HYPERV_TLBFLUSH: case VIR_DOMAIN_HYPERV_IPI: + case VIR_DOMAIN_HYPERV_EVMCS: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("host doesn't support hyperv '%s' feature"), virDomainHypervTypeToString(i)); return -1; - case VIR_DOMAIN_HYPERV_EVMCS: /* coverity[dead_error_begin] */ case VIR_DOMAIN_HYPERV_VENDOR_ID: case VIR_DOMAIN_HYPERV_LAST: diff --git a/tests/qemuxml2argvdata/hyperv-off.xml b/tests/qemuxml2argvdata/hyperv-off.xml index e51cca45b5..59c1e17ccd 100644 --- a/tests/qemuxml2argvdata/hyperv-off.xml +++ b/tests/qemuxml2argvdata/hyperv-off.xml @@ -24,6 +24,7 @@ + diff --git a/tests/qemuxml2argvdata/hyperv.args b/tests/qemuxml2argvdata/hyperv.args index 0800e4f79d..5d59788e14 100644 --- a/tests/qemuxml2argvdata/hyperv.args +++ b/tests/qemuxml2argvdata/hyperv.args @@ -10,7 +10,7 @@ QEMU_AUDIO_DRV=none \ -machine pc,accel=tcg,usb=off,dump-guest-core=off \ -cpu 'qemu32,hv_relaxed,hv_vapic,hv_spinlocks=0x2fff,hv_vpindex,hv_runtime,\ hv_synic,hv_stimer,hv_reset,hv_vendor_id=KVM Hv,hv_frequencies,\ -hv_reenlightenment,hv_tlbflush,hv_ipi' \ +hv_reenlightenment,hv_tlbflush,hv_ipi,hv_evmcs' \ -m 214 \ -smp 6,sockets=6,cores=1,threads=1 \ -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ diff --git a/tests/qemuxml2argvdata/hyperv.xml b/tests/qemuxml2argvdata/hyperv.xml index 05c7d478f7..c6feaed528 100644 --- a/tests/qemuxml2argvdata/hyperv.xml +++ b/tests/qemuxml2argvdata/hyperv.xml @@ -24,6 +24,7 @@ + diff --git a/tests/qemuxml2xmloutdata/hyperv-off.xml b/tests/qemuxml2xmloutdata/hyperv-off.xml index 2282b763b5..1b7d82b14a 100644 --- a/tests/qemuxml2xmloutdata/hyperv-off.xml +++ b/tests/qemuxml2xmloutdata/hyperv-off.xml @@ -24,6 +24,7 @@ + diff --git a/tests/qemuxml2xmloutdata/hyperv.xml b/tests/qemuxml2xmloutdata/hyperv.xml index 97f387c172..5510d3dfad 100644 --- a/tests/qemuxml2xmloutdata/hyperv.xml +++ b/tests/qemuxml2xmloutdata/hyperv.xml @@ -24,6 +24,7 @@ + -- GitLab