From patchwork Fri Oct 13 10:40:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 10004079 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 76E9C60360 for ; Fri, 13 Oct 2017 10:42:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68BFD29023 for ; Fri, 13 Oct 2017 10:42:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C5D329026; Fri, 13 Oct 2017 10:42:41 +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 D024C29023 for ; Fri, 13 Oct 2017 10:42:40 +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 1e2xOT-0000XK-7d; Fri, 13 Oct 2017 10:40:41 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2xOR-0000W3-Nl for xen-devel@lists.xenproject.org; Fri, 13 Oct 2017 10:40:40 +0000 Received: from [193.109.254.147] by server-6.bemta-6.messagelabs.com id 89/57-08608-72890E95; Fri, 13 Oct 2017 10:40:39 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRWlGSWpSXmKPExsVyMfTAel21GQ8 iDQ41ilh83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBknJ+5jKjgnWDGl+w1zA+N83i5GLg4hgRmM Eg1bLjKBOCwC7cwSLeeXMoI4EgLvWCS6f+xj7WLkBHLyJOb0z2eHsNMkXi74DxWvkni5bC1YX EhAS+LoqdmsEGO3M0l8OLEQyOHgYBMwkZjVIQFSIyKgJHFv1WQmEJtZoF5i27lfjCC2sEC4xP Yba8DiLAKqEu+PvACzeQW8JL6s6WWE2CUncfNcJ/MERv4FjAyrGDWKU4vKUot0jQz0kooy0zN KchMzc3QNDcz0clOLixPTU3MSk4r1kvNzNzECQ4gBCHYw/loWcIhRkoNJSZRXLfJBpBBfUn5K ZUZicUZ8UWlOavEhRhkODiUJXtvpQDnBotT01Iq0zBxgMMOkJTh4lER4t08DSvMWFyTmFmemQ 6ROMdpzXLhz6Q8Tx4E9t4Dkiuu3gWTHzbt/mIRY8vLzUqXEeQ+BtAmAtGWU5sENhUXfJUZZKW FeRqAzhXgKUotyM0tQ5V8xinMwKgnzuoLcxpOZVwK3+xXQWUxAZ72LADurJBEhJdXAaLq30XJ FTt3aqZ9YLvht78n+LvJp+5vElLZ61d07TNLvrrc38TrIo29Xzf8gO9PQYhpv4jLeDFmOUCff W0LanldF/iQd/zzPaZfjY4Ec/tBlvxSLlKcuPiLnljPV9t+qdpuWTRcqjwipT0neIOOp/k9cw e7CvTbB399WrTKpYtjaudZs3elVSizFGYmGWsxFxYkAz9+2R7kCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-4.tower-27.messagelabs.com!1507891237!110719004!1 X-Originating-IP: [209.85.192.175] 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 49903 invoked from network); 13 Oct 2017 10:40:38 -0000 Received: from mail-pf0-f175.google.com (HELO mail-pf0-f175.google.com) (209.85.192.175) by server-4.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 13 Oct 2017 10:40:38 -0000 Received: by mail-pf0-f175.google.com with SMTP id e64so9587667pfk.9 for ; Fri, 13 Oct 2017 03:40:38 -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; bh=smGlmTXwMpfxvse0CQmvhBzxdLmbQY/jOD0Htgo2m+c=; b=Z2jYTGUzcgqxlwyjYlVa+frtvc11D5qc5yGeWe9GvmW8VeXLYF6tWHUKdOQp7AWuGz UkMD9DwkWjpohlToIxzdTxO+YwmpoccEtxkV9P1P20J4yV8O8BNCH28Q1VA4ulgyiNn8 4d9TJWkzt768HnHayFOnPtJ5KkGJL2taGaniE= 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; bh=smGlmTXwMpfxvse0CQmvhBzxdLmbQY/jOD0Htgo2m+c=; b=pFa0tTaFMeSaTI+i2ipSdiXaAc/VVH8/hGQF2qvI0Y4yuIQOt8YVjwUNwH02SJ7FIy Rjz4j9dQYkZR1ky8aK/OrNyu8O5bc1V/R0l6pTTj37x62MW6kXuPHda5eeIskUMUgRJR HrkrHk65vczZ2jalN0lUWq3kLPN5DTSUE/6hxvVMWXoWejL7Z+A2vJo4MRl/MI+exjW1 jA4WDtqaKWUmnbxhuBUe/raZMW/pDEORycATmxViyx4BK11vNmnupLbWKHInps9l/h3e pKDjV3q0kkaqOuEdSRb0+uY2UQ6O9SIH3AtSlNbvcTY8s2Bhtb4ZBZ9wpu3rPjkg75Zm 2n4w== X-Gm-Message-State: AMCzsaVHrYAImwSDyhAYaNC9hoDCmEMdCS8Z0GmDNwkk4hWnrjP2HSeI IClySynIes2xC0aHNFkH62UdnJND9Ow= X-Google-Smtp-Source: AOwi7QDsEsIFADlsl1+JH7AcqwEQ11V8Z5bh/UJG99GwgwO3EAa30C3OgqmF8WTtYOhchrv4A0OWpA== X-Received: by 10.84.173.228 with SMTP id p91mr1042332plb.264.1507891236732; Fri, 13 Oct 2017 03:40:36 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id a7sm1626682pgt.39.2017.10.13.03.40.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Oct 2017 03:40:36 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 13 Oct 2017 16:10:30 +0530 Message-Id: <1507891231-4386-1-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: Andre Przywara , Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 26/27 v12] arm/xen: 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 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 | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c index f7ddccb..0b07436 100644 --- a/xen/arch/arm/vpl011.c +++ b/xen/arch/arm/vpl011.c @@ -159,9 +159,15 @@ static void vpl011_write_data(struct domain *d, uint8_t data) { vpl011->uartfr |= TXFF; vpl011->uartris &= ~TXI; - } - 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; @@ -371,11 +377,16 @@ static void vpl011_data_avail(struct domain *d) { vpl011->uartfr &= ~TXFF; vpl011->uartris |= TXI; + + /* + * Clear the BUSY bit as soon as space becomes available + * so that the SBSA UART driver can start writing more data + * without any further delay. + */ + vpl011->uartfr &= ~BUSY; + if ( out_ring_qsize == 0 ) - { - vpl011->uartfr &= ~BUSY; vpl011->uartfr |= TXFE; - } } vpl011_update_interrupt_status(d);