From: Brijesh Singh <brijesh.si...@amd.com> The LAUNCH_START is used for creating an encryption context to encrypt newly created guest, for an incoming guest the RECEIVE_START should be used.
Reviewed-by: Dr. David Alan Gilbert <dgilb...@redhat.com> Signed-off-by: Brijesh Singh <brijesh.si...@amd.com> Signed-off-by: Ashish Kalra <ashish.ka...@amd.com> --- target/i386/sev.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 5e7c87764c..10038d3880 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -919,12 +919,17 @@ int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp) goto err; } - ret = sev_launch_start(sev); - if (ret) { - error_setg(errp, "%s: failed to create encryption context", __func__); - goto err; + /* + * The LAUNCH context is used for new guest, if its an incoming guest + * then RECEIVE context will be created after the connection is established. + */ + if (!runstate_check(RUN_STATE_INMIGRATE)) { + ret = sev_launch_start(sev); + if (ret) { + error_report("%s: failed to create encryption context", __func__); + goto err; + } } - ram_block_notifier_add(&sev_ram_notifier); qemu_add_machine_init_done_notifier(&sev_machine_done_notify); qemu_add_vm_change_state_handler(sev_vm_state_change, sev); -- 2.17.1