Hi Brijesh, I triggered an assertion failure here: On 02/28/18 22:10, Brijesh Singh wrote: > When memory encryption is enabled, KVM_SEV_INIT command is used to > initialize the platform. The command loads the SEV related persistent > data from non-volatile storage and initializes the platform context. > This command should be first issued before invoking any other guest > commands provided by the SEV firmware. > > Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx> > Cc: Richard Henderson <rth@xxxxxxxxxxx> > Cc: Eduardo Habkost <ehabkost@xxxxxxxxxx> > Signed-off-by: Brijesh Singh <brijesh.singh@xxxxxxx> > --- > accel/kvm/kvm-all.c | 15 ++++ > include/sysemu/sev.h | 22 +++++ > stubs/Makefile.objs | 1 + > stubs/sev.c | 21 +++++ > target/i386/Makefile.objs | 2 +- > target/i386/monitor.c | 11 ++- > target/i386/sev-stub.c | 41 +++++++++ > target/i386/sev.c | 222 ++++++++++++++++++++++++++++++++++++++++++++++ > target/i386/sev_i386.h | 29 ++++++ > target/i386/trace-events | 3 + > 10 files changed, 364 insertions(+), 3 deletions(-) > create mode 100644 include/sysemu/sev.h > create mode 100644 stubs/sev.c > create mode 100644 target/i386/sev-stub.c [...] > @@ -1636,6 +1640,17 @@ static int kvm_init(MachineState *ms) > > kvm_state = s; > > + /* > + * if memory encryption object is specified then initialize the memory > + * encryption context. > + */ > + if (ms->memory_encryption) { > + kvm_state->memcrypt_handle = sev_guest_init(ms->memory_encryption); > + if (!kvm_state->memcrypt_handle) { > + goto err; > + } > + } > + You should set the "err" variable to a negative error code; otherwise the assertion at the "err" label will trigger: err: assert(ret < 0); Thanks Laszlo