• Thomas Gleixner's avatar
    kvm tool: serial: Fix interrupt handling · f6b8ccc1
    Thomas Gleixner authored
    The interrupt injection of the serial emulation is completely
    broken. It's just doing random toggling of the interrupt line, which
    can lead to complete console hangs.
    The real hardware asserts the interrupt line when a condition
    (RX/TX/Status) is met and the corresponding interrupt is enabled in
    the IER. It's deasserted when the condition is cleared or the
    corresponding interrupt is disabled in the IER.
    So the correct emulation just needs to check after each state change
    in the LSR or the IER which bits in the IIR need to be set and update
    the interrupt line accordingly. To avoid setting the same state over
    and over keep an internal state of the last set interrupt line state
    and only update via the kvm ioctl when the new state differs.
    Rename serial8250__inject_interrupts() to serial8250__update_consoles()
    which reflects what the function really is about.
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>