From patchwork Mon Sep 18 10:32:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112887 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501146qgf; Mon, 18 Sep 2017 03:34:50 -0700 (PDT) X-Received: by 10.36.223.2 with SMTP id r2mr17762996itg.19.1505730890912; Mon, 18 Sep 2017 03:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730890; cv=none; d=google.com; s=arc-20160816; b=0xhytIB+2SPdcifyRVpK+Q+pZ4L7iQNrBOOv6SQ7DjHtzHMg3r28WLxciDLDo3nG/s ppwLf+kNmA/lVQvFAqEy7bryJninlpnLt6Z+fDVNdR4lFeoQSnolNAqMZdTXv6rpUmJv lntkKuMrUL/jOw0h7BiZCbMLySEem4lgtNxLnyCk6m0ngjnxis5FKYxsy68zCSb2J3io ksBrt/JQipTGxMFG11zZ2jdpbb6Y7R4/oSxHXBMKo0El+r2oQvAMEDcpOdPo318jpm9b 7Rg8evcDkTw2ommPEwXCdpLEsKvlMpiq+ylpz11918MDt36dJGVegFI0VweETidMCY98 OZCg== 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=NtbPnEhAMKIa0TwXLJ31bkWY6N8DP2RCD+y7jj8ouhI=; b=nFeapilCwLeXkkEHGOelPWDCNmiFIyY+vJcv9chldZcoYq2GwWualnKTqQrz+GeyC6 0RN1WC6abnogEEa0tx+TtL4ovSgPdtpZlHAUZlrn2hmZuwB3sIMooYj2Y5NiuSfjO6gy ihq2f1IqKRmkG4PfatWS+7oTOT5ICaWA0jW34fCKJop2ooTJMv6gnXidg6LoRetRD+9L dkHC7EgTxPHZk57m4L5lPS6lFmgnXqBXoHaBesJlJrQ4XFqdj+IYq0h/KovGpQKUrLyR 6jzAMp5lUs2+CC7uENQ22FTTUoG/bPZc80p7z5Eymcv5Yy0XbsCu66lcu8sSBhrTCnci 1c7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=M1kfM9Pm; 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 16si5537401iol.148.2017.09.18.03.34.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34:50 -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=M1kfM9Pm; 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 1dttMo-0002lA-Mk; Mon, 18 Sep 2017 10:33:30 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttMn-0002jf-U2 for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:33:30 +0000 Received: from [193.109.254.147] by server-9.bemta-6.messagelabs.com id 5E/66-03422-9F0AFB95; Mon, 18 Sep 2017 10:33:29 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRWlGSWpSXmKPExsVyMfTABt2vC/Z HGsy5omHxfctkJgdGj8MfrrAEMEaxZuYl5VcksGbMPLuYqaBBoWJTz1HmBsZu6S5GLg4hgWmM Ep/fH2YBcVgE5jFL/L52kL2LkZNDQqCfVWJxXw6EnSbR3vGSqYuRA8xeuTcZwqySmHRSDaRCS EBL4uip2awQM3cwSWw69RisnE3ARGJWhwRIjYiAksS9VZOZQGqYBeYzSvz/eYsFJCEsECZx51 QfI4jNIqAq8XhzIxuIzSvgI7Fk6XkmiBPkJG6e62QGsTmB4ufXP2CFWOwtMe/XFcYJjIILGBl WMWoUpxaVpRbpGhrrJRVlpmeU5CZm5ugaGpjp5aYWFyemp+YkJhXrJefnbmIEhhsDEOxg/LIs 4BCjJAeTkiivaOT+SCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvKvnA+UEi1LTUyvSMnOAgQ+Tl uDgURLhXQeS5i0uSMwtzkyHSJ1itOe4cOfSHyaOY5suA8kDe24ByY6bd/8wCbHk5eelSonzvg NpEwBpyyjNgxsKi9RLjLJSwryMQGcK8RSkFuVmlqDKv2IU52BUEuZdBjKFJzOvBG73K6CzmID OatmxB+SskkSElFQDY/XHg+bMLr99//dPT+r/5Kh672fJxk9GYTovtTf3yef4u9/feqrYs8Lw 1FfGz+8WH1ygWKMsP3fRFnXWs3KrLTYLCIm3LlNw5pu03nfKAivOjtPV8iU3H/n8zAx7krk63 v/NhcdKX3hPJF1R8GJK/eF7U0U9l2Xevintb1YqSHPOUbr8/Pj6ciWW4oxEQy3mouJEAJP0fc nPAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-6.tower-27.messagelabs.com!1505730804!117453157!1 X-Originating-IP: [209.85.192.176] 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 17725 invoked from network); 18 Sep 2017 10:33:25 -0000 Received: from mail-pf0-f176.google.com (HELO mail-pf0-f176.google.com) (209.85.192.176) by server-6.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:33:25 -0000 Received: by mail-pf0-f176.google.com with SMTP id p87so28135pfj.9 for ; Mon, 18 Sep 2017 03:33:25 -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=Lo4OHtevPukx/SByq0doKClQ+61pfeNZRGftrLJvOWA=; b=M1kfM9PmxDb2QDciFKTDa+pJb34xWT4+3KAGxJcC3pG6aZqaBBJYHQODW5Xw0aEFhP gYwxTPQtISDBYdkb8N96qvcZ+r6TaK2reLGC6v3moBjV+FALIRmT+oOZgkglOvlq/CSt io1c2ArqwfxSOBc1TkH32MXo2QRwaqsE2Kf7E= 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=Lo4OHtevPukx/SByq0doKClQ+61pfeNZRGftrLJvOWA=; b=RiVYlZ/6VNWtBpqRnAblAMO9Hc7TCAfqUAjW3bwzn7RI+enJvI/Lu3MfJV573t4pcF QTHuGq7e9AdSbpeasorzDXnd36L4U+oWdNcR5O/eCTtaUt2SLgp45vS+LKH25n7+/QW/ AnF0QH0Zfhda/jEP2qWV4ZiuFgogoUYw6lXM2IX4EeEMjIkca4p/hqPsiHH68IRHZTNQ n0dsrcKxroe6A0gJqRm79S1OfuFN9M4UjKdAeUFVh48dvEu4wuNSgNKB4o9t61LrT+xM h4lGY0DkmHK/T5fa+KeGG30Ce2FhysMDai2IUyuj5Gpvjl+ceSpjDaZI9wJR+93VI2UC 96XQ== X-Gm-Message-State: AHPjjUiqIruejDYwIIOf1iOth0t4AEtO+8E+OdU7txPb6AqWZKTxzYWY t7nmb7AyWnnm6jvIFD7/iA== X-Google-Smtp-Source: ADKCNb42HRZurlTRMSaIvxt+mcYD6vykpWiMwP7NK33VXtJkfRYYGq9hbFr6jk5VAmOOTZKf/LYuwQ== X-Received: by 10.101.74.129 with SMTP id b1mr31525205pgu.272.1505730804037; Mon, 18 Sep 2017 03:33:24 -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.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:33:23 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:02:06 +0530 Message-Id: <1505730731-10947-23-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: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 22/27 v9] xen/arm: vpl011: Add support for vuart console in xenconsole 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" This patch finally adds the support for vuart console. It adds two new fields in the console initialization: - optional - use_gnttab optional flag tells whether the console is optional. use_gnttab tells whether the ring buffer should be allocated using grant table. The VUART console is enabled only for ARM. Signed-off-by: Bhupinder Thakur Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Julien Grall CC: Stefano Stabellini Changes since v8: - Removed CONFIG_VUART_CONSOLE config option - Renamed CFLAGS_vuart-$(CONFIG_VUART_CONSOLE) to CONSOLE_CFLAGS-$(CONFIG_ARM) - I hav retained the acked-by tag as it is a minor change Changes since v6: - Renames prefer_gnttab to use_gnttab Changes since v4: - Renamed VUART_CFLAGS- to CFLAGS_vuart- in the Makefile as per the convention. tools/console/Makefile | 3 ++- tools/console/daemon/io.c | 30 ++++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/tools/console/Makefile b/tools/console/Makefile index c5f3f5c..84796ea 100644 --- a/tools/console/Makefile +++ b/tools/console/Makefile @@ -11,6 +11,7 @@ LDLIBS += $(SOCKET_LIBS) LDLIBS_xenconsoled += $(UTIL_LIBS) LDLIBS_xenconsoled += -lrt +CONSOLE_CFLAGS-$(CONFIG_ARM) = -DCONFIG_ARM BIN = xenconsoled xenconsole @@ -28,7 +29,7 @@ clean: distclean: clean daemon/main.o: daemon/_paths.h -daemon/io.o: CFLAGS += $(CFLAGS_libxenevtchn) $(CFLAGS_libxengnttab) +daemon/io.o: CFLAGS += $(CFLAGS_libxenevtchn) $(CFLAGS_libxengnttab) $(CONSOLE_CFLAGS-y) xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c)) $(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_libxenevtchn) $(LDLIBS_libxengnttab) $(LDLIBS_xenconsoled) $(APPEND_LDFLAGS) diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c index a198dbb..2615b50 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -107,12 +107,16 @@ struct console { xenevtchn_port_or_error_t remote_port; struct xencons_interface *interface; struct domain *d; + bool optional; + bool use_gnttab; }; struct console_type { char *xsname; char *ttyname; char *log_suffix; + bool optional; + bool use_gnttab; }; static struct console_type console_type[] = { @@ -120,7 +124,18 @@ static struct console_type console_type[] = { .xsname = "/console", .ttyname = "tty", .log_suffix = "", + .optional = false, + .use_gnttab = true, }, +#if defined(CONFIG_ARM) + { + .xsname = "/vuart/0", + .ttyname = "tty", + .log_suffix = "-vuart0", + .optional = true, + .use_gnttab = false, + }, +#endif }; #define NUM_CONSOLE_TYPE (sizeof(console_type)/sizeof(struct console_type)) @@ -654,8 +669,17 @@ static int console_create_ring(struct console *con) "ring-ref", "%u", &ring_ref, "port", "%i", &remote_port, NULL); - if (err) + + if (err) { + /* + * This is a normal condition for optional consoles: they might not be + * present on xenstore at all. In that case, just return without error. + */ + if (con->optional) + err = 0; + goto out; + } snprintf(path, sizeof(path), "%s/type", con->xspath); type = xs_read(xs, XBT_NULL, path, NULL); @@ -669,7 +693,7 @@ static int console_create_ring(struct console *con) if (ring_ref != con->ring_ref && con->ring_ref != -1) console_unmap_interface(con); - if (!con->interface && xgt_handle) { + if (!con->interface && xgt_handle && con->use_gnttab) { /* Prefer using grant table */ con->interface = xengnttab_map_grant_ref(xgt_handle, dom->domid, GNTTAB_RESERVED_CONSOLE, @@ -788,6 +812,8 @@ static int console_init(struct console *con, struct domain *dom, void **data) con->d = dom; con->ttyname = (*con_type)->ttyname; con->log_suffix = (*con_type)->log_suffix; + con->optional = (*con_type)->optional; + con->use_gnttab = (*con_type)->use_gnttab; xsname = (char *)(*con_type)->xsname; xspath = xs_get_domain_path(xs, dom->domid); s = realloc(xspath, strlen(xspath) +