Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1284714imu; Tue, 11 Dec 2018 16:37:36 -0800 (PST) X-Google-Smtp-Source: AFSGD/W1+vzbB0faw9657jN5l4B2E/0duhLPf3SGNeQ6kQfJVwShHv7LLCSFO/upBzEtBD3YvuY9 X-Received: by 2002:a63:5455:: with SMTP id e21mr16642378pgm.316.1544575056806; Tue, 11 Dec 2018 16:37:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544575056; cv=none; d=google.com; s=arc-20160816; b=iZ9qXTiblALSEWw3bNmTmD+15O43CUwANUfPUJ8zjWZZ7wJjSmFQQx24LAA7eB7NdT BzGNQrBTw//pX2p57qrD+tkP8XlawbTfcbKShwM7hl//iYn0YHRZ184+HBlwHAja8iao gY384gGOzxjWZ4Drj+dhiZhokQk/wKNrj6pY2KaSPRayMX0CA0VxGVC+lpn95lOJy/D7 B45LvML89w7X06F34X4IUMDXxiW+uDBxmBh+q0jT3LSkqCAdVBAqByIhp5ANi6OS7Rvk v7jtrHuuOHQkgPsop5zUQHCPaffm53JFCYCoBaKZ+9nuwUkERtIJLl2SL4+YvznOVVs5 iXRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=iZPNaA/sxvH+FGg3+rFTxwpoUlQPq3KwKBn9OFCKHN8=; b=ZRF4DRKvsJcbLSSHpqBnfu69dhpnqxYp7LEN2rIya+Hd6MDDP5krlUr3Rhh9CFMjwA e5TE4iCityp/4r/bd4pHu/U9Edx7bHTzzkJRS3WT92dnnYGepWzP47JsPirGn4XW5+Ot MBj5DGYC/9PDXUJkVEfmQDNk+F7z/OmseM2389woHcluhfuabIELU5kx40LTco0SeswS HpJIXh39NorN6adqzAitL5BzmlCDPuzpkIV5OPABsDz2aPpUWWBnsIT2LaioQjSVDPwv 2CIHapZKJBiKNx8N+I4Fo68IRPI7vCi5Kbv7NdKF2VecrclD3lQKQHjD4QPPyeQ1MufC OTyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=V8hpKSO1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 7si16179948pfb.226.2018.12.11.16.37.21; Tue, 11 Dec 2018 16:37:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=V8hpKSO1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726249AbeLLAgZ (ORCPT + 99 others); Tue, 11 Dec 2018 19:36:25 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:44532 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726218AbeLLAgY (ORCPT ); Tue, 11 Dec 2018 19:36:24 -0500 Received: by mail-pf1-f194.google.com with SMTP id u6so7946092pfh.11 for ; Tue, 11 Dec 2018 16:36:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=iZPNaA/sxvH+FGg3+rFTxwpoUlQPq3KwKBn9OFCKHN8=; b=V8hpKSO1qgKzDb9RwJtyduZPKO0/RrFh6xHpQRaaxZRu0MURvCDTH51HP5pBtxdaop uVcnL2+gcj3KhI3Nrm0w8HnROPanLef9wMuWNkBsnZ5PXFMkeBsNoc4DtmYY645K4a24 VxE7hKYgSbHbvPehT6twmA7Mnt7llb9mgzDzY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=iZPNaA/sxvH+FGg3+rFTxwpoUlQPq3KwKBn9OFCKHN8=; b=VxcsCGVGC/C+iFX4UlxJ2oJvO2fZuWFvRfDKdsqq2aht8e+Q12nLruomMxViHO0Y7J pCFrUBMNJ8dqsYl+3Q+AmV3RfMREJ1ZlcEtyF3S9AJnXj5WyAA/DAWmJISOY56lqpKh8 11qxLx/OGfkQwJFEz5I7ukxcgKZw+Ja1TlEkop87b/Bkfxxlc0GTnUDA4UAvR52uYUx8 s0tr9u9nU5uU1u1HvNF+Df/bpOldn/HxvTBPBLJ4wIy2Znt76DfFz02hY8jH1ytWoqZr JjVBekrckiiSkX7zBfHVtGCJCfDTFzHCl8LzOO9Dex1rdAD0RkacOVsciMdFRTlGaWro rGCw== X-Gm-Message-State: AA+aEWYFZSZLBqg6hCxvCF8/ePnRR8+o4Ip4NfCbHjkHF4csznMoYhOg 8VY8djxBQJ1EIVL9STKGHYRyeQ== X-Received: by 2002:a62:2c4d:: with SMTP id s74mr18095121pfs.6.1544574983415; Tue, 11 Dec 2018 16:36:23 -0800 (PST) Received: from ryandcase.mtv.corp.google.com ([2620:15c:202:201:ed1c:3d1c:9d92:99cb]) by smtp.gmail.com with ESMTPSA id 7sm55580924pfm.8.2018.12.11.16.36.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Dec 2018 16:36:22 -0800 (PST) From: Ryan Case To: Greg Kroah-Hartman , Jiri Slaby Cc: Doug Anderson , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Stephen Boyd , Ryan Case Subject: [PATCH] tty: serial: qcom_geni_serial: Remove interrupt storm Date: Tue, 11 Dec 2018 16:35:22 -0800 Message-Id: <20181212003522.239189-1-ryandcase@chromium.org> X-Mailer: git-send-email 2.20.0.rc2.403.gdbc3b29805-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Disable M_TX_FIFO_WATERMARK_EN after we've sent all data for a given transaction so we don't continue to receive a flurry of free space interrupts while waiting for the M_CMD_DONE notification. Re-enable the watermark when establishing the next transaction. Also clear the watermark interrupt after filling the FIFO so we do not receive notification again prior to actually having free space. Signed-off-by: Ryan Case --- drivers/tty/serial/qcom_geni_serial.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c index 6e38498362ef..965aefa54114 100644 --- a/drivers/tty/serial/qcom_geni_serial.c +++ b/drivers/tty/serial/qcom_geni_serial.c @@ -724,10 +724,12 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, size_t pending; int i; u32 status; + u32 irq_en; unsigned int chunk; int tail; status = readl_relaxed(uport->membase + SE_GENI_TX_FIFO_STATUS); + irq_en = readl_relaxed(uport->membase + SE_GENI_M_IRQ_EN); /* Complete the current tx command before taking newly added data */ if (active) @@ -752,6 +754,9 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, if (!port->tx_remaining) { qcom_geni_serial_setup_tx(uport, pending); port->tx_remaining = pending; + + irq_en |= M_TX_FIFO_WATERMARK_EN; + writel_relaxed(irq_en, uport->membase + SE_GENI_M_IRQ_EN); } remaining = chunk; @@ -775,7 +780,15 @@ static void qcom_geni_serial_handle_tx(struct uart_port *uport, bool done, } xmit->tail = tail & (UART_XMIT_SIZE - 1); + writel_relaxed(M_TX_FIFO_WATERMARK_EN, + uport->membase + SE_GENI_M_IRQ_CLEAR); + out_write_wakeup: + if (!port->tx_remaining) { + irq_en &= ~M_TX_FIFO_WATERMARK_EN; + writel_relaxed(irq_en, uport->membase + SE_GENI_M_IRQ_EN); + } + if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS) uart_write_wakeup(uport); } @@ -811,8 +824,7 @@ static irqreturn_t qcom_geni_serial_isr(int isr, void *dev) tty_insert_flip_char(tport, 0, TTY_OVERRUN); } - if (m_irq_status & (M_TX_FIFO_WATERMARK_EN | M_CMD_DONE_EN) && - m_irq_en & (M_TX_FIFO_WATERMARK_EN | M_CMD_DONE_EN)) + if (m_irq_status & m_irq_en & (M_TX_FIFO_WATERMARK_EN | M_CMD_DONE_EN)) qcom_geni_serial_handle_tx(uport, m_irq_status & M_CMD_DONE_EN, geni_status & M_GENI_CMD_ACTIVE); -- 2.20.0.rc2.403.gdbc3b29805-goog