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>
This commit is contained in:
Maxim Levitsky 2021-11-01 15:23:00 +02:00 committed by Paolo Bonzini
parent 6aedeb650e
commit cabf9862e4
4 changed files with 46 additions and 0 deletions

View file

@ -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,