When vCPU is in VMX operation and enters SMM mode, it temporarily exits VMX operation but KVM maintained nested-state still stores the VMXON region physical address, i.e. even when the vCPU is in SMM mode then (nested_state->hdr.vmx.vmxon_pa != -1ull). Therefore, there is no need to explicitly check for KVM_STATE_NESTED_SMM_VMXON to determine if it is necessary to save nested-state as part of migration stream. In addition, destination must enable eVMCS if it is enabled on source as specified by the KVM_STATE_NESTED_EVMCS flag, even if the VMXON region is not set. Thus, change the code to require saving nested-state as part of migration stream in case it is set. Reviewed-by: Karl Heubaum <karl.heubaum@xxxxxxxxxx> Signed-off-by: Liran Alon <liran.alon@xxxxxxxxxx> --- target/i386/machine.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/i386/machine.c b/target/i386/machine.c index 851b249d1a39..e7d72faf9e24 100644 --- a/target/i386/machine.c +++ b/target/i386/machine.c @@ -999,7 +999,7 @@ static bool vmx_nested_state_needed(void *opaque) return ((nested_state->format == KVM_STATE_NESTED_FORMAT_VMX) && ((nested_state->hdr.vmx.vmxon_pa != -1ull) || - (nested_state->hdr.vmx.smm.flags & KVM_STATE_NESTED_SMM_VMXON))); + (nested_state->flags & KVM_STATE_NESTED_EVMCS))); } static const VMStateDescription vmstate_vmx_nested_state = { -- 2.20.1