Description of problem: 1. support CSV/CSV2 migration: a) The link https://bugzilla.openanolis.cn/show_bug.cgi?id=5885 is about support for AMD SEV guest live migration. The migration of this solution is very slow because API communication between x86 and PSP is time-consuming. In order to accelerate the migration speed, we proposed ring buffer mode to handle the migration API. [Reference: https://bugzilla.openanolis.cn/show_bug.cgi?id=5938] b) The register states of CSV2 guest are protected by encrypted VMSA. When live migrate a CSV2 guest, we need invoke SEND_UPDATE_VMSA to prepare for transfer VMSA at the source side, and invoke RECEIVE_UPDATE_VMSA to restore VMSA at the receipt side. GHCB registers are important component to support communication between KVM and CSV2 guest. The GHCB register supports two modes: msr negotiation, or shared memory page. When migrate a CSV2 guest, the GHCB register states also should be migrated. The VCPU mode is crucial for the operation of a VM, KVM will track VCPU mode in auxiliary register values (see struct kvm_vcpu_arch) and determine the guest context. In order to support CSV2 guest run under correct VCPU mode, the auxiliary register values should be migrated when migrating CSV2 guest. [Reference: https://bugzilla.openanolis.cn/show_bug.cgi?id=5950] 2. support CSV/CSV2 reboot: a) Currently, when reboot a memory encrypted guest, it'is possible that the virtual machine may crash due to cache consistency issues. But KVM doesn't know whether the guest is rebooting, we introduce ioctl interfaces to support notifying KVM that the guest is rebooting so that flush the cache at appropriate time. KVM use guest_state_protected to indicate the VMSA is encrypted and should not update the related vCPU states anymore. In order to support rebooting a CSV2 guest, we use the ioctl interfaces dictated above to notify KVM that the vCPU states can be initailized during rebooting. [Reference: https://bugzilla.openanolis.cn/show_bug.cgi?id=6135] Version-Release number of selected component (if applicable): How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
The PR Link: https://gitee.com/anolis/cloud-kernel/pulls/2913