]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
serial: qcom-geni: disable interrupts during console writes
authorJohan Hovold <johan+linaro@kernel.org>
Fri, 6 Sep 2024 13:13:35 +0000 (15:13 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 11 Sep 2024 13:44:45 +0000 (15:44 +0200)
Disable the GENI interrupts during console writes to reduce the risk of
having interrupt handlers spinning on the port lock on other cores for
extended periods of time.

This can, for example, reduce the total amount of time spent in the
interrupt handler during boot of the x1e80100 CRD by up to a factor nine
(e.g. from 274 ms to 30 ms) while the worst case processing time drops
from 19 ms to 8 ms.

Fixes: c4f528795d1a ("tty: serial: msm_geni_serial: Add serial driver support for GENI based QUP")
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Tested-by: NĂ­colas F. R. A. Prado <nfraprado@collabora.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20240906131336.23625-8-johan+linaro@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/qcom_geni_serial.c

index f8f6e9466b400d708091f9081d19fb37a0ef9f56..f23fd0ac3cfd07e5bff3eabf9986bf64c34e7f67 100644 (file)
@@ -477,6 +477,7 @@ static void qcom_geni_serial_console_write(struct console *co, const char *s,
 {
        struct uart_port *uport;
        struct qcom_geni_serial_port *port;
+       u32 m_irq_en, s_irq_en;
        bool locked = true;
        unsigned long flags;
 
@@ -492,6 +493,11 @@ static void qcom_geni_serial_console_write(struct console *co, const char *s,
        else
                uart_port_lock_irqsave(uport, &flags);
 
+       m_irq_en = readl(uport->membase + SE_GENI_M_IRQ_EN);
+       s_irq_en = readl(uport->membase + SE_GENI_S_IRQ_EN);
+       writel(0, uport->membase + SE_GENI_M_IRQ_EN);
+       writel(0, uport->membase + SE_GENI_S_IRQ_EN);
+
        if (qcom_geni_serial_main_active(uport)) {
                /* Wait for completion or drain FIFO */
                if (!locked || port->tx_remaining == 0)
@@ -504,6 +510,9 @@ static void qcom_geni_serial_console_write(struct console *co, const char *s,
 
        __qcom_geni_serial_console_write(uport, s, count);
 
+       writel(m_irq_en, uport->membase + SE_GENI_M_IRQ_EN);
+       writel(s_irq_en, uport->membase + SE_GENI_S_IRQ_EN);
+
        if (locked)
                uart_port_unlock_irqrestore(uport, flags);
 }