Message ID | 20220512031803.3315890-21-xiaoyao.li@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | TDX QEMU support | expand |
On Thu, May 12, 2022 at 11:17:47AM +0800, Xiaoyao Li wrote: > 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. > +static void tdx_finalize_vm(Notifier *notifier, void *unused) > +{ > + /* TODO */ > +} I'd suggest to squash this into the patch actually implementing tdx_finalize_vm. take care, Gerd
On 5/24/2022 3:09 PM, Gerd Hoffmann wrote: > On Thu, May 12, 2022 at 11:17:47AM +0800, Xiaoyao Li wrote: >> 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. > >> +static void tdx_finalize_vm(Notifier *notifier, void *unused) >> +{ >> + /* TODO */ >> +} > > I'd suggest to squash this into the patch actually implementing > tdx_finalize_vm. OK. I'll squash it into the next patch. > take care, > Gerd >
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;
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@intel.com> --- target/i386/kvm/tdx.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)