|
@@ -4529,6 +4529,18 @@ int kvm_arch_put_registers(CPUState *cpu, int level)
|
|
|
|
|
|
assert(cpu_is_stopped(cpu) || qemu_cpu_is_self(cpu));
|
|
|
|
|
|
+ /*
|
|
|
+ * Put MSR_IA32_FEATURE_CONTROL first, this ensures the VM gets out of VMX
|
|
|
+ * root operation upon vCPU reset. kvm_put_msr_feature_control() should also
|
|
|
+ * preceed kvm_put_nested_state() when 'real' nested state is set.
|
|
|
+ */
|
|
|
+ if (level >= KVM_PUT_RESET_STATE) {
|
|
|
+ ret = kvm_put_msr_feature_control(x86_cpu);
|
|
|
+ if (ret < 0) {
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/* must be before kvm_put_nested_state so that EFER.SVME is set */
|
|
|
ret = has_sregs2 ? kvm_put_sregs2(x86_cpu) : kvm_put_sregs(x86_cpu);
|
|
|
if (ret < 0) {
|
|
@@ -4540,11 +4552,6 @@ int kvm_arch_put_registers(CPUState *cpu, int level)
|
|
|
if (ret < 0) {
|
|
|
return ret;
|
|
|
}
|
|
|
-
|
|
|
- ret = kvm_put_msr_feature_control(x86_cpu);
|
|
|
- if (ret < 0) {
|
|
|
- return ret;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
if (level == KVM_PUT_FULL_STATE) {
|