From patchwork Mon Aug 28 08:56:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 9924879 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 53A6360311 for ; Mon, 28 Aug 2017 08:59:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 452F728531 for ; Mon, 28 Aug 2017 08:59:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A19628682; Mon, 28 Aug 2017 08:59:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D1D1528531 for ; Mon, 28 Aug 2017 08:59:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmFrj-0006Ax-0q; Mon, 28 Aug 2017 08:57:51 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmFrh-00068V-Pi for xen-devel@lists.xenproject.org; Mon, 28 Aug 2017 08:57:49 +0000 Received: from [85.158.137.68] by server-14.bemta-3.messagelabs.com id 25/57-01862-D0BD3A95; Mon, 28 Aug 2017 08:57:49 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRWlGSWpSXmKPExsXiVRuspctze3G kQdM+JYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNePSxhOMBfeFK+Y9v83UwHiTr4uRi0NIYDqj RP+JpUwgDovAPGaJ+5/3M4M4EgL9rBL/rp5m62LkBHLSJOYemMQIYZdJXHg8gQXEFhLQkjh6a jYrxKj9TBJT2o8DdXNwsAmYSMzqkACpERFQkri3ajITiM0sUC+x7dwvsDnCAmESN+59YAexWQ RUJa6v+gI2k1fAR+LE9YWsELvkJG6e62QGsTmB4jvW3mWH2Ost0fX6A+sERoEFjAyrGDWKU4v KUot0jSz0kooy0zNKchMzc3QNDYz1clOLixPTU3MSk4r1kvNzNzECQ6uegYFxB2P7Cb9DjJIc TEqivDsrFkcK8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuA9cxMoJ1iUmp5akZaZAwxymLQEB4+SC O8HkDRvcUFibnFmOkTqFKMxx6QD278wcXx5sfkXkxBLXn5eqpQ4rw9IqQBIaUZpHtwgWPRdYp SVEuZlZGBgEOIpSC3KzSxBlX/FKM7BqCTM+xdkCk9mXgncvldApzABnaIouBDklJJEhJRUA6P m6qWs/U72cnr/m1u840psvZaqT/J//fFestqsO3tMmedWah0L+By3Xqz1Xemhv21Kv1ancy2e 9nBu5LTVRaIfs1mXJlxQE92iYnf5S0ji+686+6ZZG+lP45dJyXr0Ne2svn3kxFXSZXXCGYoNL S/SNt1+s/TkjKKSwwzvlCcuzUuQFUn+2avEUpyRaKjFXFScCADA0p6vuQIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-12.tower-31.messagelabs.com!1503910667!95097134!1 X-Originating-IP: [74.125.83.42] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10492 invoked from network); 28 Aug 2017 08:57:48 -0000 Received: from mail-pg0-f42.google.com (HELO mail-pg0-f42.google.com) (74.125.83.42) by server-12.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 28 Aug 2017 08:57:48 -0000 Received: by mail-pg0-f42.google.com with SMTP id 83so22182596pgb.4 for ; Mon, 28 Aug 2017 01:57:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=p2H/mstPPQb8H1R6aw7jrvNqtjUuRaSxOfyW5yP0N/A=; b=ATXLxXnsJURpjc9I+8mljWvuy45KPjAEjkoCFJEfwFmzNaNafSKbYD3v0aUi6jcqsQ 2mk9xEfd4ne+GESBUTLTu8+hvrSE4ptjhye7SSQCZPWNYzQtE+o1Ejcmm+oUpA67TKNL P6T4EOr/7L1QRiibxPGhD816kLcbCI9lbDTQU= 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:in-reply-to :references; bh=p2H/mstPPQb8H1R6aw7jrvNqtjUuRaSxOfyW5yP0N/A=; b=dyjIesD0Gx0Hu6QfsFSX4CdfIppi3Lic3V+JhVclf9+tVqBO/iZ4IZQTAbv0Oq/oT2 p8r/VNiCljLS/gWieMzKPPil7RrUlssG+861yO6P2YVQbEbaYb5rpBB+8749tNkWloBk AvHdvKxOAgP7pERpzY9zP/BM7aTQtQP/x5flhIq4lZ0u/DdSl++h8EyCNfhxH7RCM7gz uRI/EjFhDb2ptQYUJDCl7d7xwhFgGXrUHhFeJpJQsfoUqECMgR+NvpboC/+ttUtv2h2Q c3Vde4b6xBzu0TH2Z6lMlbPGhICUYIf53oWBk/qRHbBT/wj69z0v5xlO+cCctI8X6E0d vGSw== X-Gm-Message-State: AHYfb5jgkU8xApsm9p00OR19kqgbBSoXa29FsMyZ99IvMCpQWEx6CWnK NH2al86+OvXxVSBQFthZIA== X-Received: by 10.99.50.4 with SMTP id y4mr6910200pgy.238.1503910666582; Mon, 28 Aug 2017 01:57:46 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id d88sm21713569pfl.158.2017.08.28.01.57.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Aug 2017 01:57:45 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 28 Aug 2017 14:26:10 +0530 Message-Id: <1503910570-24427-28-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503910570-24427-1-git-send-email-bhupinder.thakur@linaro.org> References: <1503910570-24427-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Andre Przywara , Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 27/27 v8] xen/arm: vpl011: Fix the slow early console SBSA UART output X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The early console output uses pl011_early_write() to write data. This function waits for BUSY bit to get cleared before writing the next byte. In the SBSA UART emulation logic, the BUSY bit was set as soon a one byte was written in the FIFO and it remained set until the FIFO was emptied. This meant that the output was delayed as each character needed the BUSY to get cleared. Since the SBSA UART is getting emulated in Xen using ring buffers, it ensures that once the data is enqueued in the FIFO, it will be received by xenconsole so it is safe to set the BUSY bit only when FIFO becomes full. This will ensure that pl011_early_write() is not delayed unduly to write the data. Signed-off-by: Bhupinder Thakur --- CC: Julien Grall CC: Andre Przywara CC: Stefano Stabellini xen/arch/arm/vpl011.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c index 1e72fca..375581d 100644 --- a/xen/arch/arm/vpl011.c +++ b/xen/arch/arm/vpl011.c @@ -165,9 +165,17 @@ static void vpl011_write_data(struct domain *d, uint8_t data) sizeof (intf->out) ) vpl011->uartris &= ~TXI; else + { vpl011->uartfr |= TXFF; - vpl011->uartfr |= BUSY; + /* + * This bit is set only when FIFO becomes full. This ensures that + * the SBSA UART driver can write the early console data as fast as + * possible, without waiting for the BUSY bit to get cleared before + * writing each byte. + */ + vpl011->uartfr |= BUSY; + } vpl011->uartfr &= ~TXFE; @@ -378,6 +386,13 @@ static void vpl011_data_avail(struct domain *d) vpl011->uartfr &= ~TXFF; /* + * Clear the BUSY bit as soon as space becomes avaliable + * so that the SBSA UART driver can start writing more data + * without any further delay. + */ + vpl011->uartfr &= ~BUSY; + + /* * Ensure that there is space for atleast 16 bytes before asserting the * TXI interrupt status bit because the SBSA UART driver may write upto * 16 bytes (i.e. half the SBSA UART fifo size of 32) on getting @@ -388,7 +403,6 @@ static void vpl011_data_avail(struct domain *d) if ( out_ring_qsize == 0 ) { - vpl011->uartfr &= ~BUSY; vpl011->uartfr |= TXFE; } }