From patchwork Fri Sep 22 08:23:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113979 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011093qgf; Fri, 22 Sep 2017 01:26:03 -0700 (PDT) X-Received: by 10.107.78.25 with SMTP id c25mr6101394iob.25.1506068763336; Fri, 22 Sep 2017 01:26:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068763; cv=none; d=google.com; s=arc-20160816; b=wJgU/D3ila9WzpKKo+j1/MtLEa7aLEI9JNVkuqJ6hxrKifFLM2TiIjnJW12lBl5u7y axVSWBjqQdgDVrVoDlivmJPAAVf6EukM44dTGZN1NZlH/MTSCp+xeO5hYvP8FcdhU/te iUYuoUMjU17lsKceKzNolnUlEKtpauwRAmYTGWoTIez/YPzgPaFDediujaLeet62HqCw 9gkUcS6kkQZdiDLaKifnAEFH6ao7vjYo5CE8WTJpvlYjl+lTrImQ03c73Dtcb1mp8r11 ojvuL65jCfCFh4OHSjXuEGZfYfz5DOIhWAj4rxd7hXqMNjaqxmk9a9iwtdDqfZMLht3I 5EVQ== 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=LWmfCKKXLJy9RLlSvV51TyA5SpPEbDbqTrrBtjHkWXbh0ONKWsdq4ZdrzyBh2+cuZJ rza+bkGPTfD8uiayYVlp1sQNA6my/ifON7Fi2TfhCfIMTtAtCy/1bUSa0lrfapnaPnyt Y5o85+rHUwJ33s27Bu8BxvCSP48a7h4/OknRpRTRQKvuz6prFQ97eoSn7iy1O7EVKKVP ZjDgXNhOIJ6Y1lepDaQEcHg7qxmyFvk+RKfnBTFNcWNk25RZLtETBw3tcFsAqUwFlRmY xE9JNWT5aMCXSo0KII1VaXS8jOV8hJijBOlooCgAYb4EK00MmQdWx3Z6VE164gRWPYZf UxPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=I+tvJPPN; 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 s19si2990743ioa.220.2017.09.22.01.26.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26:03 -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=I+tvJPPN; 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 1dvJGO-0004f7-NC; Fri, 22 Sep 2017 08:24:44 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJGM-0004bs-Qc for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:24:42 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id 68/DD-03422-AC8C4C95; Fri, 22 Sep 2017 08:24:42 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrLIsWRWlGSWpSXmKPExsVyMfTAat0TJ45 EGixdLmPxfctkJgdGj8MfrrAEMEaxZuYl5VcksGZ8OLeereC/fMWkZ8tZGxi7pLsYuTiEBGYw SjQu/M0G4rAIzGOW6L58iRHEkRDoZ5XY+6eNuYuRE8jJk7j8fycbhJ0mcePHDKA4B5BdLfFyY gpIWEhAS+LoqdmsEFN3MEn0LDvJCFLDJmAiMatDAqRGREBJ4t6qyUwgNcwC8xkl/v+8xQKSEB YIl/g++QSYzSKgKvHmzwl2kF5eAR+JPZtMIdbKSdw81wl2DidQeO3/DSwQe70ltt64yjKBUXA BI8MqRo3i1KKy1CJdIwu9pKLM9IyS3MTMHF1DAzO93NTi4sT01JzEpGK95PzcTYzAgGMAgh2M 59cGHmKU5GBSEuV9fORIpBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3u/HgXKCRanpqRVpmTnA0 IdJS3DwKInw8gLDX4i3uCAxtzgzHSJ1itGe48KdS3+YOI5tugwkD+y5BSQ7bt79wyTEkpefly olzisK0iYA0pZRmgc3FBarlxhlpYR5GYHOFOIpSC3KzSxBlX/FKM7BqCTMKwgyhSczrwRu9yu gs5iAzipfDXZWSSJCSqqBMbHyVm1R8rKZDxcpdrd3a+y8nHalhic7Xbb2ge+zbo25X5bNbnye Ic4lfGFqcUqHSnq16rHnKq+nTTkZtdjFsXNWYd6VppZQnj8/Hj7snqLrqDdP+/sEo4X39p36u yzX5/au0988xYNWPymQObHm1bPvapqi7HODT6Wcm1J5fLKGv/p3oUun+5VYijMSDbWYi4oTAS G/MIrQAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-8.tower-21.messagelabs.com!1506068679!83979000!1 X-Originating-IP: [209.85.192.171] 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 6240 invoked from network); 22 Sep 2017 08:24:40 -0000 Received: from mail-pf0-f171.google.com (HELO mail-pf0-f171.google.com) (209.85.192.171) by server-8.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:24:40 -0000 Received: by mail-pf0-f171.google.com with SMTP id g65so229185pfe.13 for ; Fri, 22 Sep 2017 01:24:40 -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=I+tvJPPNiwT0XpXbZiQCda2bxiVogLFEW3DF7A0a5qawXn4NTyUmXy7xnT3IOqq5TB wsWnZa220ErfcCqogADao9aWNxX6/09v5TRQklwVWXSptYQIke+aYDf9sXIyAlkeuD9n whG2HQ3O6AdEbRt9YlfTQvmlHybBkT+AnPJAk= 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=onRxO4FA/luEWBX5OkOE/NbC+lqCSouvnh2FB+lkLRYXq059JDJiUkAjh4msSWm8dx WJkMUrky8eX+ubW/yBih4GiAyMrRaCgrKu1gRZ8Pg2ocPmYWWygh0ZdU0TXb5ttDOjg4 RCtFGJfsJ05fmW+Q7vL9gmEhQFR9o5pOITxpwfBhrAZiPHzTqRe79i7/H8HH8adxET/G JdVhzbfe8uEL3wPPC4uLvbbxyXM3h+UHNBbXxy69n1ddZvIjuMhkKQH6BviE6XVJNP9J UsWNyDVtYYfWriM5ea7+v/UhKOTvz+662eHQ8p6NeHwZPUepwxee9rpwlCvzoEsCMOcP 7/9Q== X-Gm-Message-State: AHPjjUjHUZ8a8m9IMO3+rT/pFZw77CLjD3Ur+2X9DjVwDRqvXh3+6Q6J 57x2i0oUJkhfPNLsbm7OnvvIlmXo96U= X-Google-Smtp-Source: AOwi7QBUwZcr/z2rhSTojoCerDum2ul/4pLFj1Q7ESdnRPcy7LgMknDbRD4i0bQsq0L2SEn52+4OUg== X-Received: by 10.159.253.148 with SMTP id q20mr8234507pls.308.1506068678684; Fri, 22 Sep 2017 01:24:38 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id f74sm5569284pfa.36.2017.09.22.01.24.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:24:38 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:21 +0530 Message-Id: <1506068606-17066-23-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 22/27 v10] 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) +