From patchwork Tue Jun 6 10:04:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 103153 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp1186383obh; Tue, 6 Jun 2017 03:06:49 -0700 (PDT) X-Received: by 10.107.12.151 with SMTP id 23mr29116075iom.6.1496743609852; Tue, 06 Jun 2017 03:06:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496743609; cv=none; d=google.com; s=arc-20160816; b=M/8ihS0UZbm3QR/FQSMChlgB7HsEKbPBExBj4Md8cIzhACcCCPrwMlGWXJ1vd719C2 xDhQXy4KXGmsjdF6OvB/GRB6FfbIorsUKJgIUPHtCUajqPMv2PIk6Ox/pxrMeoulXHKC 0nsTEsyOiKXy2wmelRLSxpQ0bwagt8OQsJ//pwLVqwy/xI5O5k+lRdAa8uzEtIFhUk3p wKHVgPrvAgHmv8wMjfx/+MR7beg9XZb8uW2P+41AEy1senTfpHudd5Nbk3OrHJ4vtLkm FGVD5U9wrupWYX6T9k8vpF8ZhZkTR7oQWu/Ud6p3uC1vYjMhicExg7pSj8DFswdUMQit gDxw== 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:message-id:date:to:from:dkim-signature :arc-authentication-results; bh=cGJFB9wog9PtRsF1djvLbSUMutGA/w7ikACr/DuC+g0=; b=skgfQqAIn0dyDaXCQpvHrgav1awc3SZ1EoH1axAWorqQdipj3/PKqU7aodAFBMNNxN KMu64hfWTsqbSuKelN/SDzY4lhQxrwvC4uBtaeJ1XQpRf6UD9hbXAK0gKTU27+Bas9EZ oRI6uLphxY15+3DianrRDTTxP0EPr+U3VUlnQVXZakVAPlCSd3c4j5sniw8etz9DeEue Om38QHEyjgOSUt2DoiyDFNBQmmWUEIzQhOqvUeJ0hd9zrfamZ6jD4fVQljdtGpSEP+Cc ngC2dYKzdkVqa1rIcNXaXjCzl8GG8nzqmSFCgyMvc+AaX4ryp488CB7U4lYzXmqZ9XRi epbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; 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 q130si2336260iod.11.2017.06.06.03.06.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Jun 2017 03:06:49 -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; 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 1dIBLu-0004D3-4Q; Tue, 06 Jun 2017 10:04:42 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIBLt-0004CU-Fw for xen-devel@lists.xenproject.org; Tue, 06 Jun 2017 10:04:41 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id FE/B9-29088-83E76395; Tue, 06 Jun 2017 10:04:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplkeJIrShJLcpLzFFi42Lxqg020LWoM4s 0+PyL0+L7lslMDowehz9cYQlgjGLNzEvKr0hgzZixfDNjwSqpimcfJrI0MK4U62Lk4hASmMEo 0banh7WLkZODRaCdWaJhui1IQkLgHYtE977zbCAJCYE0iSdHb7ND2FUSqx5eBGsQEtCSOHpqN ivEpN1MEkcXtzB3MXJwsAmYSMzqkACpERFQkri3ajITSA2zwHxGiaZJvWwgNcICYRLf+uIhFq tKNHbOBZvJK+AtcXz+DWaIXXISN891Mk9g5FvAyLCKUaM4tagstUjX0FgvqSgzPaMkNzEzR9f QwFgvN7W4ODE9NScxqVgvOT93EyMwUBiAYAfjtu2ehxglOZiURHlrE8wihfiS8lMqMxKLM+KL SnNSiw8xynBwKEnwCtQC5QSLUtNTK9Iyc4AhC5OW4OBREuFVrgRK8xYXJOYWZ6ZDpE4xGnNsW L3+CxPHpAPbvzAJseTl56VKifNygEwSACnNKM2DGwSLpUuMslLCvIxApwnxFKQW5WaWoMq/Yh TnYFQS5v1WAzSFJzOvBG7fK6BTmIBO4btkAnJKSSJCSqqBsZ9lqZ7cJtnGLRmGSTXTxJpKe8v VJRl//jwcyP1PI/LDKeafUR6GmetvX026MTd4dm3kotVzYkNV3mYv7Zn781mu9b/A+cGJC27F p2dsLUjUE8j2Tb9xo3WTgfr9CJ7VVvFB7XIP1xd3NvvuffTevDz165lpTnfUU48oNusc2sF3K /l6s+l/JZbijERDLeai4kQADpkEH6ACAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-16.tower-31.messagelabs.com!1496743478!96672340!1 X-Originating-IP: [74.125.83.48] 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 18021 invoked from network); 6 Jun 2017 10:04:40 -0000 Received: from mail-pg0-f48.google.com (HELO mail-pg0-f48.google.com) (74.125.83.48) by server-16.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 6 Jun 2017 10:04:40 -0000 Received: by mail-pg0-f48.google.com with SMTP id v18so23427034pgb.1 for ; Tue, 06 Jun 2017 03:04:39 -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; bh=2HgK3TZqulofrojDhzc/Q4CmxiMvQi9hQ71FujvLllE=; b=Ij99hSNatdwV0F9dhDj4NTPAwTo42c5v3qLtZTMbhlh8Lpgb9hhYAT4ZqeNRtkEzO+ UyzW6U+1ARBRKZG4QMZuhYdMS5VJ+D2aTm2C/CBkruTgvx8A8n2Iw7/NHlZAUJJviKN4 3f+KjvB91lLRNFhoakAoZiKIx6z9CnD8TW32A= 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; bh=2HgK3TZqulofrojDhzc/Q4CmxiMvQi9hQ71FujvLllE=; b=IijIMM3LlLbDppo4AT9OJ9swvMcw2ydSe2lNyADQ5j6L1PX3ogI/bJVaJKzgxuHNqs RK3QFlLLJZElvmPZcckW0KptMtN3GmG/S/YTffD59xW26AO60KHh3bBkA58VfyP5UNr4 w/adQmOsY149HUgMwbPkU/OCFAhFL+KOBVVkNRJbkpGVjrYycIFQvSY6usiN+HTFnXb8 jchVcdubuLShnX0zg3hSI9BVNF+2zHSC0+9GNJwQqqcD/wFMsSX1p9pH5Ah3IKsRDXu0 HCyPeG2gSXFn7g0q9u2QdAxphU/44euf3e0i/rfDM0kxLTCJDUmcWutuzpsclFKkie/B xouQ== X-Gm-Message-State: AODbwcAhptrjsagTBXuGRrYnp91Zgqu5BOq7kutWYHVkR+WNhs6INrDu 6CCMQJi/qpNeo2Hezoxq3w== X-Received: by 10.84.216.84 with SMTP id f20mr20508280plj.177.1496743478311; Tue, 06 Jun 2017 03:04:38 -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 v3sm3544867pfi.3.2017.06.06.03.04.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Jun 2017 03:04:37 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Tue, 6 Jun 2017 15:34:33 +0530 Message-Id: <1496743473-15987-1-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 11/14 v4] 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 --- Changes since v3: - The changes in xenconsole have been split into four patches. This is the fourth patch. - The vuart console support is added under CONFIG_VUART_CONSOLE option. tools/console/Makefile | 3 ++- tools/console/daemon/io.c | 26 +++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/tools/console/Makefile b/tools/console/Makefile index c8b0300..fcee313 100644 --- a/tools/console/Makefile +++ b/tools/console/Makefile @@ -11,6 +11,7 @@ LDLIBS += $(SOCKET_LIBS) LDLIBS_xenconsoled += $(UTIL_LIBS) LDLIBS_xenconsoled += -lrt +VUART_CFLAGS-$(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) $(VUART_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 db73e10..cae2efe 100644 --- a/tools/console/daemon/io.c +++ b/tools/console/daemon/io.c @@ -104,12 +104,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[] = { @@ -118,7 +122,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)) @@ -665,7 +680,12 @@ static int console_create_ring(struct console *con) "port", "%i", &remote_port, NULL); if (err) + { + /* If the console is optional then do not return an error. */ + if (con->optional) + err = 0; goto out; + } snprintf(path, sizeof(path), "%s/type", con->xspath); type = xs_read(xs, XBT_NULL, path, NULL); @@ -679,7 +699,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, @@ -789,6 +811,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; con->xsname = (*con_data)->xsname; con->xspath = xs_get_domain_path(xs, dom->domid); s = realloc(con->xspath, strlen(con->xspath) +