Re: [PATCH v19 089/130] KVM: TDX: Add support for find pending IRQ in a protected local APIC

Edgecombe, Rick P
2024-04-16T14:12:44Z

On Mon, 2024-02-26 at 00:26 -0800, isaku.yamahata@intel.com wrote:
>
> +static bool vt_protected_apic_has_interrupt(struct kvm_vcpu *vcpu)
> +{
> +       KVM_BUG_ON(!is_td_vcpu(vcpu), vcpu->kvm);
> +
> +       return tdx_protected_apic_has_interrupt(vcpu);
> +}
> +

There was some internal discussion on whether to drop the KVM_BUG_ON() here, and
then since vt_protected_apic_has_interrupt() would be just a simple call to
tdx_protected_apic_has_interrupt(), just wire in
tdx_protected_apic_has_interrupt() directly.

The reasoning for dropping the KVM_BUG_ON() is that the function has "protected"
in its name so is unlikely to be called in another context. It was apparently
added when the TDX series was still new. But with the more mature series it
doesn't seem likely to find any bugs. The caller checks
vcpu->arch.apic->guest_apic_protected.