summary refs log tree commit diff stats
path: root/accel/kvm/kvm-all.c
diff options
context:
space:
mode:
authorXiaoyao Li <xiaoyao.li@intel.com>2025-05-08 10:59:13 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2025-05-28 19:01:40 +0200
commita668268dc08f7f4d30cecd513054bb38ce48c0d6 (patch)
tree6819a573a0957ef9e398aee889f11704e3fdbd4d /accel/kvm/kvm-all.c
parent1619d0e45be0d1e48a46d80963b4e77dc1b000a2 (diff)
downloadfocaccia-qemu-a668268dc08f7f4d30cecd513054bb38ce48c0d6.tar.gz
focaccia-qemu-a668268dc08f7f4d30cecd513054bb38ce48c0d6.zip
kvm: Introduce kvm_arch_pre_create_vcpu()
Introduce kvm_arch_pre_create_vcpu(), to perform arch-dependent
work prior to create any vcpu. This is for i386 TDX because it needs
call TDX_INIT_VM before creating any vcpu.

The specific implementation for i386 will be added in the future patch.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Link: https://lore.kernel.org/r/20250508150002.689633-8-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'accel/kvm/kvm-all.c')
-rw-r--r--accel/kvm/kvm-all.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 278a50690c..42d239cf8f 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -545,6 +545,11 @@ int kvm_init_vcpu(CPUState *cpu, Error **errp)
 
     trace_kvm_init_vcpu(cpu->cpu_index, kvm_arch_vcpu_id(cpu));
 
+    ret = kvm_arch_pre_create_vcpu(cpu, errp);
+    if (ret < 0) {
+        goto err;
+    }
+
     ret = kvm_create_vcpu(cpu);
     if (ret < 0) {
         error_setg_errno(errp, -ret,