|
|
edecca |
From b4335c3290082dd8aa0915e340b625197d80fdc3 Mon Sep 17 00:00:00 2001
|
|
|
edecca |
Message-Id: <b4335c3290082dd8aa0915e340b625197d80fdc3@dist-git>
|
|
|
edecca |
From: Vitaly Kuznetsov <vkuznets@redhat.com>
|
|
|
edecca |
Date: Thu, 9 Aug 2018 15:14:19 +0200
|
|
|
edecca |
Subject: [PATCH] conf: qemu: add support for Hyper-V frequency MSRs
|
|
|
edecca |
MIME-Version: 1.0
|
|
|
edecca |
Content-Type: text/plain; charset=UTF-8
|
|
|
edecca |
Content-Transfer-Encoding: 8bit
|
|
|
edecca |
|
|
|
edecca |
Qemu-2.12 gained 'hv-frequencies' cpu flag to enable Hyper-V frequency
|
|
|
edecca |
MSRs. These MSRs are required (but not sufficient) to make Hyper-V on
|
|
|
edecca |
KVM pass stable TSC page clocksource to L2 guests.
|
|
|
edecca |
|
|
|
edecca |
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
|
|
edecca |
Reviewed-by: John Ferlan <jferlan@redhat.com>
|
|
|
edecca |
(cherry picked from commit 8253bca9615233f670c7dad659c120e4556a748a)
|
|
|
edecca |
|
|
|
edecca |
https://bugzilla.redhat.com/show_bug.cgi?id=1589702
|
|
|
edecca |
|
|
|
edecca |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
edecca |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
edecca |
---
|
|
|
edecca |
docs/formatdomain.html.in | 7 +++++++
|
|
|
edecca |
docs/schemas/domaincommon.rng | 5 +++++
|
|
|
edecca |
src/conf/domain_conf.c | 6 +++++-
|
|
|
edecca |
src/conf/domain_conf.h | 1 +
|
|
|
edecca |
src/cpu/cpu_x86.c | 3 +++
|
|
|
edecca |
src/cpu/cpu_x86_data.h | 1 +
|
|
|
edecca |
src/qemu/qemu_command.c | 1 +
|
|
|
edecca |
src/qemu/qemu_parse_command.c | 1 +
|
|
|
edecca |
src/qemu/qemu_process.c | 1 +
|
|
|
edecca |
tests/qemuxml2argvdata/hyperv-off.xml | 1 +
|
|
|
edecca |
tests/qemuxml2argvdata/hyperv.args | 2 +-
|
|
|
edecca |
tests/qemuxml2argvdata/hyperv.xml | 1 +
|
|
|
edecca |
tests/qemuxml2xmloutdata/hyperv-off.xml | 1 +
|
|
|
edecca |
tests/qemuxml2xmloutdata/hyperv.xml | 1 +
|
|
|
edecca |
14 files changed, 30 insertions(+), 2 deletions(-)
|
|
|
edecca |
|
|
|
edecca |
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
|
|
edecca |
index 42acf7a828..3b493a98ac 100644
|
|
|
edecca |
--- a/docs/formatdomain.html.in
|
|
|
edecca |
+++ b/docs/formatdomain.html.in
|
|
|
edecca |
@@ -1915,6 +1915,7 @@
|
|
|
edecca |
<synic state='on'/>
|
|
|
edecca |
<reset state='on'/>
|
|
|
edecca |
<vendor_id state='on' value='KVM Hv'/>
|
|
|
edecca |
+ <frequencies state='on'/>
|
|
|
edecca |
</hyperv>
|
|
|
edecca |
<kvm>
|
|
|
edecca |
<hidden state='on'/>
|
|
|
edecca |
@@ -2037,6 +2038,12 @@
|
|
|
edecca |
on, off; value - string, up to 12 characters
|
|
|
edecca |
1.3.3 (QEMU 2.5)
|
|
|
edecca |
|
|
|
edecca |
+
|
|
|
edecca |
+ frequencies
|
|
|
edecca |
+ Expose frequency MSRs
|
|
|
edecca |
+ on, off
|
|
|
edecca |
+ 4.7.0 (QEMU 2.12)
|
|
|
edecca |
+
|
|
|
edecca |
|
|
|
edecca |
|
|
|
edecca |
pvspinlock
|
|
|
edecca |
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
|
|
edecca |
index ac04af51a1..f156a6b7c4 100644
|
|
|
edecca |
--- a/docs/schemas/domaincommon.rng
|
|
|
edecca |
+++ b/docs/schemas/domaincommon.rng
|
|
|
edecca |
@@ -5713,6 +5713,11 @@
|
|
|
edecca |
</optional>
|
|
|
edecca |
</element>
|
|
|
edecca |
</optional>
|
|
|
edecca |
+ <optional>
|
|
|
edecca |
+ <element name="frequencies">
|
|
|
edecca |
+ <ref name="featurestate"/>
|
|
|
edecca |
+ </element>
|
|
|
edecca |
+ </optional>
|
|
|
edecca |
</interleave>
|
|
|
edecca |
</element>
|
|
|
edecca |
</define>
|
|
|
edecca |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
edecca |
index 240b33f28c..150dd8acc8 100644
|
|
|
edecca |
--- a/src/conf/domain_conf.c
|
|
|
edecca |
+++ b/src/conf/domain_conf.c
|
|
|
edecca |
@@ -169,7 +169,8 @@ VIR_ENUM_IMPL(virDomainHyperv, VIR_DOMAIN_HYPERV_LAST,
|
|
|
edecca |
"synic",
|
|
|
edecca |
"stimer",
|
|
|
edecca |
"reset",
|
|
|
edecca |
- "vendor_id")
|
|
|
edecca |
+ "vendor_id",
|
|
|
edecca |
+ "frequencies")
|
|
|
edecca |
|
|
|
edecca |
VIR_ENUM_IMPL(virDomainKVM, VIR_DOMAIN_KVM_LAST,
|
|
|
edecca |
"hidden")
|
|
|
edecca |
@@ -20051,6 +20052,7 @@ virDomainDefParseXML(xmlDocPtr xml,
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_SYNIC:
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_STIMER:
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_RESET:
|
|
|
edecca |
+ case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
|
|
edecca |
break;
|
|
|
edecca |
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_SPINLOCKS:
|
|
|
edecca |
@@ -22242,6 +22244,7 @@ virDomainDefFeaturesCheckABIStability(virDomainDefPtr src,
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_SYNIC:
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_STIMER:
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_RESET:
|
|
|
edecca |
+ case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
|
|
edecca |
if (src->hyperv_features[i] != dst->hyperv_features[i]) {
|
|
|
edecca |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
edecca |
_("State of HyperV enlightenment "
|
|
|
edecca |
@@ -27890,6 +27893,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_SYNIC:
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_STIMER:
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_RESET:
|
|
|
edecca |
+ case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
|
|
edecca |
break;
|
|
|
edecca |
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_SPINLOCKS:
|
|
|
edecca |
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
|
|
edecca |
index 5e2f21dea3..97d38ff7b9 100644
|
|
|
edecca |
--- a/src/conf/domain_conf.h
|
|
|
edecca |
+++ b/src/conf/domain_conf.h
|
|
|
edecca |
@@ -1791,6 +1791,7 @@ typedef enum {
|
|
|
edecca |
VIR_DOMAIN_HYPERV_STIMER,
|
|
|
edecca |
VIR_DOMAIN_HYPERV_RESET,
|
|
|
edecca |
VIR_DOMAIN_HYPERV_VENDOR_ID,
|
|
|
edecca |
+ VIR_DOMAIN_HYPERV_FREQUENCIES,
|
|
|
edecca |
|
|
|
edecca |
VIR_DOMAIN_HYPERV_LAST
|
|
|
edecca |
} virDomainHyperv;
|
|
|
edecca |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
edecca |
index 809da94117..a2fbfb577d 100644
|
|
|
edecca |
--- a/src/cpu/cpu_x86.c
|
|
|
edecca |
+++ b/src/cpu/cpu_x86.c
|
|
|
edecca |
@@ -109,6 +109,8 @@ KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_VPINDEX,
|
|
|
edecca |
0x40000003, 0x00000040);
|
|
|
edecca |
KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_RESET,
|
|
|
edecca |
0x40000003, 0x00000080);
|
|
|
edecca |
+KVM_FEATURE_DEF(VIR_CPU_x86_KVM_HV_FREQUENCIES,
|
|
|
edecca |
+ 0x40000003, 0x00000800);
|
|
|
edecca |
|
|
|
edecca |
static virCPUx86Feature x86_kvm_features[] =
|
|
|
edecca |
{
|
|
|
edecca |
@@ -129,6 +131,7 @@ static virCPUx86Feature x86_kvm_features[] =
|
|
|
edecca |
KVM_FEATURE(VIR_CPU_x86_KVM_HV_VAPIC),
|
|
|
edecca |
KVM_FEATURE(VIR_CPU_x86_KVM_HV_VPINDEX),
|
|
|
edecca |
KVM_FEATURE(VIR_CPU_x86_KVM_HV_RESET),
|
|
|
edecca |
+ KVM_FEATURE(VIR_CPU_x86_KVM_HV_FREQUENCIES),
|
|
|
edecca |
};
|
|
|
edecca |
|
|
|
edecca |
typedef struct _virCPUx86Model virCPUx86Model;
|
|
|
edecca |
diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h
|
|
|
edecca |
index b89110f16c..c01eb41be5 100644
|
|
|
edecca |
--- a/src/cpu/cpu_x86_data.h
|
|
|
edecca |
+++ b/src/cpu/cpu_x86_data.h
|
|
|
edecca |
@@ -63,6 +63,7 @@ struct _virCPUx86CPUID {
|
|
|
edecca |
# define VIR_CPU_x86_KVM_HV_VAPIC "__kvm_hv_vapic"
|
|
|
edecca |
# define VIR_CPU_x86_KVM_HV_VPINDEX "__kvm_hv_vpindex"
|
|
|
edecca |
# define VIR_CPU_x86_KVM_HV_RESET "__kvm_hv_reset"
|
|
|
edecca |
+# define VIR_CPU_x86_KVM_HV_FREQUENCIES "__kvm_hv_frequencies"
|
|
|
edecca |
|
|
|
edecca |
|
|
|
edecca |
# define VIR_CPU_X86_DATA_INIT { 0 }
|
|
|
edecca |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
edecca |
index 028f48310b..82c349819e 100644
|
|
|
edecca |
--- a/src/qemu/qemu_command.c
|
|
|
edecca |
+++ b/src/qemu/qemu_command.c
|
|
|
edecca |
@@ -6919,6 +6919,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd,
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_SYNIC:
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_STIMER:
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_RESET:
|
|
|
edecca |
+ case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
|
|
edecca |
if (def->hyperv_features[i] == VIR_TRISTATE_SWITCH_ON)
|
|
|
edecca |
virBufferAsprintf(&buf, ",hv_%s",
|
|
|
edecca |
virDomainHypervTypeToString(i));
|
|
|
edecca |
diff --git a/src/qemu/qemu_parse_command.c b/src/qemu/qemu_parse_command.c
|
|
|
edecca |
index 351425fedd..ffea9a26bd 100644
|
|
|
edecca |
--- a/src/qemu/qemu_parse_command.c
|
|
|
edecca |
+++ b/src/qemu/qemu_parse_command.c
|
|
|
edecca |
@@ -1536,6 +1536,7 @@ qemuParseCommandLineCPU(virDomainDefPtr dom,
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_SYNIC:
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_STIMER:
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_RESET:
|
|
|
edecca |
+ case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
|
|
edecca |
if (value) {
|
|
|
edecca |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
edecca |
_("HyperV feature '%s' should not "
|
|
|
edecca |
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
|
|
edecca |
index 2d51c0fa25..dd92a6c179 100644
|
|
|
edecca |
--- a/src/qemu/qemu_process.c
|
|
|
edecca |
+++ b/src/qemu/qemu_process.c
|
|
|
edecca |
@@ -3923,6 +3923,7 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def,
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_SYNIC:
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_STIMER:
|
|
|
edecca |
case VIR_DOMAIN_HYPERV_RESET:
|
|
|
edecca |
+ case VIR_DOMAIN_HYPERV_FREQUENCIES:
|
|
|
edecca |
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
edecca |
_("host doesn't support hyperv '%s' feature"),
|
|
|
edecca |
virDomainHypervTypeToString(i));
|
|
|
edecca |
diff --git a/tests/qemuxml2argvdata/hyperv-off.xml b/tests/qemuxml2argvdata/hyperv-off.xml
|
|
|
edecca |
index ba9c978848..d3a8455ac3 100644
|
|
|
edecca |
--- a/tests/qemuxml2argvdata/hyperv-off.xml
|
|
|
edecca |
+++ b/tests/qemuxml2argvdata/hyperv-off.xml
|
|
|
edecca |
@@ -20,6 +20,7 @@
|
|
|
edecca |
<stimer state='off'/>
|
|
|
edecca |
<reset state='off'/>
|
|
|
edecca |
<vendor_id state='off'/>
|
|
|
edecca |
+ <frequencies state='off'/>
|
|
|
edecca |
</hyperv>
|
|
|
edecca |
</features>
|
|
|
edecca |
<clock offset='utc'/>
|
|
|
edecca |
diff --git a/tests/qemuxml2argvdata/hyperv.args b/tests/qemuxml2argvdata/hyperv.args
|
|
|
edecca |
index a1acbb63de..53026bb2d5 100644
|
|
|
edecca |
--- a/tests/qemuxml2argvdata/hyperv.args
|
|
|
edecca |
+++ b/tests/qemuxml2argvdata/hyperv.args
|
|
|
edecca |
@@ -9,7 +9,7 @@ QEMU_AUDIO_DRV=none \
|
|
|
edecca |
-S \
|
|
|
edecca |
-machine pc,accel=tcg,usb=off,dump-guest-core=off \
|
|
|
edecca |
-cpu 'qemu32,hv_relaxed,hv_vapic,hv_spinlocks=0x2fff,hv_vpindex,hv_runtime,\
|
|
|
edecca |
-hv_synic,hv_stimer,hv_reset,hv_vendor_id=KVM Hv' \
|
|
|
edecca |
+hv_synic,hv_stimer,hv_reset,hv_vendor_id=KVM Hv,hv_frequencies' \
|
|
|
edecca |
-m 214 \
|
|
|
edecca |
-smp 6,sockets=6,cores=1,threads=1 \
|
|
|
edecca |
-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
|
|
|
edecca |
diff --git a/tests/qemuxml2argvdata/hyperv.xml b/tests/qemuxml2argvdata/hyperv.xml
|
|
|
edecca |
index 09f6d21024..27372d1636 100644
|
|
|
edecca |
--- a/tests/qemuxml2argvdata/hyperv.xml
|
|
|
edecca |
+++ b/tests/qemuxml2argvdata/hyperv.xml
|
|
|
edecca |
@@ -20,6 +20,7 @@
|
|
|
edecca |
<stimer state='on'/>
|
|
|
edecca |
<reset state='on'/>
|
|
|
edecca |
<vendor_id state='on' value='KVM Hv'/>
|
|
|
edecca |
+ <frequencies state='on'/>
|
|
|
edecca |
</hyperv>
|
|
|
edecca |
</features>
|
|
|
edecca |
<clock offset='utc'/>
|
|
|
edecca |
diff --git a/tests/qemuxml2xmloutdata/hyperv-off.xml b/tests/qemuxml2xmloutdata/hyperv-off.xml
|
|
|
edecca |
index 07eaf7219d..3ba0b827c3 100644
|
|
|
edecca |
--- a/tests/qemuxml2xmloutdata/hyperv-off.xml
|
|
|
edecca |
+++ b/tests/qemuxml2xmloutdata/hyperv-off.xml
|
|
|
edecca |
@@ -20,6 +20,7 @@
|
|
|
edecca |
<stimer state='off'/>
|
|
|
edecca |
<reset state='off'/>
|
|
|
edecca |
<vendor_id state='off'/>
|
|
|
edecca |
+ <frequencies state='off'/>
|
|
|
edecca |
</hyperv>
|
|
|
edecca |
</features>
|
|
|
edecca |
<clock offset='utc'/>
|
|
|
edecca |
diff --git a/tests/qemuxml2xmloutdata/hyperv.xml b/tests/qemuxml2xmloutdata/hyperv.xml
|
|
|
edecca |
index f9ae9504de..1e47a946d6 100644
|
|
|
edecca |
--- a/tests/qemuxml2xmloutdata/hyperv.xml
|
|
|
edecca |
+++ b/tests/qemuxml2xmloutdata/hyperv.xml
|
|
|
edecca |
@@ -20,6 +20,7 @@
|
|
|
edecca |
<stimer state='on'/>
|
|
|
edecca |
<reset state='on'/>
|
|
|
edecca |
<vendor_id state='on' value='KVM Hv'/>
|
|
|
edecca |
+ <frequencies state='on'/>
|
|
|
edecca |
</hyperv>
|
|
|
edecca |
</features>
|
|
|
edecca |
<clock offset='utc'/>
|
|
|
edecca |
--
|
|
|
edecca |
2.19.1
|
|
|
edecca |
|