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: 112898 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501316qgf; Mon, 18 Sep 2017 03:35:03 -0700 (PDT) X-Received: by 10.36.204.135 with SMTP id x129mr9802866itf.7.1505730903562; Mon, 18 Sep 2017 03:35:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730903; cv=none; d=google.com; s=arc-20160816; b=x+tSIzEOwXLOlVrzyuL3229/AnRgdKHSM6rctlF7tvCc71EOhaupeeSqtw2yjgj1sv HSsDDKBWMGmXMU+l7vGSa118GKn7uEQb9cmz6NFo7R6BH1mGiwt2Ro74DoS9AOl0onFC edwkoufZH6RV17LDxZp2X9xGBn4zqqVBPtwxWfHnKpsAUfsFYraPc9q/xdBtRuG9yEB7 awoSF1eJojuiXKAJJais4OMpNisvoAHHBeX/fNyw2MBDWvB/Esk4c90BltlgXI04/Sxl VlnBDogx2JwcYhqxBPpI/wxffWwhgINupyz3loKF7EkGHj0kxNbtlqhwaf24q+5URXYM 9utA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=Oy/4abxUhiFMYmHkbzXyqnKHCU3+JYCYDir9aJJIH38=; b=lzUDtPIdik4T2hzR+NJMRNepF89i8li9mH15GlJ+ppyZwjNJNbWxp7imQ5zgCL3UQQ adKAB2Rvo/nBM5PeAGZw9Ha/Btz8m+r3Izg1cfhR8Fp98q3FYPYwAOrV01FSbhr8Vacx PIL84XDaOcf1aPoQKFzKAM7YDQLaGaT7isijnM1xKDypgxBStO5/XxAbULBkdIdb0ZoR O9kAS+D3Ydj/iIiSx3V14zvT180I0/DvriqlzgvpZsorP0XU2RxBowFwG7p/e8YnGyUY J3aeZmhyjrpCMGTKMtCXkIe8t8bolOviIPVol7SNM0JfwvsKExt/6Szv31U9iWn5XcP3 kxoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=c9PJe2bG; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id m123si4607036ite.117.2017.09.18.03.35.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:35:03 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=c9PJe2bG; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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" 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);