From patchwork Mon Jul 17 13:06:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 107941 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp4495076qge; Mon, 17 Jul 2017 06:09:25 -0700 (PDT) X-Received: by 10.107.142.134 with SMTP id q128mr21313771iod.100.1500296965443; Mon, 17 Jul 2017 06:09:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500296965; cv=none; d=google.com; s=arc-20160816; b=fAFOMqPGDXAPcqbmPSUDwiXPJocjURFmmGeTJUrD9iwRpsI+notYw9btwHD88kUtDK Aypz4/oRcP93K9YRf9zngMpNbC53hv+ooG/MhFqIyxLh7NqZcHPP5xIbc0FeaBfAbJ3r WpvsKjuYzXi9U4yE8rHYCLJFjFuhNBjM9dqTsFpW5MfweFZdpw84iHdoAzrPwEKN/kQS ilr4gHPeEv1Pjt8pWmYrVfwNj0aSYYIaxOUISEJUIUk8n0Ev9YBdRSS+PPKhBQO+/M3t UMnEEcW0r5hymgW7PsS8u8S3aH+3U8y37HILo5nBfIkn2cILohg9z3/98zV2A8r/TPW1 Aexw== 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=exgRzTz/ntV7+EJi5PhCoWo0J0//TiFr5TjYCcPyf1o=; b=Uu5uRKVSpccz1hfm5ibVDjI8hIPkbg2E1A2hVyo8hudVCSSpSTVxwRhM/INR4ZuJz+ jTy2ubteHIK4Z/uAwYhfUf3t9b80ua1LL+omnfxUsDggNKRbgE7wqS+fGd53MSG4Udyn laY48aJNK6d2GGshNYLEuILB4WB5b7k34ibaEINKIEgAg224HCdMXdlnBNJsXZKHxP4d Fh65vhs17gH1N65zyWX1h5596pFyEI5BRDDEf3qZjej8S5ouw5v4o89bknuxzvdu7GP9 qnGFG3UId+FesICMtIZ8C/gDZwzWenUuj52iYdCa4C3D+OmRl4mbh9ERLpUMJ3v22+s+ 2veQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.b=Le0brRSc; 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 c3si17683343iof.196.2017.07.17.06.09.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jul 2017 06:09:25 -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=Le0brRSc; 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 1dX5kz-00059z-E4; Mon, 17 Jul 2017 13:08:13 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dX5ky-00057l-5R for xen-devel@lists.xenproject.org; Mon, 17 Jul 2017 13:08:12 +0000 Received: from [85.158.137.68] by server-14.bemta-3.messagelabs.com id 63/58-01862-BB6BC695; Mon, 17 Jul 2017 13:08:11 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrIIsWRWlGSWpSXmKPExsXiVRusrbtzW06 kwdJJZhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8aHBwvZC9bIV0y5doCtgXG1VBcjJ4eQwAxG if7bsV2MXBwsAvOYJc5/e8oKkpAQ6GeVmHBZBMJOk9h6aD0zhF0p8eLTb3aIZi2Jo6dms4I0C wm0MkmcfLWTpYuRg4NNwERiVocESI2IgJLEvVWTmUBqmAXmM0o0TeplA0kIC4RJtPz5CWazCK hKXL2zhAXE5hXwkbh9op8FYpmcxM1znWCLOYHiZzasZoJY7C1x88hEpgmMAgsYGVYxahSnFpW lFukaGuglFWWmZ5TkJmbmAHnGermpxcWJ6ak5iUnFesn5uZsYgYFVz8DAuINxW5fzIUZJDiYl Ud6LbNmRQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4N2/NiRQSLEpNT61Iy8wBhjhMWoKDR0mEd ytImre4IDG3ODMdInWK0Z5jw+r1X5g4Jh3YDiQPzPj5jYnj1YT/35iEWPLy81KlxHlXgLQJgL RllObBDYXF5CVGWSlhXkYGBgYhnoLUotzMElT5V4ziHIxKwrzLQabwZOaVwO1+BXQWE9BZwr5 gZ5UkIqSkGhhljYScV7LH79l6IvH0ox2T854UJvVtk6rjtz09WalIwWK+cDGDbXjRJ53rUVX1 uuoOhc5blr0QmHHcsHJ5bO2uyTlfs42PlHeX23zWV9K8bvjcr9CsTeuMC9//NAH/8Cr7PZX10 ev8Jpp/CZX5yXrk65MpsR4qmW8ll169t7Z0u82B/KcKZUosxRmJhlrMRcWJAC0Jfx7EAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-9.tower-31.messagelabs.com!1500296888!50324038!1 X-Originating-IP: [74.125.83.43] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.25; banners=-,-,- X-VirusChecked: Checked Received: (qmail 19851 invoked from network); 17 Jul 2017 13:08:09 -0000 Received: from mail-pg0-f43.google.com (HELO mail-pg0-f43.google.com) (74.125.83.43) by server-9.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 17 Jul 2017 13:08:09 -0000 Received: by mail-pg0-f43.google.com with SMTP id k14so79617024pgr.0 for ; Mon, 17 Jul 2017 06:08:09 -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=N6sVxicO5qTH+BZf2uWHkrAr++66JtvflVzqa+gSOOs=; b=Le0brRScJG/7BMCi2GY9M73CMrJmmEFVoT0x/wubDOKZJsMVVmAGnjZQpmIj4f/IVG 5MBprd4w85hIUxdoB0lLiiyUcNtX7YhWaoEkZhT+yXZTX18w8nx5FyrfpuEWl47wOLX+ DeOcjE9a9Wn74/Qlr6M3phh2xpm2pFGksGVOY= 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=N6sVxicO5qTH+BZf2uWHkrAr++66JtvflVzqa+gSOOs=; b=dEgVEhOnMxjqChAiTO50ogKxsT/5WLmMRPPMCAnzEn9Y7ldYVlT0C+xj9c/cQxvIHL EQgAj9v5hlIiKmTxbaJeq3fuA1Iv3qSpZPGUOFwpUR5iWls/cI5iiDoURhG2vV5vS6IA h6wxWhGJHbe/qhpO+VbY+HeQ9bp+kBDa5yZz6YPPoRpuvmrEoGXjKGL4chLT049IUAPG /M9MiXZ+iA0VXo6YxRh4zVAAFjbX/fhc7UY60KOO2vyG86iwKN4FXBo9kpsaA/GA0EyU G+ArejkcOYl0XxgmYXsPaiEdBnk5P78N+VUkwihv7IIcZs7NpDm1vhVr+dtX5+8KR3ri BWJw== X-Gm-Message-State: AIVw113fflk09QHeHDeFentFLd/WqTHy4zhk0wILE3Cd6vrIsp64b23Y FnvuwOm+HPBcqvLZi4zHGA== X-Received: by 10.98.64.129 with SMTP id f1mr18802954pfd.225.1500296888185; Mon, 17 Jul 2017 06:08:08 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id z69sm15705665pgz.42.2017.07.17.06.08.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Jul 2017 06:08:07 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 17 Jul 2017 18:36:52 +0530 Message-Id: <1500296815-10243-23-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1500296815-10243-1-git-send-email-bhupinder.thakur@linaro.org> References: <1500296815-10243-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 22/25 v6] 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 - prefer_gnttab optional flag tells whether the console is optional. prefer_gnttab tells whether the ring buffer should be allocated using grant table. 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 | 29 ++++++++++++++++++++++++++++- 4 files changed, 32 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 49f085c..c6d4cae 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 { const char *const xsname; const char *const ttyname; const char *const log_suffix; + bool optional; + bool prefer_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, + .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,