Re: [PATCH v2 01/17] KVM: TDX: Add support for find pending IRQ in a protected local APIC

From: Chao Gao
Date: Wed Feb 12 2025 - 03:13:41 EST


>diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c
>index 7f1318c44040..2b1ea57a3a4e 100644
>--- a/arch/x86/kvm/vmx/main.c
>+++ b/arch/x86/kvm/vmx/main.c
>@@ -62,6 +62,8 @@ static __init int vt_hardware_setup(void)
> vt_x86_ops.set_external_spte = tdx_sept_set_private_spte;
> vt_x86_ops.free_external_spt = tdx_sept_free_private_spt;
> vt_x86_ops.remove_external_spte = tdx_sept_remove_private_spte;

Nit: I think it would be more consistent to set up .protected_apic_has_interrupt
if TDX is enabled (rather than clearing it if TDX is disabled).

>+ } else {
>+ vt_x86_ops.protected_apic_has_interrupt = NULL;
> }
>
> return 0;
>@@ -371,6 +373,7 @@ struct kvm_x86_ops vt_x86_ops __initdata = {
> .sync_pir_to_irr = vmx_sync_pir_to_irr,
> .deliver_interrupt = vmx_deliver_interrupt,
> .dy_apicv_has_pending_interrupt = pi_has_pending_interrupt,
>+ .protected_apic_has_interrupt = tdx_protected_apic_has_interrupt,
>
> .set_tss_addr = vmx_set_tss_addr,
> .set_identity_map_addr = vmx_set_identity_map_addr,