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

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



commit bc6414f735e3daecca30ce4358a59e6a56dc70a4
Author:     Liran Alon <liran.alon@xxxxxxxxxx>
AuthorDate: Tue Mar 20 14:41:13 2018 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Mar 20 14:41:13 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 1d5d287950..5e3423e035 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -161,6 +161,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);
@@ -434,7 +436,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.8

_______________________________________________
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®.