From patchwork Tue Jun 6 10:03:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 103147 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp1185887obh; Tue, 6 Jun 2017 03:05:23 -0700 (PDT) X-Received: by 10.36.178.83 with SMTP id h19mr9827381iti.120.1496743523855; Tue, 06 Jun 2017 03:05:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496743523; cv=none; d=google.com; s=arc-20160816; b=UCDbWN/C+hulScGe4zvfQp9zY+McIXfLQ5w+KLTvzQGqtis5Z/Q6SxFVqE24YsUj93 5c8VUKVhaeQ92INuHSwBXnLcINt56jJ2dzuN2YHgzZs5sYqY1l7HJKqjGjE9HVU1bzQc kCvoC9c8zyhcEMumi8F+TrkD9G1ezMOjvOXHK+DUIyN9a+Nc3pjpkXDqJE0zfTMJqwil eg4/H4oj4xTpW9VqvG0yCK5iD28tDxgDrslrciC0KwpCygiH1l4DWCQ38N9Pj6TQvB+9 0LDJZ6MazQis/uRUoDFMmD1qUtp1RXXz1F4YimjOjD9h1jWlmZyXbczeDVxoU4Q5RAut SjrQ== 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:message-id:date:to:from:dkim-signature :arc-authentication-results; bh=23JfM2gmclu2DnfgXXIS48L8dg+aoAL5O5l89YT/9/4=; b=dgsJeZHtk4HRqLjeI9yfPNCUZ9Sr/raIOouw0epXjgKlT9NzdAOVwrljuoHtCMCNQW 9dNzXzO+yPhApCoklpc5f8FHmBOosiv4X5kFn17KvKp1qqjykekgjGF/URCFETpmXwV3 u1/h/+yLbUmMU/U4xCHtoP1QEqmpBIq6xF/eYu5s3akPnxNjgGH/igw+MUdyL0ZDNDes lLrikshUsvVcL4ER/hLZzLw0cOLXYwran1rRUsPQSFZV/PzDlxXPTFlMstksdHMUwDN1 x6qT5QS+tEcFjulbpl8s53UpQlVBW1gRwCU3M3cxakiSaBYCYrJchzDpqqPLfwgZPSUY BFLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; 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 z125si39254513ioz.143.2017.06.06.03.05.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Jun 2017 03:05:23 -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; 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 1dIBKh-0003fI-W3; Tue, 06 Jun 2017 10:03:27 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIBKg-0003ew-Jy for xen-devel@lists.xenproject.org; Tue, 06 Jun 2017 10:03:26 +0000 Received: from [85.158.137.68] by server-7.bemta-3.messagelabs.com id C8/13-02196-DED76395; Tue, 06 Jun 2017 10:03:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprEIsWRWlGSWpSXmKPExsVyMfTAGt23tWa RBgf7uSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1ow93VwFt80qpl5ZyN7AeF67i5GLQ0hgJqPE zktP2UEcFoF2Zol/zw+zgTgSAu9YJI4eawJyOIGcNIlXfT9YIewqid6OB8wgtpCAlsTRU7NZI ex9TBIdDxK7GDk42ARMJGZ1SICERQSUJO6tmswEMpNZYD6jRNOkXrCZwgKeEitb37KC1LMIqE ps3VUEEuYV8JZ4/vIlC8QqOYmb5zqZJzDyLWBkWMWoUZxaVJZapGtoqJdUlJmeUZKbmJmja2h grJebWlycmJ6ak5hUrJecn7uJERgmDECwg3H1b6dDjJIcTEqivLUJZpFCfEn5KZUZicUZ8UWl OanFhxhlODiUJHh5a4BygkWp6akVaZk5wICFSUtw8CiJ8CpXAqV5iwsSc4sz0yFSpxgtOa5cW feFiWPD6vVAcsqB7V+YhFjy8vNSpcR5J4DMEwBpyCjNgxsHi6pLjLJSwryMQAcK8RSkFuVmlq DKv2IU52BUEubtrwaawpOZVwK39RXQQUxAB/FdMgE5qCQRISXVwDihOW3VW4Osa8/3R/06LvT BK6fRvHFh30wOU47cKdc+iQTdfndAhjvNPcr3jYFeWs6PD0mH2hj2rpyj6FnWUcR2kcvY8rAk y+pzWnOr6n7+29FU+0XY7MCKX3LVfH+dDFMzN294n3Hx2sK/rwoXeOzdbul+6twno8vyOc8cj kfGTnDitPG32azEUpyRaKjFXFScCACH6TpWpQIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-9.tower-31.messagelabs.com!1496743403!48788739!1 X-Originating-IP: [209.85.192.172] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 40386 invoked from network); 6 Jun 2017 10:03:24 -0000 Received: from mail-pf0-f172.google.com (HELO mail-pf0-f172.google.com) (209.85.192.172) by server-9.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 6 Jun 2017 10:03:24 -0000 Received: by mail-pf0-f172.google.com with SMTP id l89so21922322pfi.2 for ; Tue, 06 Jun 2017 03:03:24 -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; bh=b/gth2k6evb12i43AE3IAGcmBXXDkfcHIRXXR9CFkeo=; b=Iuog7QPU1iaVcPKGK6fPVxxhYCkNqIt40UyaGRoJgas3mAp/P01rfQAahGVw3zEUIB DxKKdAuu5CiDRvquaz5bBXQDwuNFV4y7oqmCrsuTNRrQ/LsncShqWelO7dDzC+/gkoWI RQ2cK3ElXlUX/k9YhAD5Rd4xTgaS0eSCgxACo= 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; bh=b/gth2k6evb12i43AE3IAGcmBXXDkfcHIRXXR9CFkeo=; b=DRZkMOz5IM64WzEH26L2ruB3K/xG0yFLMhdQjcmtIkznYrWPDlVoP3PEGA8QrI4wHS WLgiF74MLHy6T6hEhZu7ujWqmiwq/d2lGfxZaFuydEdQ9NQr5IzkL90SUluPr2fFgYq2 W6d2b3BYygxMb+14d9yg1+menW4uI8dpVb5vgZK/1sxN0Sm6co1Myb0rsDdSUwpeYsta q3vW5532C8OoJp+bCt1h419rD3oMQQCJcTneTmUrYcv5L7v+EsqtdQsCLkLxp01xnCnT 9UUq/JJDkTV4o4eNHNJ2iiIjxlxSsV+xYyP4P4usoxmB6XGUMrUNZAbWaIjgexUyEZrp T7IA== X-Gm-Message-State: AODbwcAXaCp7XM77S80sJ02GeoIfu5yhIliFzTdeEUGhtPIRmH/Kk7OD Cx284rqGmPPnPxi2vMz7Ag== X-Received: by 10.98.150.12 with SMTP id c12mr24569196pfe.201.1496743403221; Tue, 06 Jun 2017 03:03:23 -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 v64sm64761692pfk.86.2017.06.06.03.03.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Jun 2017 03:03:22 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Tue, 6 Jun 2017 15:33:17 +0530 Message-Id: <1496743397-15632-1-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 04/14 v4] xen/arm: vpl011: Add support for vuart in libxl 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" An option is provided in libxl to enable/disable pl011 vuart while creating a guest domain. Libxl now suppots a generic vuart console and pl011 is a specific type. In future support can be added for multiple vuart of different types. User can enable pl011 vuart by adding the following line in the guest configuration file: vuart = "pl011" Signed-off-by: Bhupinder Thakur --- Changes since v3: - Added a new config option CONFIG_VUART_CONSOLE to enable/disable vuart console support. - Moved libxl_vuart_type to arch-arm part of libxl_domain_build_info - Updated xl command help to mention new console type - vuart. Changes since v2: - Defined vuart option as an enum instead of a string. - Removed the domain creation flag defined for vuart and the related code to pass on the information while domain creation. Now vpl011 is initialized independent of domain creation through new DOMCTL APIs. config/arm32.mk | 1 + config/arm64.mk | 1 + tools/libxl/libxl.h | 6 ++++++ tools/libxl/libxl_console.c | 3 +++ tools/libxl/libxl_internal.h | 3 +++ tools/libxl/libxl_types.idl | 7 +++++++ tools/xl/Makefile | 4 ++++ tools/xl/xl_cmdtable.c | 4 ++++ tools/xl/xl_console.c | 11 ++++++++++- tools/xl/xl_parse.c | 8 ++++++++ 10 files changed, 47 insertions(+), 1 deletion(-) 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/libxl/libxl.h b/tools/libxl/libxl.h index cf8687a..bcfbb6c 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -306,6 +306,12 @@ #define LIBXL_HAVE_BUILDINFO_HVM_ACPI_LAPTOP_SLATE 1 /* + * LIBXL_HAVE_VUART indicates that xenconsole/client supports + * virtual uart. + */ +#define LIBXL_HAVE_VUART 1 + +/* * libxl ABI compatibility * * The only guarantee which libxl makes regarding ABI compatibility diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c index 446e766..853be15 100644 --- a/tools/libxl/libxl_console.c +++ b/tools/libxl/libxl_console.c @@ -67,6 +67,9 @@ int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, case LIBXL_CONSOLE_TYPE_SERIAL: cons_type_s = "serial"; break; + case LIBXL_CONSOLE_TYPE_VUART: + cons_type_s = "vuart"; + break; default: goto out; } diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 5d082c5..4e2c247 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1135,6 +1135,9 @@ typedef struct { uint32_t num_vmemranges; xc_domain_configuration_t config; + + xen_pfn_t vuart_gfn; + evtchn_port_t vuart_port; } libxl__domain_build_state; _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid, diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 2204425..066aace 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -105,6 +105,7 @@ libxl_console_type = Enumeration("console_type", [ (0, "UNKNOWN"), (1, "SERIAL"), (2, "PV"), + (3, "VUART"), ]) libxl_disk_format = Enumeration("disk_format", [ @@ -240,6 +241,11 @@ libxl_checkpointed_stream = Enumeration("checkpointed_stream", [ (2, "COLO"), ]) +libxl_vuart_type = Enumeration("vuart_type", [ + (0, "unknown"), + (1, "pl011"), + ]) + # # Complex libxl types # @@ -580,6 +586,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("arch_arm", Struct(None, [("gic_version", libxl_gic_version), + ("vuart", libxl_vuart_type), ])), # Alternate p2m is not bound to any architecture or guest type, as it is # supported by x86 HVM and ARM support is planned. diff --git a/tools/xl/Makefile b/tools/xl/Makefile index e16f877..d7c4927 100644 --- a/tools/xl/Makefile +++ b/tools/xl/Makefile @@ -15,6 +15,10 @@ LDFLAGS += $(PTHREAD_LDFLAGS) CFLAGS_XL += $(CFLAGS_libxenlight) CFLAGS_XL += -Wshadow +ifeq ($(CONFIG_VUART_CONSOLE),y) +CFLAGS_XL += -DCONFIG_VUART_CONSOLE +endif + XL_OBJS = xl.o xl_cmdtable.o xl_sxp.o xl_utils.o XL_OBJS += xl_tmem.o xl_parse.o xl_cpupool.o xl_flask.o XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index 30eb93c..14f7a50 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c @@ -133,7 +133,11 @@ struct cmd_spec cmd_table[] = { &main_console, 0, 0, "Attach to domain's console", "[options] \n" +#ifdef CONFIG_VUART_CONSOLE + "-t console type, pv , serial or vuart\n" +#else "-t console type, pv or serial\n" +#endif "-n console number" }, { "vncviewer", diff --git a/tools/xl/xl_console.c b/tools/xl/xl_console.c index 0508dda..d6ca93f 100644 --- a/tools/xl/xl_console.c +++ b/tools/xl/xl_console.c @@ -27,6 +27,11 @@ int main_console(int argc, char **argv) uint32_t domid; int opt = 0, num = 0; libxl_console_type type = 0; +#ifdef CONFIG_VUART_CONSOLE + char *console_names = "pv, serial, vuart"; +#else + char *console_names = "pv, serial"; +#endif SWITCH_FOREACH_OPT(opt, "n:t:", NULL, "console", 1) { case 't': @@ -34,8 +39,12 @@ int main_console(int argc, char **argv) type = LIBXL_CONSOLE_TYPE_PV; else if (!strcmp(optarg, "serial")) type = LIBXL_CONSOLE_TYPE_SERIAL; +#ifdef CONFIG_VUART_CONSOLE + else if (!strcmp(optarg, "vuart")) + type = LIBXL_CONSOLE_TYPE_VUART; +#endif else { - fprintf(stderr, "console type supported are: pv, serial\n"); + fprintf(stderr, "console type supported are: %s\n", console_names); return EXIT_FAILURE; } break; diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index 856a304..37581ef 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -916,6 +916,14 @@ void parse_config_data(const char *config_source, if (!xlu_cfg_get_long (config, "maxvcpus", &l, 0)) b_info->max_vcpus = l; + if (!xlu_cfg_get_string(config, "vuart", &buf, 0)) { + if (libxl_vuart_type_from_string(buf, &b_info->arch_arm.vuart)) { + fprintf(stderr, "ERROR: invalid value \"%s\" for \"vuart\"\n", + buf); + exit(1); + } + } + parse_vnuma_config(config, b_info); /* Set max_memkb to target_memkb and max_vcpus to avail_vcpus if