tdx_mig_setup is assigned to the cgs migration framework's
savevm_state_setup API (invoked on the source side) and loadvm_state_setup
API (invoked on the destination side). The setup work includes:
- create a kvm_device from the tdx-mig driver in KVM. The device fd is
returned for later communication with the device.
- negotiate with the driver for the size if the memory to map, this
includes:
-- KVM_SET_DEVICE_ATTR: sets the configurable attr (only the migration
buffer size currently) of the device to KVM. The migration flow
currently finds and send dirty pages one by one, so the migration
buffer size set to the driver is 4KB (TAGET_PAGE_SIZE);
-- KVM_GET_DEVICE_ATTR: gets the negotiated kvm_device's attr. This
obtains from KVM the sizes of the 4 parts (i.e. mbmd buffer size,
migration buffer size, mac list buffer size, and gpa list buffer
size) of shared memory.
- map the 4 parts of shared memory.
Signed-off-by: Wei Wang <wei.w.wang@intel.com>