Message ID | 489df8a1b8fb43677c2c2c5347398ce985713577.1625186503.git.isaku.yamahata@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | KVM: X86: TDX support | expand |
On 03/07/21 00:04, isaku.yamahata@intel.com wrote: > From: Sean Christopherson <sean.j.christopherson@intel.com> > > Return true for kvm_vcpu_has_events() if the vCPU has a pending APICv > interrupt to support TDX's usage of APICv. Unlike VMX, TDX doesn't have > access to vmcs.GUEST_INTR_STATUS and so can't emulate posted interrupts, > i.e. needs to generate a posted interrupt and more importantly can't > manually move requested interrupts into the vIRR (which it also doesn't > have access to). > > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> > Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com> > --- > arch/x86/kvm/x86.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index f1d5e0a53640..92d5a6649a21 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -11341,7 +11341,9 @@ static inline bool kvm_vcpu_has_events(struct kvm_vcpu *vcpu) > > if (kvm_arch_interrupt_allowed(vcpu) && > (kvm_cpu_has_interrupt(vcpu) || > - kvm_guest_apic_has_interrupt(vcpu))) > + kvm_guest_apic_has_interrupt(vcpu) || > + (vcpu->arch.apicv_active && > + kvm_x86_ops.dy_apicv_has_pending_interrupt(vcpu)))) > return true; > > if (kvm_hv_has_stimer_pending(vcpu)) > Please remove "dy_" from the name of the callback, and use the static call. Also, if it makes sense, please consider using the same test as for patch 38 to choose *between* either kvm_cpu_has_interrupt() + kvm_guest_apic_has_interrupt() or kvm_x86_ops.dy_apicv_has_pending_interrupt(). Paolo
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index f1d5e0a53640..92d5a6649a21 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -11341,7 +11341,9 @@ static inline bool kvm_vcpu_has_events(struct kvm_vcpu *vcpu) if (kvm_arch_interrupt_allowed(vcpu) && (kvm_cpu_has_interrupt(vcpu) || - kvm_guest_apic_has_interrupt(vcpu))) + kvm_guest_apic_has_interrupt(vcpu) || + (vcpu->arch.apicv_active && + kvm_x86_ops.dy_apicv_has_pending_interrupt(vcpu)))) return true; if (kvm_hv_has_stimer_pending(vcpu))