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: 111129 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp4548368qge; Mon, 28 Aug 2017 01:59:09 -0700 (PDT) X-Received: by 10.107.15.19 with SMTP id x19mr5033965ioi.53.1503910749103; Mon, 28 Aug 2017 01:59:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503910749; cv=none; d=google.com; s=arc-20160816; b=rrgbf/+WwPxCbIet/Sxb0a6UOe9Zdq1igRe2LUQ2yGuz75XvaHfQWm+peoPNzJyNsq I37UVjcLcom/MByifBHWJ3k6guBaAtFvffaIxH3UbKWGURa0FUQ9J2wZphlkRuXVVEl3 fgn/y3ylkX2MKXrrm/WFCU5cwFemBJo2jvXWB5Y3EmouBa16QNfBun5XCM80BdN14V0W sD97UV5aQBRACVs5KlmD3z57rYZdY4WfgJXE4Y6LkbzS2kkUOz5zIMfxOt1Fu6NZpGoI L5Tqm4O7c6tcujIuI55tDP0RPXZf34OVUTvUCz6csWodqmvdxpmsSOi1Z4SPmFrOHjMg AiYw== 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=sFFp6VP1sf3ZlBdGWyS0p3+25MwNuA3IeS1vbrWaL74=; b=RQeYnqxB9ybSRTCBCWuwSZ8Wxm0zCl6vrViGjLts8jdmIbdR4Il/0jGECbR2WIm7k1 hU4p3gcx29trjTn+EUeMo5hEDVn2MAKLmwLoa6xAy7tXu8hyfO0LIVSEsbAmimmW1JbK +UzmauqBB/gwBOac1H4Mvan8ILWIlV6KJqmHdFeOD7W2gS+E/Cp6EPvH3k7W40S53pZp RhKWeJyYWozpMY8YLFdguCKjeQwSsYLz9+HWxf8AT3UgTjqfQJ05pBBstaelj3AhCfYQ SEI00ui88yDy97SB1E0rYi4Ddp1l6n74I3rO4PtqSEjqERwiaWVnUhe1GrhL8kDP+Vi6 qNwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ATXLxXns; 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 3si11506734iow.301.2017.08.28.01.59.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Aug 2017 01:59:09 -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=ATXLxXns; 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 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" 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; } }