Before a TD can run, it needs to - setup/configure TD HOB list; - initialize TDVF into TD's private memory; - initialize TD vcpu state; Register a machine_init_done callback to all those stuff. Signed-off-by: Xiaoyao Li <xiaoyao.li@xxxxxxxxx> --- target/i386/kvm/tdx.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c index 2953d2728b32..a95d5b894c34 100644 --- a/target/i386/kvm/tdx.c +++ b/target/i386/kvm/tdx.c @@ -16,6 +16,7 @@ #include "qom/object_interfaces.h" #include "standard-headers/asm-x86/kvm_para.h" #include "sysemu/kvm.h" +#include "sysemu/sysemu.h" #include "hw/i386/x86.h" #include "kvm_i386.h" @@ -126,6 +127,15 @@ static void get_tdx_capabilities(void) tdx_caps = caps; } +static void tdx_finalize_vm(Notifier *notifier, void *unused) +{ + /* TODO */ +} + +static Notifier tdx_machine_done_notify = { + .notify = tdx_finalize_vm, +}; + int tdx_kvm_init(MachineState *ms, Error **errp) { TdxGuest *tdx = (TdxGuest *)object_dynamic_cast(OBJECT(ms->cgs), @@ -144,6 +154,8 @@ int tdx_kvm_init(MachineState *ms, Error **errp) */ kvm_readonly_mem_allowed = false; + qemu_add_machine_init_done_notifier(&tdx_machine_done_notify); + tdx_guest = tdx; return 0; -- 2.27.0