On 7/17/2025 5:40 PM, Peter Maydell wrote:
On Fri, 30 May 2025 at 08:23, Paolo Bonzini <pbonz...@redhat.com> wrote:
From: Xiaoyao Li <xiaoyao...@intel.com>
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().
Hi; I noticed something odd about this change when I was
investigating a false-positive Coverity issue:
@@ -162,6 +265,8 @@ static void tdx_guest_init(Object *obj)
ConfidentialGuestSupport *cgs = CONFIDENTIAL_GUEST_SUPPORT(obj);
TdxGuest *tdx = TDX_GUEST(obj);
+ qemu_mutex_init(&tdx->lock);
+
This adds a qemu_mutex_init() call, but we were already
doing that later on in this function, so now we init the mutex twice.
It is 40da501d8989 ("i386/tdx: handle TDG.VP.VMCALL<GetQuote>") that
introduced the second qemu_mutext_init() by mistake.
I'll send an patch to fix it.
Thanks for catching and reporting it!