From patchwork Tue Oct 24 17:09:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 116975 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp6035022qgn; Tue, 24 Oct 2017 10:06:57 -0700 (PDT) X-Google-Smtp-Source: ABhQp+R6ONCJGpgB6mG14jGGjIZR4QRlAqFaT8N+bKzjtX9LnxYbYU7UVoaDjeQ/NiEMFzqTaLZY X-Received: by 10.36.192.133 with SMTP id u127mr13100209itf.27.1508864817455; Tue, 24 Oct 2017 10:06:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508864817; cv=none; d=google.com; s=arc-20160816; b=ril+L08DnBrrFCGtyhrlbSW7Wk2Jhjy4o3zJTRYSifpb62+F9samAeidQOLtgXV2X4 7bIextxdC33Sq4KBxkXgUkMPzt15aFj8MKK7hFPwg6IHmOA4KU7uLWs4/73CoPyghjPc iPtFej5i/YgwIfPLi2oxqlYbTFb4fsLXk9044p0jSoTG2ZDOoCRzJ0I0aKugPz8o0+2z jKiVpIgauhXiK9aoaqJvqYopbNC5GOdh6wXpvdhY81J7PXHGqGHH+WO4WznBKAaOHdm3 hM7cy7dMTXc+Ec3VAvT62p/acwm+Szso0CEY0QADXihX4MGwLUmd9Wpe5cE3ueDaTl26 eHNQ== 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=jxiffjvde9WKnwaIwhiTlRUCC++Hk5b6FJQ4h1uL9d8=; b=VfQthwXUVPE7cNheR9hl+PyhIPewDYVX/hD1Zk2S2pJT+AfcUP/MMwDgQUdvHay/Hb yt1e3WC0/x1tYtoF8NY3WbK6d6Cl8HcBGP3Mf0YXJC7bquZIUIKd+5W9VV8bMzcfBiTb U2lLN7JbPyJUfFOw9m3aELBJudPUCJ0Lt6Hkkf3xKvROMJDRlH6XF9VjxdizcuPPA5wQ kZU6Hz/ZGHQZAn5q6lecuOu8r4PxUNdI6bhRISGfvB45vNhisdRR7dRdqXdhdoc3ix7F hGnF84Otn7Ov/FTEXpI6EwkVK4osKs1jxeYbc7xeh22DczXm0RaxJ0N1J4ZD/nTXa0Sr BQCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=PsHXsQoY; 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 r71si485274ioi.35.2017.10.24.10.06.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 10:06:57 -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=PsHXsQoY; 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 1e72dR-0001hA-CJ; Tue, 24 Oct 2017 17:05:01 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e72dQ-0001gt-QX for xen-devel@lists.xenproject.org; Tue, 24 Oct 2017 17:05:00 +0000 Received: from [193.109.254.147] by server-8.bemta-6.messagelabs.com id E8/3F-13910-CB27FE95; Tue, 24 Oct 2017 17:05:00 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrPIsWRWlGSWpSXmKPExsXiVRvkqLu76H2 kQXubtMX3LZOZHBg9Dn+4whLAGMWamZeUX5HAmvF993ymgh+CFc3fL7A0MJ7k7WLk4hASmMEo 8bN5DROIwyIwj1ni7IuZLCCOhEA/q8TWX7dZuxg5gZwsiZW/TrBD2GkSXYcfsEDYZRIXmnsZQ WwhAQ2JG5NnMEKMbWKS6L66FayZTcBAYlbXZGaQhIhAJ6PE4jd7mEASzAJKEvvPXgPrFhYIkZ g+u4kNxGYRUJV49KoRrJlXwE5i0acpbBDb5CXOPbjNDGJzCthLbJ34jAVis53E7f93WSYwCi5 gZFjFqF6cWlSWWqRrqZdUlJmeUZKbmJmja2hgppebWlycmJ6ak5hUrJecn7uJERh0DECwg/Hu poBDjJIcTEqivAHp7yOF+JLyUyozEosz4otKc1KLDzHKcHAoSfDqAYNYSLAoNT21Ii0zBxj+M GkJDh4lEV5TkDRvcUFibnFmOkTqFKM9x749t/4wcay4fhtIdty8CySfzXzdwCzEkpeflyolzn ujEKhNAKQtozQPbigsXi8xykoJ8zICnSnEU5BalJtZgir/ilGcg1EJqAJkOU9mXgnc7ldAZzE BnSVr/wbkrJJEhJRUA6PBfIP9bM/CuFZyCGWsMHwpp/mjIWT1+psShl7J6xc8tfLaNrl90yIF I/2Lc1OWHlX9xBz6qF5i18YPNtfaGKd9vvh3zjvBb4JG/td7c10tDm+XVvwqm3E74YEDe9eZX r4jcX/d1FVXLZ3jNd3gTvGmCcKpphMYjWf+0JDI7+h9OMt5yrteDgYlluKMREMt5qLiRABoBR eM0gIAAA== X-Env-Sender: andre.przywara@linaro.org X-Msg-Ref: server-8.tower-27.messagelabs.com!1508864699!102936578!1 X-Originating-IP: [74.125.82.65] 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 21641 invoked from network); 24 Oct 2017 17:04:59 -0000 Received: from mail-wm0-f65.google.com (HELO mail-wm0-f65.google.com) (74.125.82.65) by server-8.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 24 Oct 2017 17:04:59 -0000 Received: by mail-wm0-f65.google.com with SMTP id p75so17035973wmg.3 for ; Tue, 24 Oct 2017 10:04:59 -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=vC6K9wE6boMEeamvD4YH8zxEoWdJGJzTshsxp47McgI=; b=PsHXsQoYQNu41GNLZv/Zja533ThLjTlcKRt0DTFiQTw7fnY8mRAKvBltzq1e0FSuRQ +aRVSM6OvNFFMkyc9JH7A58PhMwSP3+fmb7Z/kdZuYdXxREBdAM/Lz8XWnOOhRemc0q2 lAN7N18yotI4EGU0fG77XmK87RshgiV0Yt9yQ= 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=vC6K9wE6boMEeamvD4YH8zxEoWdJGJzTshsxp47McgI=; b=G9cMGNaZR2LEGc7HOZHCC4yyAB7d5U8sEHVzRGzzgoS4Fde6GjaCSn/tjXMP3xI+a4 PFScDjOJHCzkcrf/YQod0mepYu/5UOHav/6Evbr7pV9xemr33c9KWCRSNEB94ufN5hGZ LxDG3EXVHQZv7caxTq3dIXpjNkvUZ/xBlKASgNIRiW0xAgPV/5ABWkgk+idyAHcdn602 9pOzVhgQT4V1tBA68/Nda7pXkm4JlsXPoOhuw9RQC15HoXmRQCWinfBMLo996B3zGJ45 SijQxT8/MKmU+0wfsG9mhj6EGmYFwW7KttZ13Q62IISlrL37tQdX76A/AYmbaoJPscKh Cx3Q== X-Gm-Message-State: AMCzsaU4MKcaAVPu3RGQ6XhtjhQaN5z3np4TCGlsa5VvrMvZIPN/c9Qu P/G2sBl7Jzpd83uiFf+b2vjTUg== X-Received: by 10.28.54.133 with SMTP id y5mr7807165wmh.6.1508864699012; Tue, 24 Oct 2017 10:04:59 -0700 (PDT) Received: from e104803-lin.lan (mail.andrep.de. [217.160.17.100]) by smtp.gmail.com with ESMTPSA id j27sm773304wrd.42.2017.10.24.10.04.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Oct 2017 10:04:58 -0700 (PDT) From: Andre Przywara To: Julien Grall , Stefano Stabellini , Bhupinder Thakur Date: Tue, 24 Oct 2017 18:09:21 +0100 Message-Id: <20171024170922.17207-2-andre.przywara@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171024170922.17207-1-andre.przywara@linaro.org> References: <20171024170922.17207-1-andre.przywara@linaro.org> Cc: xen-devel@lists.xenproject.org Subject: [Xen-devel] [PATCH v3 1/2] 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" From: Bhupinder Thakur 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 Reviewed-by: Andre Przywara Signed-off-by: Andre Przywara Reviewed-by: 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 f7ddccb42a..0b0743679f 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);