Re: [PATCH v19 043/130] KVM: TDX: create/free TDX vcpu structure
From: Isaku Yamahata
Date: Thu Mar 21 2024 - 16:22:02 EST
On Thu, Mar 21, 2024 at 09:30:12AM +0800,
Chao Gao <chao.gao@xxxxxxxxx> wrote:
> >+int tdx_vcpu_create(struct kvm_vcpu *vcpu)
> >+{
> >+ struct kvm_tdx *kvm_tdx = to_kvm_tdx(vcpu->kvm);
> >+
> >+ WARN_ON_ONCE(vcpu->arch.cpuid_entries);
> >+ WARN_ON_ONCE(vcpu->arch.cpuid_nent);
> >+
> >+ /* TDX only supports x2APIC, which requires an in-kernel local APIC. */
>
> Cannot QEMU emulate x2APIC? In my understanding, the reason is TDX module always
> enables APICv for TDs. So, KVM cannot intercept every access to APIC and forward
> them to QEMU for emulation.
You're right. Let me update it as follows.
/*
* TDX module always enables APICv for TDs. So, KVM cannot intercept every
* access to APIC and forward them to user space VMM.
*/
> >+ if (!vcpu->arch.apic)
>
> will "if (!irqchip_in_kernel(vcpu->kvm))" work? looks this is the custome for such
> a check.
It should work because kvm_arch_vcpu_create(). Will update it.
--
Isaku Yamahata <isaku.yamahata@xxxxxxxxx>