From patchwork Wed Sep 27 06:13:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114327 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665267qgf; Tue, 26 Sep 2017 23:16:51 -0700 (PDT) X-Received: by 10.107.78.25 with SMTP id c25mr413950iob.25.1506493011929; Tue, 26 Sep 2017 23:16:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493011; cv=none; d=google.com; s=arc-20160816; b=P0iyHNgIyMVb+EFngpUPJEpCW0+076MoWvTifRzZXcIZheAhPLdpLzfKOiZ06rJUDc whVAPdFDf2woVmlsa+QFfWsHqxfUY+ekPwi5hqMbIsr0ChLO5nMSTg9P2Hi00Ww3jhmw rzBbBQSeQZbWETQVjKlltL2jLoP+hqUrNtv8AE+OwjWjJV6DrGYdS0OoSP06lC31n+5f lApS8JVr+e6WI0kHNVfaucEo7gls3en1ETF/s9xtN0L8AfoY/k5THtcuy5yx8T2nHw0w Hodu5HL7Vp1GDFFPa6HAE8oiKDz0Jv9HEtm6cXx5zsEyHocqfLU0uYHc9ar3QG9iCSbj f/cA== 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=i1DerMoIfoPo/MsSXJfIlpUT2liqezAHI1qr9iqywbA=; b=rLRPkSxXPNQg/65VO9yfCiUUmf4vZB/03FIO4PtGORFnFFT74wvUNqURZj/9kz1hxP 9ZIaiXmQCFBWv+KGf9VpcAgAJdOFghkccr4pDNQLnC9xRmaGcBTgs5FUYWsCmJnOmIpp IBKDmeCDrC2B+tsb6NXzamihfvXpnmtJB38u+yrKOEVhfFr5CII114A8v8MHpxkIt2MG Pk4n8egVVVki8MGNXNGm3HEafubWx28xXuAXB7sLRSYCzy5XEoZsiQqvzex4M3408mEC 5VqYDEFbjJJlWYZIUErfYrqrSRY42SMTt07GgPTWOSQnR85OCK2LnRMyxh2Tdm3tcYlY dlIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jkLokppx; 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 a10si3490308itb.154.2017.09.26.23.16.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:16:51 -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=jkLokppx; 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 1dx5by-0003E5-GC; Wed, 27 Sep 2017 06:14:22 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bx-0003CA-F1 for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:14:21 +0000 Received: from [85.158.137.68] by server-9.bemta-3.messagelabs.com id 14/06-02044-CB14BC95; Wed, 27 Sep 2017 06:14:20 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrEIsWRWlGSWpSXmKPExsVyMfTANt3djqc jDa685LH4vmUykwOjx+EPV1gCGKNYM/OS8isSWDM+nFvPVvBfvmLSs+WsDYxd0l2MXBxCAjMY JRbcfcQO4rAIzGOWaJhyFMyREOhnlbhxbztTFyMnkJMn0buuBcjmALLTJP5ck4UIl0t83HQHr ERIQEvi6KnZrBD2CiaJ69frQcrZBEwkZnVIgIRFBJQk7q2azAQynllgPqPE/5+3WEASwgLhEg 9mdIONZxFQlXhyLxgkzCvgI7H4xnxmiFVyEjfPdYLZnEDx0/232SBWeUtcWtnPOoFRcAEjwyp GjeLUorLUIl0jc72kosz0jJLcxMwcXUMDY73c1OLixPTUnMSkYr3k/NxNjMBwq2dgYNzB2LLX 7xCjJAeTkihvzf9TkUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeG84nI4UEixKTU+tSMvMAQY+T FqCg0dJhFcQGPxCvMUFibnFmekQqVOMrhwX7lz6w8RxbNNlIPml9waQPLDnFpDsuHn3D5MQS1 5+XqqUOO9FkNkCIM0ZpXlwo2FRe4lRVkqYl5GBgUGIpyC1KDezBFX+FaM4B6OSMK8syAk8mXk lcBe8AjqOCei43qknQI4rSURISTUwaleqdF61bSt4KNM8TdaBuWj9d6Obh95ZWC7zVT1z3oM5 T8LHcO60Mv/naybomP5IE/tZavls2W3zCZ05Zcsv7xffzXbowNRuZUWTs5wbyr5eWhLgt6VDq CStTptxQuTh2P6PL38vKYjbpls41YVXb0pmzjLJvHMb3x8vSfp8/97Uj1e+WzLrKLEUZyQaaj EXFScCAIm5KujVAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-14.tower-31.messagelabs.com!1506492857!116524231!1 X-Originating-IP: [209.85.192.182] 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 45513 invoked from network); 27 Sep 2017 06:14:19 -0000 Received: from mail-pf0-f182.google.com (HELO mail-pf0-f182.google.com) (209.85.192.182) by server-14.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:14:19 -0000 Received: by mail-pf0-f182.google.com with SMTP id p87so6745120pfj.9 for ; Tue, 26 Sep 2017 23:14:18 -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=+FatmofrAza4mRjPSInOolFST8U95IIGtc54zK1irIA=; b=jkLokppxfiDHEdHwx87nXoT9ZZ0ZnCRo8vIXL6TAoK9OT+LT/WuDkXV85DiurgGTAG BFLPwnLt2alyomPUeP3BNgWuM+ipFrULzPMQJJP7FTn8MDKh6ZAWG4NNSJuxbGelLH7s mIvecJWn5lCaMml9rv/qolqe5SsVflAFUnq+o= 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=+FatmofrAza4mRjPSInOolFST8U95IIGtc54zK1irIA=; b=s3Bd0lFwNvTzTBOKbExlI/mzfo+pwq+u9vvtqTXffIj0WXme3o09cDJGCiVrCkEWdG 22L1E88apcl1nsAeUMjZAwL88m/1qsJusgzWtpJT32leFVqTlOd8eDfRsuXS11mBpszX B5EE6N6G9aIHXUPEy7AYhvszKvyuX7MOLSift9vDYuNOFthQlV9IBw8NkXpw2WrMgNIi 1KJ0HTtUSU4q4QHEmm5MTZ0aZ6vzL41lnVgY36rfTe8vaY0kBowtYaZP4x7R87RSVk12 hp5KWjaKPjEnUSV/j9DvUJ2sfVGHf/KTnR5j8tk4NEk3PgnGDCCsNedbjNYMWfayiFf+ MZKg== X-Gm-Message-State: AHPjjUioIA6VKoI0tJSQew6DcnJmeLyr90OVz2bXpKeeWSaNwQH5k0Ve i1f1WWbsrLY5Bojqz0DG16WUH9mzNsM= X-Google-Smtp-Source: AOwi7QD9NMwYTqMnsKWm8qAoXnurWebk4JdsbNCBZ0k+dkjUvrG/jOrwKQs9YwZ/IeK9yEVGPC0PYw== X-Received: by 10.101.69.194 with SMTP id m2mr358460pgr.20.1506492857304; Tue, 26 Sep 2017 23:14:17 -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.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:14:16 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:31 +0530 Message-Id: <1506492816-25954-23-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: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 22/27 v11] 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 ony 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) +