Currently, nested virtualisation state is not saved/restored and neither is Hyper-V enlightenment state.
Also, not debug register state nor MTRRs but still usable. Signed-off-by: Mohamed Mediouni <[email protected]> --- target/i386/whpx/whpx-all.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c index d13513985c..5f14564f10 100644 --- a/target/i386/whpx/whpx-all.c +++ b/target/i386/whpx/whpx-all.c @@ -2828,6 +2828,22 @@ static void whpx_cpu_update_state(void *opaque, bool running, RunState state) } } +static bool whpx_is_migration_allowed(CPUState *cpu) { + struct whpx_state *whpx = &whpx_global; + X86CPU *x86_cpu = X86_CPU(cpu); + CPUX86State *env = &x86_cpu->env; + + if (whpx->hyperv_enlightenments_enabled == true) { + return false; + } + + if (cpu_has_vmx(env) || cpu_has_svm(env)) { + return false; + } + + return true; +} + int whpx_init_vcpu(CPUState *cpu) { HRESULT hr; @@ -2845,10 +2861,11 @@ int whpx_init_vcpu(CPUState *cpu) /* Add migration blockers for all unsupported features of the * Windows Hypervisor Platform */ - if (whpx_migration_blocker == NULL) { + if (whpx_migration_blocker == NULL + && !whpx_is_migration_allowed(cpu)) { error_setg(&whpx_migration_blocker, - "State blocked due to missing dirty memory tracking support," - "And some system register/state save-restore "); + "State blocked due to missing Hyper-V enlightenments," + "save-restore and/or nested virtualisation"); if (migrate_add_blocker(&whpx_migration_blocker, &local_error) < 0) { error_report_err(local_error); -- 2.54.0 (Apple Git-157)
