[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 8/8] i386/sev: Replace LAUNCH_FINISH ioctl with sev library e
From: |
Tyler Fanelli |
Subject: |
[RFC PATCH 8/8] i386/sev: Replace LAUNCH_FINISH ioctl with sev library equivalent |
Date: |
Thu, 14 Sep 2023 12:33:59 -0400 |
The LAUNCH_FINISH ioctl finishes the guest launch flow and transitions
the guest into a state ready to be run.
If this API ioctl call fails, fw_error will be set accordingly.
Signed-off-by: Tyler Fanelli <tfanelli@redhat.com>
---
target/i386/sev.c | 38 ++++++++++++++++----------------------
1 file changed, 16 insertions(+), 22 deletions(-)
diff --git a/target/i386/sev.c b/target/i386/sev.c
index a4510b5437..e52dcc67c3 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -785,35 +785,29 @@ static Notifier sev_machine_done_notify = {
.notify = sev_launch_get_measure,
};
-static void
-sev_launch_finish(SevGuestState *sev)
-{
- int ret, error;
-
- trace_kvm_sev_launch_finish();
- ret = sev_ioctl(sev->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, SEV_STATE_RUNNING);
-
- /* add migration blocker */
- error_setg(&sev_mig_blocker,
- "SEV: Migration is not implemented");
- migrate_add_blocker(sev_mig_blocker, &error_fatal);
-}
-
static void
sev_vm_state_change(void *opaque, bool running, RunState state)
{
SevGuestState *sev = opaque;
+ int ret, fw_error;
+ KVMState *s = kvm_state;
if (running) {
if (!sev_check_state(sev, SEV_STATE_RUNNING)) {
- sev_launch_finish(sev);
+ trace_kvm_sev_launch_finish();
+ ret = sev_launch_finish(s->vmfd, &fw_error);
+ if (ret) {
+ error_report("%s: LAUNCH_FINISH ret=%d fw_error=%d '%s'",
+ __func__, ret, fw_error,
+ fw_error_to_str(fw_error));
+ exit(1);
+ }
+
+ sev_set_guest_state(sev, SEV_STATE_RUNNING);
+
+ // add migration blocker.
+ error_setg(&sev_mig_blocker, "SEV: Migration is not implemented");
+ migrate_add_blocker(sev_mig_blocker, &error_fatal);
}
}
}
--
2.40.1
- [RFC PATCH 4/8] i386/sev: Replace UPDATE_DATA ioctl with sev library equivalent, (continued)
- [RFC PATCH 4/8] i386/sev: Replace UPDATE_DATA ioctl with sev library equivalent, Tyler Fanelli, 2023/09/14
- [RFC PATCH 5/8] i386/sev: Replace LAUNCH_UPDATE_VMSA ioctl with sev library equivalent, Tyler Fanelli, 2023/09/14
- [RFC PATCH 6/8] i386/sev: Replace LAUNCH_MEASURE ioctl with sev library equivalent, Tyler Fanelli, 2023/09/14
- [RFC PATCH 8/8] i386/sev: Replace LAUNCH_FINISH ioctl with sev library equivalent, Tyler Fanelli, 2023/09/14
- [RFC PATCH 7/8] i386/sev: Replace LAUNCH_SECRET ioctl with sev library equivalent, Tyler Fanelli, 2023/09/14
- Re: [RFC PATCH 0/8] i386/sev: Use C API of Rust SEV library, Philippe Mathieu-Daudé, 2023/09/14
- [RFC PATCH 0/8] i386/sev: Use C API of Rust SEV library, Tyler Fanelli, 2023/09/14
- [RFC PATCH 5/8] i386/sev: Replace LAUNCH_UPDATE_VMSA ioctl with sev library equivalent, Tyler Fanelli, 2023/09/14
- [RFC PATCH 7/8] i386/sev: Replace LAUNCH_SECRET ioctl with sev library equivalent, Tyler Fanelli, 2023/09/14
- [RFC PATCH 8/8] i386/sev: Replace LAUNCH_FINISH ioctl with sev library equivalent,
Tyler Fanelli <=
- [RFC PATCH 4/8] i386/sev: Replace UPDATE_DATA ioctl with sev library equivalent, Tyler Fanelli, 2023/09/14
- [RFC PATCH 1/8] Add SEV Rust library as dependency with CONFIG_SEV, Tyler Fanelli, 2023/09/14
- [RFC PATCH 6/8] i386/sev: Replace LAUNCH_MEASURE ioctl with sev library equivalent, Tyler Fanelli, 2023/09/14
- [RFC PATCH 3/8] i386/sev: Replace LAUNCH_START ioctl with sev library equivalent, Tyler Fanelli, 2023/09/14
- [RFC PATCH 2/8] i386/sev: Replace INIT and ES_INIT ioctls with sev library equivalents, Tyler Fanelli, 2023/09/14