Hi, This series aims to add support for QEMU to be able to migrate VMs that are running nested hypervisors. In order to do so, it utilizes the new IOCTLs introduced in KVM commit 8fcc4b5923af ("kvm: nVMX: Introduce KVM_CAP_NESTED_STATE") which was created for this purpose.
1st patch introduce kvm_arch_destroy_vcpu() to perform per-vCPU destruction logic that is arch-dependent. 2st patch is just refactoring to use symbolic constants instead of hard-coded numbers. 3st patch fixes QEMU to update DR6 when QEMU re-inject #DB to guest after it was intercepted by KVM when guest is debugged. 4th patch adds migration blocker for vCPU exposed with either Intel VMX or AMD SVM. Until now it was blocked only for Intel VMX. 5rd patch updates linux-headers to have updated struct kvm_nested_state. The updated struct now have explicit fields for the data portion. 6rd patch add vmstate support for saving/restoring kernel integer types (e.g. __u16). 7th patch adds support for saving and restoring nested state in order to migrate guests which run a nested hypervisor. 8th patch add support for KVM_CAP_EXCEPTION_PAYLOAD. This new KVM capability allows userspace to properly distingiush between pending and injecting exceptions. 9th patch reverts a past commit which have added a migration blocker when guest is exposed with VMX. Remaining with only a migration blocker for vCPU exposed with AMD SVM. Regards, -Liran v1->v2 changes: * Add patch to fix bug when re-inject #DB to guest. * Add support for KVM_CAP_EXCEPTION_PAYLOAD. * Use explicit fields for struct kvm_nested_state data portion. * Use vmstate subsections to save/restore nested state in order to properly * support forward & backwards migration compatability. * Remove VMX migration blocker. v2->v3 changes: * Add kvm_arch_destroy_vcpu(). * Use DR6_BS where appropriate. * Add cpu_pre_save() logic to convert pending exception to injected exception if guest is running L2. * Converted max_nested_state_len to int instead of uint32_t. * Use kvm_arch_destroy_vcpu() to free nested_state. * Add migration blocker for vCPU exposed with AMD SVM. * Don't rely on CR4 or MSR_EFER to know if it is required to migrate new VMState subsections. * Signal if vCPU is in guest-mode in hflags as original intention by Paolo. Reference for discussion on v2: https://patchwork.kernel.org/patch/10601689/