On Fri, May 24, 2024 at 02:21:24PM +0800, Zhenzhong Duan wrote:
Utilize the existing fake reboot mechanism to do reboot for TDX
guest.
Different from normal guest, TDX guest doesn't support system_reset,
so have to kill the old guest and start a new one to simulate the reboot.
Co-developed-by: Chenyi Qiang <chenyi.qiang(a)intel.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan(a)intel.com>
---
src/qemu/qemu_process.c | 74 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 74 insertions(+)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index bd8624e3f6..35758d882f 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -441,6 +441,75 @@ qemuProcessHandleReset(qemuMonitor *mon G_GNUC_UNUSED,
}
+static void
+qemuProcessSecFakeReboot(void *opaque)
+{
snip
+}
+
+
/*
* Since we have the '-no-shutdown' flag set, the
* QEMU process will currently have guest OS shutdown
@@ -459,6 +528,11 @@ qemuProcessFakeReboot(void *opaque)
int ret = -1, rc;
VIR_DEBUG("vm=%p", vm);
+
+ if (vm->def->sec &&
+ vm->def->sec->sectype == VIR_DOMAIN_LAUNCH_SECURITY_TDX)
+ return qemuProcessSecFakeReboot(opaque);
+
virObjectLock(vm);
if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0)
goto cleanup;
So the 'qemuProcessFakeReboot' currently fakes reboot via a
machine CPU reset. This new code fakes reboot via QEMU
re-creation.
I'd suggest that the current method gets renamed to
qemuProcessFakeRebootViaReset(), then your new
qemuProcessSecFakeReboot() gets renamed to
qemuProcessFakeRebootViaRecreate().
Then create a qemuProcessFakeReboot, that calls into either
qemuProcessFakeRebootViaReset or qemuProcessFakeRebootViaRecreate
as appropriate.
With regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|