From patchwork Wed Sep 27 06:13:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114332 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665369qgf; Tue, 26 Sep 2017 23:17:00 -0700 (PDT) X-Received: by 10.36.215.195 with SMTP id y186mr903793itg.3.1506493020065; Tue, 26 Sep 2017 23:17:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493020; cv=none; d=google.com; s=arc-20160816; b=wc1AZyNs9RCw4uyhVTDHjxtCNkM9jZZRZq6T6hq02qjAi8YXUjs0HQCAReUFaESa6a xHSAVaB+AfD6oo/zx/A5xWO7Xb+S3hZJDGlKwOw0/V4z5/WT3x5xVvMy4KjybBESpwvl D1Ko8HOOmBmBmRPL2hRu9KaNzhyDzuqjDk0fDkfm2hV8u3jNjVS50cIqsAjhuFnE3vMO FNmS6gIA9EXPVamQFX9scjPr5aHUwxkMJtNsJ7RbIjDWcVf9jL0PkZvuxGRoKj+QEz78 jiKrft+1wn/YUH5ogumCZEnRfJxJc6QVykIpudVMUZN2gaB6xeSDEtlkOCXFseoThJ2W ay6w== 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=0ld7rYVmobTRB4icKWxVdSS9MmAQzSDwU+1bQMBA/uA/JhgYaLFrmHImf1b8ynsSEI l9vgfQrw3dD+RLKgI2T737q+0RYqadpA3vxdGhLIZyhjbDGlXyllaVxU3DL8mKkenG/l AKAUlVO86EcT1UdRYObXVQam0gHCimjPIp9wI3OYWCXYLXHo8uAikQMogBJXeZITROtW vFAPVISE1wU4mslbgj9R0FoPFswchGvgGfdZFS9pz1yryeVt5Wrb9NK9XdocBQer6QZ2 ZEYq/5Za3vOQP3F0UEJZYQZRyCW2lSIxcs3SBmAZCyHt8WKIULisP/cr33jR6Xn+AiC4 1oSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ReMZhyhf; 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 o130si3389304itb.88.2017.09.26.23.16.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:00 -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=ReMZhyhf; 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 1dx5cA-0003Vy-8R; Wed, 27 Sep 2017 06:14:34 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5c9-0003UC-3v for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:14:33 +0000 Received: from [85.158.139.211] by server-16.bemta-5.messagelabs.com id 82/DC-18674-8C14BC95; Wed, 27 Sep 2017 06:14:32 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrEIsWRWlGSWpSXmKPExsVyMfTARt3jjqc jDRpOGlp83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBkHbv1hLDgnWPH++0OmBsb5vF2MXBxCAjMZ JU49msMK4rAIzGOWOPr3JEsXIyeHhEA/q8SilaUQdp7Ev41L2SHsNImGef+ZIOxyibkbb7OB2 EICWhJHT81mhZi6gkli16LbQA0cHGwCJhKzOiRAakQElCTurZoM1sssUC+x7dwvRhBbWCBcon X3TiaQchYBVYn+404gYV4BH4kTt/cxQqySk7h5rpMZxOYEip/uh1nrLXFpZT/rBEbBBYwMqxg 1ilOLylKLdA3N9JKKMtMzSnITM3N0DQ1M9XJTi4sT01NzEpOK9ZLzczcxAsONAQh2ME59H3eI UZKDSUmUt+b/qUghvqT8lMqMxOKM+KLSnNTiQ4wyHBxKErzzHE5HCgkWpaanVqRl5gADHyYtw cGjJMIbBZLmLS5IzC3OTIdInWJ05bhw59IfJo4vvTeA5IE9t4Dkiuu3gWTHzbt/mIRY8vLzUq XEeatAmgVAmjNK8+BGw6L2EqOslDAvI9CxQjwFqUW5mSWo8q8YxTkYlYR5F4JM4cnMK4G74BX QcUxAx/VOPQFyXEkiQkqqgVG/h19jq45O8T2JmTemZhytPH4l/WKdx3un3qPTPPbc267+b96M Q0w5JrO5vX+X2r8/bb7r5mSVklTe/2p/jxb5vlS4NzWa4eXfr80ihnFLz5dZdxd0Kph37fU85 36e6WGw5+fPS9+fWblqcSmD36sQ6aB7kjfLkvUk9q2Vf/Sx+aQmT2zdj1NKLMUZiYZazEXFiQ DEBHVD1QIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-7.tower-206.messagelabs.com!1506492870!110540381!1 X-Originating-IP: [209.85.192.177] 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 13096 invoked from network); 27 Sep 2017 06:14:31 -0000 Received: from mail-pf0-f177.google.com (HELO mail-pf0-f177.google.com) (209.85.192.177) by server-7.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:14:31 -0000 Received: by mail-pf0-f177.google.com with SMTP id x78so6744017pff.10 for ; Tue, 26 Sep 2017 23:14:31 -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=ReMZhyhfeOuHC94OwmhcvlwiicnzxbJS1LajtmMx6ES4hV8L6FXYnCJ8FBekJCUIio Sf0ExfxPTYkOhDOiqKg/wKU1g5hTyvzQxJnKZRObihT2Wr8DPoFRBN4oxcf876AM1mwp yDGG4xX3MYsbu5cX/HoVBv4PiFF05fPhLNKSg= 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=ED9Qa3qmhU+3GWUlPIZ7sJhionBR1+z+hj4K9VOp8XbDNU6knTpajeiOIwaAyf19iq BdyqEj2OGc9N2u2qjeA7IzPMIEOUR3Mr+w8aNT7GwPmZ1AaptrLA0VmnyKcvP2PhYFfC 3hXGmgulxVF7n4Ekn5TifGHy9XL7fhCIZ4evOjxgqYAeG6t4jcXcWa7S95wqCVX8QLmA D64tH8jp22koiQy+O4oqKN8M/IOV2w5fxFcz69aHmFEqRmjo1bM8zQPTice6tumbmvIo wWgBEA5gAMrDhyfu9USltfPbToYUrvB0IlaQwDMOz0uhyFJtG88anZIt6/o0AUQObie2 8ppg== X-Gm-Message-State: AHPjjUjOj5tM/E3t9K+jQLTUsTX+2BFUxRbdHR/DbSqIbMlHe7qdAm7y RnzOZTfxZU1nIHjss+tJ2DMWLcwVrrw= X-Google-Smtp-Source: AOwi7QBGe18m61vLKaGsRtQk5EUoIf0YV8SI6ppDijOnjadsQ63FRDTjhCzh3+nKXWmWRtDoTXtp+g== X-Received: by 10.101.69.194 with SMTP id m2mr358874pgr.20.1506492869864; Tue, 26 Sep 2017 23:14:29 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com (h3.248.139.40.ip.windstream.net. [40.139.248.3]) by smtp.gmail.com with ESMTPSA id s187sm18013485pgb.82.2017.09.26.23.14.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:14:29 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:35 +0530 Message-Id: <1506492816-25954-27-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506492816-25954-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506492816-25954-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Andre Przywara , Julien Grall , Stefano Stabellini Subject: [Xen-devel] [PATCH 26/27 v11] 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);