[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen stable-4.9] VMX: fix vmx_handle_eoi()
commit fd6ab0e87edb2cbbd79f4915aebf0849969711f5 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Fri Feb 1 11:59:52 2019 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Fri Feb 1 11:59:52 2019 +0100 VMX: fix vmx_handle_eoi() In commit 303066fdb1e ("VMX: fix interaction of APIC-V and Viridian emulation") I screwed up: Instead of clearing SVI, other ISR bits should be taken into account. Introduce a new helper set_svi(), split out of vmx_process_isr(), and use it also from vmx_handle_eoi(). Following the problems in vmx_intr_assist() (see the still present big block of debugging code there) also warn (once) if EOI'd vector and original SVI don't match. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Chao Gao <chao.gao@xxxxxxxxx> Acked-by: Kevin Tian <kevin.tian@xxxxxxxxx> Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> master commit: 45cb9a4123b5550eb1f84846fe5482acae1c13a3 master date: 2018-11-02 12:15:33 +0100 --- xen/arch/x86/hvm/vlapic.c | 2 +- xen/arch/x86/hvm/vmx/vmx.c | 28 ++++++++++++++++++---------- xen/include/asm-x86/hvm/hvm.h | 2 +- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c index 350acbf21c..f5e23da2cc 100644 --- a/xen/arch/x86/hvm/vlapic.c +++ b/xen/arch/x86/hvm/vlapic.c @@ -415,7 +415,7 @@ void vlapic_EOI_set(struct vlapic *vlapic) vlapic_clear_vector(vector, &vlapic->regs->data[APIC_ISR]); if ( hvm_funcs.handle_eoi ) - hvm_funcs.handle_eoi(vector); + hvm_funcs.handle_eoi(vector, vlapic_find_highest_isr(vlapic)); vlapic_handle_EOI(vlapic, vector); } diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index bc8f566b9c..9f97f388c9 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -1999,17 +1999,14 @@ static int vmx_virtual_intr_delivery_enabled(void) return cpu_has_vmx_virtual_intr_delivery; } -static void vmx_process_isr(int isr, struct vcpu *v) +static u8 set_svi(int isr) { unsigned long status; u8 old; - unsigned int i; - const struct vlapic *vlapic = vcpu_vlapic(v); if ( isr < 0 ) isr = 0; - vmx_vmcs_enter(v); __vmread(GUEST_INTR_STATUS, &status); old = status >> VMX_GUEST_INTR_STATUS_SVI_OFFSET; if ( isr != old ) @@ -2019,6 +2016,18 @@ static void vmx_process_isr(int isr, struct vcpu *v) __vmwrite(GUEST_INTR_STATUS, status); } + return old; +} + +static void vmx_process_isr(int isr, struct vcpu *v) +{ + unsigned int i; + const struct vlapic *vlapic = vcpu_vlapic(v); + + vmx_vmcs_enter(v); + + set_svi(isr); + /* * Theoretically, only level triggered interrupts can have their * corresponding bits set in the eoi exit bitmap. That is, the bits @@ -2164,14 +2173,13 @@ static void vmx_sync_pir_to_irr(struct vcpu *v) vlapic_set_vector(i, &vlapic->regs->data[APIC_IRR]); } -static void vmx_handle_eoi(u8 vector) +static void vmx_handle_eoi(uint8_t vector, int isr) { - unsigned long status; + uint8_t old_svi = set_svi(isr); + static bool warned; - /* We need to clear the SVI field. */ - __vmread(GUEST_INTR_STATUS, &status); - status &= VMX_GUEST_INTR_STATUS_SUBFIELD_BITMASK; - __vmwrite(GUEST_INTR_STATUS, status); + if ( vector != old_svi && !test_and_set_bool(warned) ) + printk(XENLOG_WARNING "EOI for %02x but SVI=%02x\n", vector, old_svi); } static void vmx_enable_msr_interception(struct domain *d, uint32_t msr) diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h index 6a65fb414d..5c4ff900c3 100644 --- a/xen/include/asm-x86/hvm/hvm.h +++ b/xen/include/asm-x86/hvm/hvm.h @@ -195,7 +195,7 @@ struct hvm_function_table { void (*process_isr)(int isr, struct vcpu *v); void (*deliver_posted_intr)(struct vcpu *v, u8 vector); void (*sync_pir_to_irr)(struct vcpu *v); - void (*handle_eoi)(u8 vector); + void (*handle_eoi)(uint8_t vector, int isr); /*Walk nested p2m */ int (*nhvm_hap_walk_L1_p2m)(struct vcpu *v, paddr_t L2_gpa, -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.9 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |