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: 9844927 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E799560393 for ; Mon, 17 Jul 2017 13:09:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DA21126E4A for ; Mon, 17 Jul 2017 13:09:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF16528505; Mon, 17 Jul 2017 13:09:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6037728464 for ; Mon, 17 Jul 2017 13:09:43 +0000 (UTC) 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" X-Virus-Scanned: ClamAV using ClamSMTP 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,