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: 9956367 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E769660208 for ; Mon, 18 Sep 2017 10:35:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6B7528C24 for ; Mon, 18 Sep 2017 10:35:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA5B228C4F; Mon, 18 Sep 2017 10:35:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5E3BD28C24 for ; Mon, 18 Sep 2017 10:35:22 +0000 (UTC) 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" X-Virus-Scanned: ClamAV using ClamSMTP 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) +