From patchwork Fri Jul 19 13:35:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Martin X-Patchwork-Id: 169252 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp3874010ilk; Fri, 19 Jul 2019 06:36:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqxbVCjEguKBFuEJrSQuvcjr76opb+EWdCNCWfjDJDylp3xKjjhJviuF9183pbzlUdnTO+qO X-Received: by 2002:a17:90a:80c4:: with SMTP id k4mr58589604pjw.74.1563543385061; Fri, 19 Jul 2019 06:36:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563543385; cv=none; d=google.com; s=arc-20160816; b=AcE/0CmHVBrPoSlX74uonqoJgd1GQ1tZ4oFDXuEQdMM33M5W6KUUcsuwAdwvZOUF5t qIIO0E1NB10l8gbkbZqHHXbTrWbyoI56enWoaNuxLKkVou8RY9sWDG6JtO/2Am28itLT 7sFwNG0y1n8Cz6/2dFlJQfpNP1k6sKYsKRHQd9Ae1jl6KkqedlJDVCW2a7sEzYm3Jz0S lcbaJKl7cmcLnW80cHoOH6B/gzH6eySa+WDxPLSX+8AL6eo2dbF3qxk4C4Xa9pAYznL5 mW8rzujbQnSw2IXOT1ITp0P5lvHVwpuBYdC4GUXxBZwfxyTXrbcGUdxGB6pD7/i/5RH6 aBsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=TJk1L971VybrFq6TbR869lC19j+d8ZGEPtKJvHMEZaA=; b=d75+qKWt+sXQ25BCBVce59wsBqUVq9ug44acXY5amdR95yCWNi9gCWFhKeivaAHLxk eC5YAoQTjHLvoxJpI89hQj4krD1Ik0HJ0FErTfNj5J9spAHQtbx09tQHp1aw2rTL9BTp dAUcTSSDvPA1h+peyaOXKG97n16bzF3PtbC9zIHUkaS7eBEbRVuBPP4sIsGLH2oRhnsu yuNJv7uZDMyU0WaBGm2U5rZCDEAJ/WvYb1hoRxhB1/zcve8Sh9Aek9b0CbCfsUEbUASs oN12KSG6JGrkeI2QwgTpQbRaXsbELcB39d80ltjxJmqNuuRhQ5ecSXXi8FMizNV4/CtK NYZw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r14si2278696pgi.513.2019.07.19.06.36.24; Fri, 19 Jul 2019 06:36:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728016AbfGSNgY (ORCPT + 1 other); Fri, 19 Jul 2019 09:36:24 -0400 Received: from foss.arm.com ([217.140.110.172]:43522 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727888AbfGSNgY (ORCPT ); Fri, 19 Jul 2019 09:36:24 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8BC3D1509; Fri, 19 Jul 2019 06:36:23 -0700 (PDT) Received: from e103592.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 642693F71A; Fri, 19 Jul 2019 06:36:22 -0700 (PDT) From: Dave Martin To: linux-serial@vger.kernel.org Cc: Russell King , Phil Elwell , Rogier Wolff , linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , Jiri Slaby , linux-rpi-kernel@lists.infradead.org Subject: [RFC PATCH 2/2] serial: pl011: Don't bother pushing more TX data while TX irq is active Date: Fri, 19 Jul 2019 14:35:25 +0100 Message-Id: <1563543325-12463-3-git-send-email-Dave.Martin@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1563543325-12463-1-git-send-email-Dave.Martin@arm.com> References: <1563543325-12463-1-git-send-email-Dave.Martin@arm.com> Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org When the TX irq is active, writing chars to the TX FIFO from anywhere except pl011_int() is pointless: the UART is already busy, and new chars will be picked up by pl011_int() as soon as there is FIFO space. To reduce the scope for surprises, bail out of pl011_start_tx_pio() without attempting to write to the FIFO or start TX DMA if the TX FIFO interrupt is already in use. This should also avoid pointless overhead in some situations. Signed-off-by: Dave Martin --- Please test both with and without this patch. I believe with the previous patch in place, this patch is not strictly necessary. However, if the UART is actively transmitting in the background already, it does make sense not to waste time trying polling the FIFO fill status or setting up DMA etc. --- drivers/tty/serial/amba-pl011.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.1.4 diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index e24bbc0..f28935a 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c @@ -1318,6 +1318,10 @@ static void pl011_start_tx(struct uart_port *port) struct uart_amba_port *uap = container_of(port, struct uart_amba_port, port); + /* It's pointless to kick the UART if it's already transmitting... */ + if (uap->im & UART011_TXIM) + return; + if (!pl011_dma_tx_start(uap)) pl011_start_tx_pio(uap); }