From patchwork Mon Aug 28 08:56:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 111126 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp4548240qge; Mon, 28 Aug 2017 01:59:01 -0700 (PDT) X-Received: by 10.107.59.22 with SMTP id i22mr5454568ioa.59.1503910741819; Mon, 28 Aug 2017 01:59:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503910741; cv=none; d=google.com; s=arc-20160816; b=SiWCc42/EqibAPOnD40UKiCPeMfTv42Fj7yoo4hBFixQEGp8StmYSxiKl/CjLQOkWM kLBKfS2A4KNkUAxx+xxJPlGDIuLlvrcQFlFZDwt91SdfNCUqYiaP2WgV4YR7HycPXVBr KbgzOdnqDxqffs5BUPvBmWpXT/+FQbfUF5j5w0boDZDwoXEqfNJHd+48uo9oM1gsHkEG cRQq8Pv5AupXYpp1hT7X+4uVOeAxdzEGOty2O/lGoy0yJnJGnpMBchqExlvctqROs/ip kdfA6lMWT5B0d/u87R8H1A2pwHxJmkid2Abw1mNUpafDCF7pymyMyA7nbQxR5Lx3K4FZ YUPQ== 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=Trv1/zx6YeF/sP+fhifQcUyBhunmFBT3EKtTWs/eid8=; b=Lyd52NkhMMrpH/pt1o3z/2c8s/fnlbPMyi9bm9W2hBnL+syKqbZZgNJTzl6uKu9ryz k910ofMCuIaiwEXk/3IqOyBTH06CH9pmvltvNoOA37gsAxZw87rJ0qdGpyTf7lowJm2u zke7WYqObKWA1TQAevxXbhoVZBN9GrNrMizWi6/vjsepG65FyoOr0mlhselab12bBXw+ xc1UyHqRw0t4qAl7zOBRM8xecjj0AhPzgVCgk7NxN84dDzqMhg9ar+g+zdGf9E9LO8M+ 4D/UuhO+9wjgOFQ+8sJHsWvj8aIMnT4alfuTbE/iqVYAIqKgOUaRKHaqipWxAPMpb69B 5cBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=KxTZJR8t; 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 r82si7511879itr.70.2017.08.28.01.59.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Aug 2017 01:59:01 -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=KxTZJR8t; 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 1dmFrS-0005m3-Mr; Mon, 28 Aug 2017 08:57:34 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dmFrR-0005jh-D2 for xen-devel@lists.xenproject.org; Mon, 28 Aug 2017 08:57:33 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id FB/F7-03406-CFAD3A95; Mon, 28 Aug 2017 08:57:32 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrDIsWRWlGSWpSXmKPExsXiVRtspvvn1uJ Ig5OHuCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oylT38yFRxWqTj2ayNjA+N3uS5GLg4hgZmM EjsXr2cBcVgE5jFLbGs6B+ZICPSzSpx7fZWti5ETyEmT2HvlPiOEXSZx/f0eJhBbSEBL4uip2 awQo/YzSfRMuwzkcHCwCZhIzOqQAKkREVCSuLdqMhNIDbPAcyaJQxO+MoMkhAXCJLav284CYr MIqEq8/tHIDNLLK+Ajsft9GMQuOYmb5zrByjmBwjvW3mWH2Ost0fX6A+sERoEFjAyrGDWKU4v KUot0jUz1kooy0zNKchMzc3QNDcz0clOLixPTU3MSk4r1kvNzNzECQ4sBCHYwrloQeIhRkoNJ SZR3Z8XiSCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvGduAuUEi1LTUyvSMnOAQQ6TluDgURLh/ QCS5i0uSMwtzkyHSJ1itOTYsHr9FyaOSQe2A8kDM35+YxJiycvPS5US5/UBaRAAacgozYMbB4 vES4yyUsK8jEAHCvEUpBblZpagyr9iFOdgVBLm/QsyhSczrwRu6yugg5iADlIUXAhyUEkiQkq qgVF90/Kf666I2hYHOlybs3yVr4SZrV3VJL+gmHA7hQPuZ86vEFsjfovlrrid0OtdM27bpbJe 9PgplmvJG1VhEPHGuaGurPi4t9DWix4VtkIBG78Krar47LpfYm3YKeMFFscnGr4531baJjh3u /yd+VK9dqJ/crwNboic1qpPsamJ5+L50vDkqhJLcUaioRZzUXEiACloLlW/AgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-16.tower-21.messagelabs.com!1503910650!67906207!1 X-Originating-IP: [74.125.83.54] 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 23056 invoked from network); 28 Aug 2017 08:57:31 -0000 Received: from mail-pg0-f54.google.com (HELO mail-pg0-f54.google.com) (74.125.83.54) by server-16.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 28 Aug 2017 08:57:31 -0000 Received: by mail-pg0-f54.google.com with SMTP id r133so22216439pgr.3 for ; Mon, 28 Aug 2017 01:57:31 -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=iToIwGqkOk3EV+/SAzPt8OcAvVkxtUVktVFs4rj+kJc=; b=KxTZJR8tqjOGNK4G4BoOdw5njq4lVRpJbeUoCIZGhVOxgHKFbFJrJqWV6e8VXghaet UqsPGHQKoS1vEU4OYe1dFlg0xm7O1Meh40PTg3jVJek3rpT+ecD3m/8pdN4sHqF5ukfh C/n97BF8Klg6gauVkyS6bYTa24begZRaR6DJo= 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=iToIwGqkOk3EV+/SAzPt8OcAvVkxtUVktVFs4rj+kJc=; b=Umy+8fMbttTQQ0c77cvI9eIVkUeaSWFcqb2Rq8muYjFhzLpA2ZpjGMadVpDG3FXqOQ z1xKgXhLSy3drsNya0j5OmXKsTKV9K5XeBji24+996i6iXnuDX3N8KGBfYUOZz9fFv+L Y0eC2L6wh1K5Iid3fBhCHpDrCLwcSowrX8HM6r8RwXTceEzAXqfhv1h3h9KV15b2U1CG 0b7qSSTIXOjKdZjeHI7enKy+NHJX+A3Ik+By+UK32gdR68UeB6uHP+EnG3NMaQ3e55F5 FFnc1a5ZUtS2Sbum4Uq4i4ul7lpraqsIWG4sqW1Ap267wKHsM1rV3gLlbnkdTntu3QLW r+LQ== X-Gm-Message-State: AHYfb5g0UCIFoftl7xPMGD9+27WhqJIBd0Hpyf/AI21VOFJfBhygv2TZ ++MLbKFUTpLKPFMyrDt5Hw== X-Received: by 10.99.96.1 with SMTP id u1mr5205266pgb.121.1503910650305; Mon, 28 Aug 2017 01:57:30 -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 d88sm21713569pfl.158.2017.08.28.01.57.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 28 Aug 2017 01:57:29 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 28 Aug 2017 14:26:05 +0530 Message-Id: <1503910570-24427-23-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503910570-24427-1-git-send-email-bhupinder.thakur@linaro.org> References: <1503910570-24427-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/27 v8] 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 | 30 ++++++++++++++++++++++++++++-- 4 files changed, 32 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 a198dbb..90aea8a 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_VUART_CONSOLE) + { + .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) +