[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.9] x86/vlapic: clear TMR bit upon acceptance of edge-triggered interrupt to IRR



commit 6f8eed4d934b53012c079cb2fca3866e56bf7d25
Author:     Liran Alon <liran.alon@xxxxxxxxxx>
AuthorDate: Tue Mar 20 14:35:02 2018 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Mar 20 14:35:02 2018 +0100

    x86/vlapic: clear TMR bit upon acceptance of edge-triggered interrupt to IRR
    
    According to Intel SDM section "Interrupt Acceptance for Fixed Interrupts":
    "The trigger mode register (TMR) indicates the trigger mode of the
    interrupt (see Figure 10-20). Upon acceptance of an interrupt
    into the IRR, the corresponding TMR bit is cleared for
    edge-triggered interrupts and set for level-triggered interrupts.
    If a TMR bit is set when an EOI cycle for its corresponding
    interrupt vector is generated, an EOI message is sent to
    all I/O APICs."
    
    Before this patch TMR-bit was cleared on LAPIC EOI which is not what
    real hardware does. This was also confirmed in KVM upstream commit
    a0c9a822bf37 ("KVM: dont clear TMR on EOI").
    
    Behavior after this patch is aligned with both Intel SDM and KVM
    implementation.
    
    Signed-off-by: Liran Alon <liran.alon@xxxxxxxxxx>
    Signed-off-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: 12a50030a81a14a3c7be672ddfde707b961479ec
    master date: 2018-03-15 16:59:52 +0100
---
 xen/arch/x86/hvm/vlapic.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index cf8ee50a97..aeb63d636d 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -149,6 +149,8 @@ void vlapic_set_irq(struct vlapic *vlapic, uint8_t vec, 
uint8_t trig)
 
     if ( trig )
         vlapic_set_vector(vec, &vlapic->regs->data[APIC_TMR]);
+    else
+        vlapic_clear_vector(vec, &vlapic->regs->data[APIC_TMR]);
 
     if ( hvm_funcs.update_eoi_exit_bitmap )
         hvm_funcs.update_eoi_exit_bitmap(target, vec, trig);
@@ -422,7 +424,7 @@ void vlapic_handle_EOI(struct vlapic *vlapic, u8 vector)
 {
     struct domain *d = vlapic_domain(vlapic);
 
-    if ( vlapic_test_and_clear_vector(vector, &vlapic->regs->data[APIC_TMR]) )
+    if ( vlapic_test_vector(vector, &vlapic->regs->data[APIC_TMR]) )
         vioapic_update_EOI(d, vector);
 
     hvm_dpci_msi_eoi(d, vector);
--
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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.