[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 34/44] target/i386/tdx: set reboot action to shutdown when
From: |
isaku . yamahata |
Subject: |
[RFC PATCH v2 34/44] target/i386/tdx: set reboot action to shutdown when tdx |
Date: |
Wed, 7 Jul 2021 17:55:04 -0700 |
From: Isaku Yamahata <isaku.yamahata@intel.com>
In TDX CPU state is also protected, thus vcpu state can't be reset by VMM.
It assumes -action reboot=shutdown instead of silently ignoring vcpu reset.
TDX module spec version 344425-002US doesn't support vcpu reset by VMM. VM
needs to be destroyed and created again to emulate REBOOT_ACTION_RESET.
For simplicity, put its responsibility to management system like libvirt
because it's difficult for the current qemu implementation to destroy and
re-create KVM VM resources with keeping other resources.
If management system wants reboot behavior for its users, it needs to
- set reboot_action to REBOOT_ACTION_SHUTDOWN,
- set shutdown_action to SHUTDOWN_ACTION_PAUSE optionally and,
- subscribe VM state change and on reboot, (destroy qemu if
SHUTDOWN_ACTION_PAUSE and) start new qemu.
Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
---
target/i386/kvm/tdx.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c
index 1316d95209..0621317b0a 100644
--- a/target/i386/kvm/tdx.c
+++ b/target/i386/kvm/tdx.c
@@ -25,6 +25,7 @@
#include "qapi/qapi-types-misc-target.h"
#include "standard-headers/asm-x86/kvm_para.h"
#include "sysemu/sysemu.h"
+#include "sysemu/runstate-action.h"
#include "sysemu/kvm.h"
#include "sysemu/kvm_int.h"
#include "sysemu/tdx.h"
@@ -363,6 +364,19 @@ static void tdx_guest_init(Object *obj)
qemu_mutex_init(&tdx->lock);
+ /*
+ * TDX module spec version 344425-002US doesn't support reset of vcpu by
+ * VMM. VM needs to be destroyed and created again to emulate
+ * REBOOT_ACTION_RESET. For simplicity, put its responsibility to
+ * management system like libvirt.
+ *
+ * Management system should
+ * - set reboot_action to REBOOT_ACTION_SHUTDOWN
+ * - set shutdown_action to SHUTDOWN_ACTION_PAUSE
+ * - subscribe VM state and on reboot, destroy qemu and start new qemu
+ */
+ reboot_action = REBOOT_ACTION_SHUTDOWN;
+
tdx->debug = false;
object_property_add_bool(obj, "debug", tdx_guest_get_debug,
tdx_guest_set_debug);
--
2.25.1
- [RFC PATCH v2 08/44] i386/kvm: Skip KVM_X86_SETUP_MCE for TDX guests, (continued)
- [RFC PATCH v2 08/44] i386/kvm: Skip KVM_X86_SETUP_MCE for TDX guests, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 17/44] i386/tdx: Add definitions for TDVF metadata, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 11/44] i386/tdx: Implement user specified tsc frequency, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 36/44] hw/i386: add eoi_intercept_unsupported member to X86MachineState, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 07/44] i386/kvm: Squash getting/putting guest state for TDX VMs, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 14/44] i386/tdx: Frame in the call for KVM_TDX_INIT_VCPU, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 16/44] hw/i386: Add definitions from UEFI spec for volumes, resources, etc..., isaku . yamahata, 2021/07/07
- [RFC PATCH v2 37/44] hw/i386: add option to forcibly report edge trigger in acpi tables, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 39/44] ioapic: add property to disallow SMI delivery mode, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 34/44] target/i386/tdx: set reboot action to shutdown when tdx,
isaku . yamahata <=
- [RFC PATCH v2 06/44] hw/i386: Introduce kvm-type for TDX guest, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 05/44] linux-headers: Update headers to pull in TDX API changes, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 15/44] i386/tdx: Add hook to require generic device loader, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 18/44] hw/i386: refactor e820_add_entry(), isaku . yamahata, 2021/07/07
- [RFC PATCH v2 19/44] hw/i386/e820: introduce a helper function to change type of e820, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 41/44] ioapic: add property to disallow INIT/SIPI delivery mode, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 20/44] i386/tdx: Parse tdx metadata and store the result into TdxGuestState, isaku . yamahata, 2021/07/07
- [RFC PATCH v2 22/44] i386/tdx: Add TDVF memory via INIT_MEM_REGION, isaku . yamahata, 2021/07/07