Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:dirkmueller:acdc:as_python3_module
qemu-linux-user.19805
0058-sev-i386-finalize-the-SEV-guest-lau.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0058-sev-i386-finalize-the-SEV-guest-lau.patch of Package qemu-linux-user.19805
From: Brijesh Singh <brijesh.singh@amd.com> Date: Thu, 8 Mar 2018 06:48:52 -0600 Subject: sev/i386: finalize the SEV guest launch flow SEV launch flow requires us to issue LAUNCH_FINISH command before guest is ready to run. Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Richard Henderson <rth@twiddle.net> Cc: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Brijesh Singh <brijesh.singh@amd.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> (cherry picked from commit 5dd0df7e742100d1abf2d6ede42c2ad366da6dc8) [BR: FATE#322124] Signed-off-by: Bruce Rogers <brogers@suse.com> --- target/i386/sev.c | 29 +++++++++++++++++++++++++++++ target/i386/trace-events | 1 + 2 files changed, 30 insertions(+) diff --git a/target/i386/sev.c b/target/i386/sev.c index 0132beaf24b4610d044d583f2b1c..dc8136c56e7626ac261bc6b91df0 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -578,6 +578,34 @@ static Notifier sev_machine_done_notify = { .notify = sev_launch_get_measure, }; +static void +sev_launch_finish(SEVState *s) +{ + int ret, error; + + trace_kvm_sev_launch_finish(); + ret = sev_ioctl(sev_state->sev_fd, KVM_SEV_LAUNCH_FINISH, 0, &error); + if (ret) { + error_report("%s: LAUNCH_FINISH ret=%d fw_error=%d '%s'", + __func__, ret, error, fw_error_to_str(error)); + exit(1); + } + + sev_set_guest_state(SEV_STATE_RUNNING); +} + +static void +sev_vm_state_change(void *opaque, int running, RunState state) +{ + SEVState *s = opaque; + + if (running) { + if (!sev_check_state(SEV_STATE_RUNNING)) { + sev_launch_finish(s); + } + } +} + void * sev_guest_init(const char *id) { @@ -656,6 +684,7 @@ sev_guest_init(const char *id) 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, s); return s; err: diff --git a/target/i386/trace-events b/target/i386/trace-events index ce6c71b375c2cd6b0ec9fdf6f2b4..6a19a69af5d0a5bbff1c30047de2 100644 --- a/target/i386/trace-events +++ b/target/i386/trace-events @@ -14,3 +14,4 @@ kvm_sev_change_state(const char *old, const char *new) "%s -> %s" kvm_sev_launch_start(int policy, void *session, void *pdh) "policy 0x%x session %p pdh %p" kvm_sev_launch_update_data(void *addr, uint64_t len) "addr %p len 0x%" PRIu64 kvm_sev_launch_measurement(const char *value) "data %s" +kvm_sev_launch_finish(void) ""
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor