On 4/8/22 16:51, Sean Christopherson wrote:
It also documents how it has to be used. So this looks more or less okay,
just rename "vmxip" to "interrupt_pending_delivery".
If we're keeping the call back into SEAM, then this belongs in the path of
apic_has_interrupt_for_ppr(), not in the HLT-exit path. To avoid multiple SEAMCALLS
in a single exit, VCPU_EXREG_RVI can be added.
But apic_has_interrupt_for_ppr takes a PPR argument and that is not
available.
So I suppose you mean kvm_apic_has_interrupt? You would change that to
a callback, like
if (!kvm_apic_present(vcpu))
return -1;
return static_call(kvm_x86_apic_has_interrupt)(vcpu);
}
and the default version would also be inlined in kvm_get_apic_interrupt,
like
- int vector = kvm_apic_has_interrupt(vcpu);
struct kvm_lapic *apic = vcpu->arch.apic;
u32 ppr;
- if (vector == -1)
+ if (!kvm_apic_present(vcpu))
return -1;
+ __apic_update_ppr(apic, &ppr);
+ vector = apic_has_interrupt_for_ppr(apic, ppr);
Checking the SEAM state (which would likewise not be VCPU_EXREG_RVI, but
more like VCPU_EXREG_INTR_PENDING) would be done in the tdx case of
kvm_x86_apic_has_interrupt.
Paolo