summary refs log tree commit diff stats
path: root/target/i386/machine.c
diff options
context:
space:
mode:
authorMaxim Levitsky <mlevitsk@redhat.com>2021-11-01 15:23:00 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2021-11-02 15:57:27 +0100
commitcabf9862e42ffeab9de9b1bfa12cddaf125c53e8 (patch)
tree3482c587ed922db9a72dd5e8281e840dda5875e0 /target/i386/machine.c
parent6aedeb650e6978ee8165f05b79fbfab6ed486eff (diff)
downloadfocaccia-qemu-cabf9862e42ffeab9de9b1bfa12cddaf125c53e8.tar.gz
focaccia-qemu-cabf9862e42ffeab9de9b1bfa12cddaf125c53e8.zip
KVM: SVM: add migration support for nested TSC scaling
Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20211101132300.192584-4-mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target/i386/machine.c')
-rw-r--r--target/i386/machine.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/target/i386/machine.c b/target/i386/machine.c
index 4367931623..83c2b91529 100644
--- a/target/i386/machine.c
+++ b/target/i386/machine.c
@@ -1280,6 +1280,27 @@ static const VMStateDescription vmstate_spec_ctrl = {
     }
 };
 
+
+static bool amd_tsc_scale_msr_needed(void *opaque)
+{
+    X86CPU *cpu = opaque;
+    CPUX86State *env = &cpu->env;
+
+    return (env->features[FEAT_SVM] & CPUID_SVM_TSCSCALE);
+}
+
+static const VMStateDescription amd_tsc_scale_msr_ctrl = {
+    .name = "cpu/amd_tsc_scale_msr",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .needed = amd_tsc_scale_msr_needed,
+    .fields = (VMStateField[]){
+        VMSTATE_UINT64(env.amd_tsc_scale_msr, X86CPU),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
+
 static bool intel_pt_enable_needed(void *opaque)
 {
     X86CPU *cpu = opaque;
@@ -1558,6 +1579,7 @@ const VMStateDescription vmstate_x86_cpu = {
         &vmstate_pkru,
         &vmstate_pkrs,
         &vmstate_spec_ctrl,
+        &amd_tsc_scale_msr_ctrl,
         &vmstate_mcg_ext_ctl,
         &vmstate_msr_intel_pt,
         &vmstate_msr_virt_ssbd,