]> git.ipfire.org Git - thirdparty/qemu.git/commit
i386/tdx: Initialize TDX before creating TD vcpus
authorXiaoyao Li <xiaoyao.li@intel.com>
Thu, 8 May 2025 14:59:14 +0000 (10:59 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 28 May 2025 17:01:40 +0000 (19:01 +0200)
commitf15898b0f50609d66465326221aa54b6699da674
treea758af2f877083448178660642d52348c32d3afb
parenta668268dc08f7f4d30cecd513054bb38ce48c0d6
i386/tdx: Initialize TDX before creating TD vcpus

Invoke KVM_TDX_INIT_VM in kvm_arch_pre_create_vcpu() that
KVM_TDX_INIT_VM configures global TD configurations, e.g. the canonical
CPUID config, and must be executed prior to creating vCPUs.

Use kvm_x86_arch_cpuid() to setup the CPUID settings for TDX VM.

Note, this doesn't address the fact that QEMU may change the CPUID
configuration when creating vCPUs, i.e. punts on refactoring QEMU to
provide a stable CPUID config prior to kvm_arch_init().

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Link: https://lore.kernel.org/r/20250508150002.689633-9-xiaoyao.li@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target/i386/kvm/kvm.c
target/i386/kvm/kvm_i386.h
target/i386/kvm/meson.build
target/i386/kvm/tdx-stub.c [new file with mode: 0644]
target/i386/kvm/tdx.c
target/i386/kvm/tdx.h