Skip to content
Snippets Groups Projects
  • Glauber Costa's avatar
    8a48cb55
    apic: fix allbutself delivery mode · 8a48cb55
    Glauber Costa authored
    
    Our APIC code is so wrong, but so wrong, that it even produce incorrect
    results.  X2APIC is fine, but XAPIC is using xapic::ipi() for all its
    interrupts. The problem with that, is that the costumary place for "vector" is
    inverted in the case of allbutself delivery mode, and therefore, we're sending
    these IPIs to God Knows Where - not to the processors, that is for sure.
    As a result, we would spin waiting for IRQ acks that would never arrive.
    
    I could invert and reorganize the parameters and comment this out, but I've
    decided it is a lot clearer just to open code it. Also, there is no need at all
    to set ICR2 for allbutself, because the destination is already embedded in the
    firing mode.
    
    One issue: NMI is copied over because it is also wrong by the same reasons, so
    I fixed. But I don't have a test case for this.
    
    Fixes #110
    
    Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
    8a48cb55
    History
    apic: fix allbutself delivery mode
    Glauber Costa authored
    
    Our APIC code is so wrong, but so wrong, that it even produce incorrect
    results.  X2APIC is fine, but XAPIC is using xapic::ipi() for all its
    interrupts. The problem with that, is that the costumary place for "vector" is
    inverted in the case of allbutself delivery mode, and therefore, we're sending
    these IPIs to God Knows Where - not to the processors, that is for sure.
    As a result, we would spin waiting for IRQ acks that would never arrive.
    
    I could invert and reorganize the parameters and comment this out, but I've
    decided it is a lot clearer just to open code it. Also, there is no need at all
    to set ICR2 for allbutself, because the destination is already embedded in the
    firing mode.
    
    One issue: NMI is copied over because it is also wrong by the same reasons, so
    I fixed. But I don't have a test case for this.
    
    Fixes #110
    
    Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>