From patchwork Tue Jun 6 17:25:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 103170 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp1536639qgd; Tue, 6 Jun 2017 10:27:44 -0700 (PDT) X-Received: by 10.36.95.197 with SMTP id r188mr20346059itb.38.1496770063946; Tue, 06 Jun 2017 10:27:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496770063; cv=none; d=google.com; s=arc-20160816; b=j/5oSdn9qzFhbgp+g6zaYTIGanB1caCb3e6ws/pF+D+P5i3AFwU13LLJIVlvGWIEy6 ljgBtYM8xASl3cqldLteCHVitL3kfm5H4z/Vpr/lf2t5X9b691FPp4aT1GAoTR6Rx30R OHgKWV0GiSgHmj1FRHqbmMqWV2DlAWZUDtqRIRxXTBXFRx/iSAIAHetWzfanmRDvfcxw HAyBVgI5IX0wjec6L3Lx9EmsxHImjeKnC+hmhc5yfL/qha+efOqBXMCmFZpfhmAwLLiZ KIcdmt364Sc07f8x5BA3XvNIlBH5SN0LBkOTkrpdou1gcnbSLraMmrKHo6g7vBD7y0wP jX7A== 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=w90pSoebXgBVu3eu/THaQ9ShGDN6H8j7YBss6OCILbg=; b=bfVVFHx7H2kZUlpNUHu8qwj5Q695BpGR32JSI0rTEWugCwl7k+LQ/TsekAyTUvdhtu uCn8PK/cCfC7yfcR8aWdhXxOlva/iTULgCmHaz3kVP32uIHn91XHNjfSk2ewY2fO70mK 81bR+7X9Rz3RK6uf1jf9u0e2W7gggXyyw2Zp5S//kzsNGwxM1DkISEf3cAptub3LM8/6 y8Tg2FUW9ypOKsTgICMOkI7YTwYg4IpRCqp9FZat1wznIwPNtVnrpOGRLSD74MXWPExd gZeFOUqLMMweWA6TdB6xyBpQgOGhTCF5Nri/QdgGQ1m34PKI4dK/4WkDAamhcWUI+5QG e85g== 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 y99si9399040ioe.224.2017.06.06.10.27.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Jun 2017 10:27:43 -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 1dIIEp-0001Ys-5a; Tue, 06 Jun 2017 17:25:51 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIIEn-0001Xd-Q4 for xen-devel@lists.xenproject.org; Tue, 06 Jun 2017 17:25:49 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id 42/D3-03058-D95E6395; Tue, 06 Jun 2017 17:25:49 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrNIsWRWlGSWpSXmKPExsVyMfTAZt05T80 iDc7clrH4vmUykwOjx+EPV1gCGKNYM/OS8isSWDP2/7vEVPDdrGLd1iaWBsbH2l2MnBxCAjMY JbYvLOpi5OJgEZjHLLH++z4WkISEQD+rxNzj3hB2mkTPvR52CLtK4uHHWWwQzVoSR0/NZgVpF hJoZpKYtuELkMPBwSZgIjGrQwKkRkRASeLeqslMIDXMAvMZJZom9YI1Cwt4SqxsfcsKYrMIqE pcOH+TGcTmFfCWeND+gRFimZzEzXOdYHFOAR+JmeeXMEIs9pbY09DGOIFRYAEjwypGjeLUorL UIl0jI72kosz0jJLcxMwcXUMDM73c1OLixPTUnMSkYr3k/NxNjMDAYgCCHYxr5gceYpTkYFIS 5Y28ZBYpxJeUn1KZkVicEV9UmpNafIhRhoNDSYI38glQTrAoNT21Ii0zBxjiMGkJDh4lEd7JD 4DSvMUFibnFmekQqVOMlhxXrqz7wsSxYfV6IDnlwPYvTEIsefl5qVLivAog8wRAGjJK8+DGwe LwEqOslDAvI9CBQjwFqUW5mSWo8q8YxTkYlYR574Gs5cnMK4Hb+groICagg/gumYAcVJKIkJJ qYJReI5As/C7rzpsd6QX7N7npXuxfMS1KtfmES/j/rdnMN84Z1Z99vezuoqzIOP6ZUV9CVBnq PzLW/Et55uWqlhNW4sH2sd7w/bb9T6xubuRYt+JEziw3ga+7Zh8pWXxp9d4n69YLM9mUmFiyS SwVsn7gFx+Z3WIUn721P+Ewy/nnSvnXvuxdwqLEUpyRaKjFXFScCAAdeehEvgIAAA== X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-11.tower-21.messagelabs.com!1496769947!72472212!1 X-Originating-IP: [209.85.192.179] 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 58456 invoked from network); 6 Jun 2017 17:25:48 -0000 Received: from mail-pf0-f179.google.com (HELO mail-pf0-f179.google.com) (209.85.192.179) by server-11.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 6 Jun 2017 17:25:48 -0000 Received: by mail-pf0-f179.google.com with SMTP id x63so2102495pff.3 for ; Tue, 06 Jun 2017 10:25:48 -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=7GlVSQFidO4VN3kkYpQ+75PBMnIiFHskT94zljnu7ZY=; b=A3N22az71yEi90OghoOcRVGvOmT6xemhWEt6oh4jeYkAidsbSo6Rlqdb5U0cEdTEED DaM5UxgoJ9YPppY51UsZrxksTcipVVS0WUsassKaosp02W3oDEVZH617fwfzErQKNmzY 7m31chk6eM4JPBoxFbZNIeCUbP+61XXndfnVw= 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=7GlVSQFidO4VN3kkYpQ+75PBMnIiFHskT94zljnu7ZY=; b=SAuiJ0/xEzOSl8aHjEqlYi7jjBqg6Hp8Ikhm9lIPlLCASXcm3pdeSMNdozjmno/nfG KLNAmFoKSYHRoZPu8vCHLBdbm5GPsrheOUAu4LjrkYN+o9Qujnbzq9d9R/xBWIBGXwdF 4S/q4PjZ9boZUTRHWn+he0+d/Vrd6UsSU0r3hh1fBCWppyh0hMJsygZcYKbiGkgRgedT +Mb1GfOoMsgrP7o8RS3ef9t/h6qILoHEIZWaW2vQwEZcQGqDEslGBQnzMwqSZgJRDf3y /oz67NIkZJ4ih51RqtVB40aSt3HFTJTq0JWNjcIJcHab7/JzRZfTD9gYNQO62VOAxU07 pT2w== X-Gm-Message-State: AODbwcCdO6eP/IDedb8FTFV6fFOJx61bh2hOA1hj8NLyiMwvb9bQ9iGv zrz6rRaGjwIpz9sFObpiag== X-Received: by 10.98.131.134 with SMTP id h128mr26958450pfe.0.1496769946579; Tue, 06 Jun 2017 10:25:46 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id 62sm6031632pfr.90.2017.06.06.10.25.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Jun 2017 10:25:46 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Tue, 6 Jun 2017 22:55:19 +0530 Message-Id: <1496769929-23355-5-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496769929-23355-1-git-send-email-bhupinder.thakur@linaro.org> References: <1496769929-23355-1-git-send-email-bhupinder.thakur@linaro.org> 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 --- CC: ij CC: wl CC: ss CC: jg 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