From patchwork Mon Aug 7 08:53:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 109536 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp2482088obb; Mon, 7 Aug 2017 01:56:00 -0700 (PDT) X-Received: by 10.107.12.70 with SMTP id w67mr11900449ioi.295.1502096160741; Mon, 07 Aug 2017 01:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1502096160; cv=none; d=google.com; s=arc-20160816; b=iKYVHMtdtYT1XOPTYl/JlXsxjfsUPT9K35YgF5TGugYR/J8USgXedsz7tKau9oGxvq y1ubfCD/u/+9gooXKLKK5ZRwUYCLihKvl5xd/MV/RkCnXsxbombX+eUmph9SS8xtyxsB /2UiMiaVEAichK1fDVM4YFvGuFf9h/3NNyoCmysd6pPvZGsetsSjo7gqXjz30dvqq2Ek S1G9UE3FQYPAq9m69Pdc5EBh4SBAC23VCnSevXQQn0VtyWJsPzl0Ej7+i96ICQDoxNS+ kmoZvjNK7bSgKBFw+yv7Pj6fB+mJ7mZSk8yyLI3kerENrGreOSHxPvS+qm9mT1USfpZC HV5Q== 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=dFaAVEtC/wucdnrx770nGZm5d1Bc8+DQY2pmCpzvj3I=; b=E1qy+dKyU1YshRem7WsL++HFbQOOJ6lRbHThWpYDXJglEAju83Nu+a0rzL+Wc3dR3L y1f1NrFLos+Cv0TWpq6IU4cxoPe1E6KvEy6HHAz6heg/tAQLcwSJYFwifVjLOmrSrbv4 UTwufD54JuY5EYGyKnY+5M7Ae8/lx3cA96ySvUpef3H6OETqzP3ooNvqh4wj26x4f8t5 Mo/WVWXeIxgbgMpp8jnFAL685NydgALlvYaf+4M6c7x+GeZU/32GKPJJZYbRR7oHGALK 8OAQUC3E4aRxNPvl+wWQVVKthST7PzxJ5SKrEalRzNdVLEneTgkKK0SFqYyShfBzvG7V G10g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=EdBJA43H; 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 f63si7746353ith.203.2017.08.07.01.56.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Aug 2017 01:56:00 -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=EdBJA43H; 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 1dedo6-0005Nv-Qq; Mon, 07 Aug 2017 08:54:38 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dedo5-0005L8-VO for xen-devel@lists.xenproject.org; Mon, 07 Aug 2017 08:54:38 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id AC/50-03044-DCA28895; Mon, 07 Aug 2017 08:54:37 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAIsWRWlGSWpSXmKPExsXiVRtsrHtGqyP S4NE2dYvvWyYzOTB6HP5whSWAMYo1My8pvyKBNWPvux7GgiUqFT+7PzA2MF6S62Lk5BASmMEo cfKzeBcjFweLwDxmif3T3zGDJCQE+lkl2i5rdDFyANlpElf3akCEKyTudqxghujVkjh6ajYrS K+QQBuTxK8z7xhB6tkETCRmdUiA1IgIKEncWzWZCaSGWeA5k8ShCV/BmoUFwiT2f3rJCGKzCK hK/Hx9iQ3E5hXwkXjQt5AVYpmcxM1znWD1nEDx85fesEAs9pa4fayPcQKjwAJGhlWMGsWpRWW pRbqGBnpJRZnpGSW5iZk5QJ6ZXm5qcXFiempOYlKxXnJ+7iZGYFgxAMEOxuPv4w4xSnIwKYny xq9oixTiS8pPqcxILM6ILyrNSS0+xCjDwaEkwftIoyNSSLAoNT21Ii0zBxjgMGkJDh4lEd4X6 kBp3uKCxNzizHSI1ClGe44Nq9d/YeKYdGA7kDww4+c3Jo5XE/5/YxJiycvPS5US583RBGoTAG nLKM2DGwqLyEuMslLCvIxAZwrxFKQW5WaWoMq/YhTnYFQS5g0DmcKTmVcCt/sV0FlMQGe9SWw FOaskESEl1cBYN+HK7iUXw232/d7ufzX6t9a1VT8KfL9HbV17t6A5aPFNE5a5/Pxp8YFfo79I 6XeLekzI/Per0Uv/fdPKpOKUffmOfZ2Hvr1aHbqS+b7e8qlKNb4+GyfaJPz9u5d3QoHdb7O2T 63xFQ9nzz75b8v1xtgrBeu2flSIvb8n/07H0Yw38TtvLq27oMRSnJFoqMVcVJwIAB8t4qzDAg AA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-12.tower-21.messagelabs.com!1502096075!76733911!1 X-Originating-IP: [74.125.83.51] 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 13581 invoked from network); 7 Aug 2017 08:54:36 -0000 Received: from mail-pg0-f51.google.com (HELO mail-pg0-f51.google.com) (74.125.83.51) by server-12.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 7 Aug 2017 08:54:36 -0000 Received: by mail-pg0-f51.google.com with SMTP id v77so31642673pgb.3 for ; Mon, 07 Aug 2017 01:54:36 -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=zVH6KyQrrz8OkJqrrrsR5qmT1qXgUwYYk2D0Hy3dshM=; b=EdBJA43HiUIDZTVGa6HOmrsdi9KAnoOUMf5g8RwttHtXv/EmWqhPST+PLIBlZQrUBL iHOkfPIUbYeK9DGZyutkYmpV+hTuqIA5o1qv/uCYdnDXkaY8R+pnsgibT1wi1khidtZm IA/ESfnX5mYf3tUnQffbgDvJs79znKScYp+8k= 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=zVH6KyQrrz8OkJqrrrsR5qmT1qXgUwYYk2D0Hy3dshM=; b=EjAcCEz/l0drKHD31JenDW+jfh5Lau7K9nXjEzsuVI6dIjc1IaTo9h53+49q0nSd10 PYNR+M3Yj+ZNolrlLTutfwmwCKq9WcjS+sFJJRFokjymo1I2RVzWFSSnDxJBkIWt7sp0 2r1vKrC8HE+vOIBgk9Dp+0bvQzjYcDv/H8V76yCo2FHhaBPMYgXkmPIwqvA9AJ0hFMjX 00abhXAbjMPNAZCqOas5AcTc6G9xTq3rnPMqPdhOjAI/dqkOo1ioiWhVz4m8lJ9xN+Tg cN5v9lT20lOnrX4CksO7Y+vfmTe7h3LTVu27NYC2v046mOSK8D2x7eA5hkqR1UZawVsM E18Q== X-Gm-Message-State: AHYfb5jX20q+ImOQ88A7VXbAFd0kheh6q+B7Z3te90rGqC1piy4trXqi lBFsO4U/gPw3bo5K70uojA== X-Received: by 10.98.150.75 with SMTP id c72mr4251535pfe.58.1502096074787; Mon, 07 Aug 2017 01:54:34 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id p77sm12604047pfi.153.2017.08.07.01.54.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Aug 2017 01:54:34 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 7 Aug 2017 14:23:14 +0530 Message-Id: <1502095997-31219-23-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1502095997-31219-1-git-send-email-bhupinder.thakur@linaro.org> References: <1502095997-31219-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Stefano Stabellini , Wei Liu , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich Subject: [Xen-devel] [PATCH 22/25 v7] 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. Signed-off-by: Bhupinder Thakur Acked-by: Wei Liu --- CC: Andrew Cooper CC: George Dunlap CC: Ian Jackson CC: Jan Beulich CC: Konrad Rzeszutek Wilk CC: Stefano Stabellini CC: Tim Deegan CC: Wei Liu CC: Julien Grall 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. config/arm32.mk | 1 + config/arm64.mk | 1 + tools/console/Makefile | 3 ++- tools/console/daemon/io.c | 32 ++++++++++++++++++++++++++++++-- 4 files changed, 34 insertions(+), 3 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 abe77b2..e7ff8ff 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 067eeb5..2817a49 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_data { char *xsname; char *ttyname; char *log_suffix; + bool optional; + bool use_gnttab; }; static struct console_data console_data[] = { @@ -120,7 +124,18 @@ static struct console_data console_data[] = { .xsname = "/console", .ttyname = "tty", .log_suffix = "", + .optional = false, + .use_gnttab = true, }, +#if defined(CONFIG_VUART_CONSOLE) + { + .xsname = "/vuart/0", + .ttyname = "tty", + .log_suffix = "-vuart0", + .optional = true, + .use_gnttab = false, + }, +#endif }; #define MAX_CONSOLE (sizeof(console_data)/sizeof(struct console_data)) @@ -650,8 +665,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); @@ -665,7 +689,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->use_gnttab) { /* Prefer using grant table */ con->interface = xengnttab_map_grant_ref(xgt_handle, dom->domid, GNTTAB_RESERVED_CONSOLE, @@ -784,6 +810,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->use_gnttab = (*con_data)->use_gnttab; xsname = (char *)(*con_data)->xsname; xspath = xs_get_domain_path(xs, dom->domid); s = realloc(xspath, strlen(xspath) +