From 8e296155d589893eb7e4cfb7fa77484a99edee17 Mon Sep 17 00:00:00 2001 From: Yu Wang Date: Thu, 6 Sep 2018 03:06:42 +0000 Subject: [PATCH] hv: apicv: enable interrupt-window if any pending external interrupts The external interrupt events only can be inject if RFLAGS.IF = 1 and no blocking by both STI and MOV SS. If met this scenario, we need to enable "interrupt-window exiting" for injection in next VMEXIT. Tracked-On: #1189 Signed-off-by: Yu Wang Acked-by: Anthony Xu --- hypervisor/arch/x86/virq.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/hypervisor/arch/x86/virq.c b/hypervisor/arch/x86/virq.c index 5ea05f3f0..e50323c49 100644 --- a/hypervisor/arch/x86/virq.c +++ b/hypervisor/arch/x86/virq.c @@ -495,9 +495,18 @@ INTR_WIN: * and automatic inject the virtual interrupts in appropriate time. * And from SDM Vol3 29.2.1, the apicv only trigger evaluation of * pending virtual interrupts when "interrupt-window exiting" is 0. + * + * External interrupt(from vpic) can't be delivered by "virtual- + * interrupt delivery", it only deliver interrupt from vlapic. + * + * So need to enable "interrupt-window exiting", when there is + * an ExtInt or there is lapic interrupt and virtual interrupt + * deliver is disabled. */ - if (is_apicv_intr_delivery_supported() || - !vcpu_pending_request(vcpu)) { + if (!bitmap_test(ACRN_REQUEST_EXTINT, + pending_req_bits) && + (is_apicv_intr_delivery_supported() || + !vcpu_pending_request(vcpu))) { return ret; }