From patchwork Mon Sep 18 10:32: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: 9956385 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 9CA8860208 for ; Mon, 18 Sep 2017 10:35:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B32028C09 for ; Mon, 18 Sep 2017 10:35:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E99628C24; Mon, 18 Sep 2017 10:35: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 26A2F28C09 for ; Mon, 18 Sep 2017 10:35:32 +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 1dttN3-00038l-Dv; Mon, 18 Sep 2017 10:33:45 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttN2-000350-28 for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:44 +0000 Received: from [85.158.143.35] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-2.bemta-6.messagelabs.com id 57/44-26922-601AFB95; Mon, 18 Sep 2017 10:33:42 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOIsWRWlGSWpSXmKPExsXiVRusqcu6cH+ kQfcMQYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNePArT+MBecEK95/f8jUwDift4uRi0NIYAqj ROeljcwgDovAPGaJ893XWUAcCYF+Vol1N2eydzFyAjlpEs9PHWGDsbufnGCEsCslPv64BGYLC WhJHD01mxVi7A4miVcT5jB1MXJwsAmYSMzqkACpERFQkri3ajITiM0sUC+x7dwvsF5hgTCJ5z 1zweazCKhKbPu1kgWklVfAR2L5tkSIVXISN891MoPYnEDh8+sfsEKs9ZaY9+sK4wRGwQWMDKs YNYpTi8pSi3SNTPSSijLTM0pyEzNzdA0NzPRyU4uLE9NTcxKTivWS83M3MQIDjgEIdjDu+xh5 iFGSg0lJlFc0cn+kEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQned/OBcoJFqempFWmZOcDQh0lLc PAoifCuA0nzFhck5hZnpkOkTjFacuzbc+sPE8eK67eBZMfNu3+YhFjy8vNSpcQh5gmANGSU5s GNg8XnJUZZKWFeRqADhXgKUotyM0tQ5V8xinMwKgnzPgKZwpOZVwK39RXQQUxAB7Xs2ANyUEk iQkqqgbE/yKjYws/wkGNYYdH35R9K5RzjJ/2Z+yp+/8xH2R5uixZcfDHfM2i1aMwdp/1PWH26 pPYmlJjtWJgSI9Xmn/ki3lzWRkNvjwP36/0W0V//NApXOumc5Ezm9yqzPbLu3NyCz18XbbNvq z3MtmLrthV5xllOe6b9ThE6uDYp27L9SnDCnbkON5VYijMSDbWYi4oTAUSw2sHKAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-15.tower-21.messagelabs.com!1505730819!83206468!1 X-Originating-IP: [74.125.83.41] 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 20690 invoked from network); 18 Sep 2017 10:33:41 -0000 Received: from mail-pg0-f41.google.com (HELO mail-pg0-f41.google.com) (74.125.83.41) by server-15.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:33:41 -0000 Received: by mail-pg0-f41.google.com with SMTP id p5so30288pgn.7 for ; Mon, 18 Sep 2017 03:33:41 -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=2cGA9GWQ2dcLrzuB4im3ko3qiqx5AgeGA+TPbfZsVTY=; b=c9PJe2bGhZemRrbrY+9tkkpqmynCXz8I4lHy+UIZcjljOJhLuUbMIsUlaAIU6Apfk8 cu3Uu5GVI4c8uYX7vzz3eOC3L5GMZ8f1YIAuYC1q21t9/WZa8DIfxyicfT4Mcvx30fCY D09IHobCHflTCh5z/MphrPJPBUVbFZBf4eSAI= 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=2cGA9GWQ2dcLrzuB4im3ko3qiqx5AgeGA+TPbfZsVTY=; b=KYGZ62Da82tto/fd5SBTM9mu/cGC68wlcvMQw4qZhUYI5KzlYIHWAJFySXmTje5k8M n2kf/RHJmlSfB4D8CUHlTcTURKiiYCHqNF7qLZZGyDpHB4YvC911NyMUjf6y+Yj44flN z2Ob9fGOVdWhk9joO3MPvo6KAfIu12Sv43gVqs2So0yTJ/zVVTMCkzOipB/IUO4NR5kj RWSreQh7DtgXlkoBgwzna1xFBQMNKuKpLE585hk95vLUTDFxhNk7CbW67UDv7EX2AGMe ZME5tIJtay6aZ6jTV5meiu7YAgFsFNuGFyKGjgnCLhgYp6peNCFUuZUmWEqF0m/7c0q3 LjTQ== X-Gm-Message-State: AHPjjUhsn+MmfzZ4om6E/tuQSFWB5vnov1JK79wHjmeQ49c3KjLoqv3C 4d/h8Y4z9y7MFNS8OaP7gQ== X-Google-Smtp-Source: ADKCNb72534LJnfGt3+6/p3b7RfRz6QmEPvRxpX4LXmnZQZq8GpnOwtlNMFahHxFDxfAd9s7+pDGcA== X-Received: by 10.99.3.213 with SMTP id 204mr32057012pgd.274.1505730816172; Mon, 18 Sep 2017 03:33: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 b7sm12937845pge.79.2017.09.18.03.33.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:33:35 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:02:10 +0530 Message-Id: <1505730731-10947-27-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Andre Przywara , Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 26/27 v9] 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 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 56d9cbe..36794d8 100644 --- a/xen/arch/arm/vpl011.c +++ b/xen/arch/arm/vpl011.c @@ -157,9 +157,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; @@ -369,11 +375,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);