• J
    serial: amba-pl011: use port lock to guard control register access · fe433907
    Jon Medhurst 提交于
    When the pl011 is being used for a console, pl011_console_write forces
    the control register (CR) to enable the UART for transmission and then
    restores this to the original value afterwards. It does this while
    holding the port lock.
    
    Unfortunately, when the uart is started or shutdown - say in response to
    userland using the serial device for a terminal - then this updates the
    control register without any locking.
    
    This means we can have
    
      pl011_console_write   Save CR
      pl011_startup         Initialise CR, e.g. enable receive
      pl011_console_write   Restore old CR with receive not enabled
    
    this result is a serial port which doesn't respond to any input.
    
    A similar race in reverse could happen when the device is shutdown.
    
    We can fix these problems by taking the port lock when updating CR.
    Signed-off-by: NJon Medhurst <tixy@linaro.org>
    Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    fe433907
amba-pl011.c 57.4 KB