From patchwork Thu Jun 22 07:38:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 106173 Delivered-To: patch@linaro.org Received: by 10.140.91.2 with SMTP id y2csp2327234qgd; Thu, 22 Jun 2017 00:41:41 -0700 (PDT) X-Received: by 10.107.151.140 with SMTP id z134mr1089091iod.83.1498117301147; Thu, 22 Jun 2017 00:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1498117301; cv=none; d=google.com; s=arc-20160816; b=U7FnuLbmBIT9nkosOya2k3TxTowvvfYaIzC+MbvMOlSgH432iGrMcFqqWkOIMBYc6z EGwpD8xk/9iiq8Hd8JOYI1wmMZvfCghF231dhnEtyfn2zVD3MDozFmag7hSKYw37mmy0 5sZnAQIsV4mbdlM5KCWmcq/qqnnVqvLiSXKWKC3jylO2N88a8Cn4K9EIJ+czrJvdyNu7 W5VGKl5ixack6EqxsmSaieTIi551xsVFMMWIB8wHPBNMQp79wzW1O+R2sNnetHJ4GJDP XjjocogALVQTcXhnPFO7fM4Az//S6BrMJZfE0+kxhWH8m0FOX4+GGppcX7G7rZJATOC3 SWLQ== 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=DVpJwioHMZgAfvQLqR/TgpwCknd+DR4y/dTqDgE6YgM=; b=pDVX+O54xRDKOppCiNr5o8RPZ1yHMqtWPxLg4EkEPqc589Xzz4eMuXVsBD8h08xnxb z3J0WGd9fW5/6OH1m62pjvTgNi9JfijZJmlTPKhvZzNjbCnTdrqf6OabiRzdK6mllB99 SBpQyM2MNtylP2PRipq4m8r+DO7Q+fnRtDDAlkmwPHKou9Mg8HAW2uufll8yaJjE69En S0vh53b3eFpgQF+MM8yw1Ty6RBIyatSNpyS7zquHyJSBH6I0F4q72nQZUf2MGdpmNcCa lztx2tJ2FohbGqg+C4aO7iAkh38kLCU+BKBNWDqQt+hfVP/IEbLMEYtXIncR0RkReoQE /kqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=CtVZDdkW; 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 e9si710899ioe.292.2017.06.22.00.41.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Jun 2017 00:41:41 -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.b=CtVZDdkW; 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 1dNwiQ-0005uW-TR; Thu, 22 Jun 2017 07:39:46 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dNwiQ-0005tQ-CM for xen-devel@lists.xenproject.org; Thu, 22 Jun 2017 07:39:46 +0000 Received: from [193.109.254.147] by server-9.bemta-6.messagelabs.com id AB/E9-03557-1447B495; Thu, 22 Jun 2017 07:39:45 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrDIsWRWlGSWpSXmKPExsVyMfTAWl3HEu9 IgwkT+S2+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozLM0+wFFxQqNiw/xhTA+Nx6S5GLg4hgRmM Ei1rG1hAHBaBecwSl17cY+xi5OSQEOhnlbhzLAnCTpN4d2gGM4RdITFlwypWEFtIQEvi6KnZr BCT9jFJTJ54HqiZg4NNwERiVocESI2IgJLEvVWTmUBqmAXmM0o0TeplA0kIC4RJ3OhbCzaURU BVonPqRTCbV8BH4nVnB9QyOYmb5zrBbE6g+IodC9khFntL7DozmWUCo8ACRoZVjBrFqUVlqUW 6hqZ6SUWZ6RkluYmZObqGBmZ6uanFxYnpqTmJScV6yfm5mxiBocUABDsYvy0LOMQoycGkJMr7 P887UogvKT+lMiOxOCO+qDQntfgQowwHh5IEr3IxUE6wKDU9tSItMwcY5DBpCQ4eJRHeFpBW3 uKCxNzizHSI1ClGS44rV9Z9YeLYsHo9kJxyYPsXJiGWvPy8VClxXlGQeQIgDRmleXDjYJF4iV FWSpiXEehAIZ6C1KLczBJU+VeM4hyMSsK8+kVAU3gy80rgtr4COogJ6KAXRzxADipJREhJNTA a+89tSj90/RvjtmUZWyzTt0YxKm85MZMpbXp6Sqx3/7yLS0oE9yy9odqarvShKGpG/xyXVq+2 4vAEw036dy5oH39+Z/7MP01nfzpeZJO6v1DlhYvPrMaVF9aEzTx0oe7jAneegJ0qejdu5WTtP v1jssUy95o5FqLMvyUUOhSYf5v1hLcUXbJSYinOSDTUYi4qTgQATYdhDL8CAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-3.tower-27.messagelabs.com!1498117184!108618021!1 X-Originating-IP: [209.85.192.173] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 32168 invoked from network); 22 Jun 2017 07:39:45 -0000 Received: from mail-pf0-f173.google.com (HELO mail-pf0-f173.google.com) (209.85.192.173) by server-3.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Jun 2017 07:39:45 -0000 Received: by mail-pf0-f173.google.com with SMTP id s66so5122184pfs.1 for ; Thu, 22 Jun 2017 00:39:45 -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=y5KYWPT+rJa3lMHpqSzqcCfUuw5cKTxzwc4Sp+SyUC8=; b=CtVZDdkWFo33phk0rjZ6ZmJcBr0sKvXPqiOWbzDJECDAV0NTc+ShoyBfFjYA/KiiNP Ndl/7dY/myHFH7crv/bttBioGyxMpR47dL4lsItEUHQteTOiGqUoib4G526aypCvuyOd +RkLdzS68U+qNki7Z95XTuIF09bcESmkmPinI= 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=y5KYWPT+rJa3lMHpqSzqcCfUuw5cKTxzwc4Sp+SyUC8=; b=uUddjEyQ55WSWUbhUOlNoWw+V/CXTvlxsqdQ8ZA9tiuWUVhILhEgbOSEs2qb7uI/Df HXkEdzZ8GexSjITMbpf+h4YVE/a8g0cYl9qz0wgGP0nqE5g1qvdJwnZw2bujl7YnDzbT MWdT8HEy9RU8p8TcMV9Jkb8mBVWiWkebkc9JhvsNyhH0us/rrjqmzX3Rf6z5Zq5Q4+yG LoBS/VDSVm0ZeZZyugbRgePO6WJoH31K9m0nwMXuaH4YG7j9pSoHwWcYp98lLTfJZb1b eq1kMzmbZ63tSFUDowBFCi0pHbvlJ/GT1lXB/rPcpx600AsUXgyIKD/FBiAkfJJBryUw 114Q== X-Gm-Message-State: AKS2vOx3H8vBQd3wcuUc4fdbQ0yHmCDle1c/TMw6R95FnF5Z0Y0e6hqL ep01NnCVhMxLGOeSgfTjzw== X-Received: by 10.99.146.13 with SMTP id o13mr1288290pgd.54.1498117183516; Thu, 22 Jun 2017 00:39:43 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id w69sm1883591pfk.107.2017.06.22.00.39.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 22 Jun 2017 00:39:43 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Thu, 22 Jun 2017 13:08:49 +0530 Message-Id: <1498117132-27139-15-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498117132-27139-1-git-send-email-bhupinder.thakur@linaro.org> References: <1498117132-27139-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 14/17 v5] 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. Signed-off-by: Bhupinder Thakur --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall Changes since v4: - Renamed VUART_CFLAGS- to CFLAGS_vuart- in the Makefile as per the convention. config/arm32.mk | 1 + config/arm64.mk | 1 + tools/console/Makefile | 3 ++- tools/console/daemon/io.c | 31 ++++++++++++++++++++++++++++++- 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/config/arm32.mk b/config/arm32.mk index f95228e..b9f23fe 100644 --- a/config/arm32.mk +++ b/config/arm32.mk @@ -1,5 +1,6 @@ CONFIG_ARM := y CONFIG_ARM_32 := y +CONFIG_VUART_CONSOLE := y CONFIG_ARM_$(XEN_OS) := y CONFIG_XEN_INSTALL_SUFFIX := diff --git a/config/arm64.mk b/config/arm64.mk index aa45772..861d0a4 100644 --- a/config/arm64.mk +++ b/config/arm64.mk @@ -1,5 +1,6 @@ CONFIG_ARM := y CONFIG_ARM_64 := y +CONFIG_VUART_CONSOLE := y CONFIG_ARM_$(XEN_OS) := y CONFIG_XEN_INSTALL_SUFFIX := diff --git a/tools/console/Makefile b/tools/console/Makefile index c8b0300..1cddb6e 100644 --- a/tools/console/Makefile +++ b/tools/console/Makefile @@ -11,6 +11,7 @@ LDLIBS += $(SOCKET_LIBS) LDLIBS_xenconsoled += $(UTIL_LIBS) LDLIBS_xenconsoled += -lrt +CFLAGS_vuart-$(CONFIG_VUART_CONSOLE) = -DCONFIG_VUART_CONSOLE 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) $(CFLAGS_vuart-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 baf0e2e..6b0114e 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 prefer_gnttab; }; struct console_data { char *xsname; char *ttyname; char *log_suffix; + bool optional; + bool prefer_gnttab; }; static struct console_data console_data[] = { @@ -121,7 +125,18 @@ static struct console_data console_data[] = { .xsname = "/console", .ttyname = "tty", .log_suffix = "", + .optional = false, + .prefer_gnttab = true, }, +#if defined(CONFIG_VUART_CONSOLE) + { + .xsname = "/vuart/0", + .ttyname = "tty", + .log_suffix = "-vuart0", + .optional = true, + .prefer_gnttab = false, + }, +#endif }; #define MAX_CONSOLE (sizeof(console_data)/sizeof(struct console_data)) @@ -655,8 +670,18 @@ static int console_create_ring(struct console *con) "ring-ref", "%u", &ring_ref, "port", "%i", &remote_port, NULL); + 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); @@ -670,7 +695,9 @@ 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->prefer_gnttab) { /* Prefer using grant table */ con->interface = xengnttab_map_grant_ref(xgt_handle, dom->domid, GNTTAB_RESERVED_CONSOLE, @@ -790,6 +817,8 @@ static int console_init(struct console *con, struct domain *dom, void **data) con->d = dom; con->ttyname = (*con_data)->ttyname; con->log_suffix = (*con_data)->log_suffix; + con->optional = (*con_data)->optional; + con->prefer_gnttab = (*con_data)->prefer_gnttab; xsname = (*con_data)->xsname; con->xspath = xs_get_domain_path(xs, dom->domid); s = realloc(con->xspath, strlen(con->xspath) +