From patchwork Fri Apr 28 16:01:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 98370 Delivered-To: patch@linaro.org Received: by 10.182.236.104 with SMTP id ut8csp392054obc; Fri, 28 Apr 2017 09:03:46 -0700 (PDT) X-Received: by 10.36.26.87 with SMTP id 84mr15609iti.94.1493395426001; Fri, 28 Apr 2017 09:03:46 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id c65si504464itb.88.2017.04.28.09.03.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Apr 2017 09:03:45 -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 1d48LA-00009C-3N; Fri, 28 Apr 2017 16:01:52 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d48L8-00008R-SQ for xen-devel@lists.xenproject.org; Fri, 28 Apr 2017 16:01:50 +0000 Received: from [85.158.137.68] by server-14.bemta-3.messagelabs.com id 4B/74-01870-E6763095; Fri, 28 Apr 2017 16:01:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrGIsWRWlGSWpSXmKPExsXiVRusr5ubzhx psGeqrMX3LZOZHBg9Dn+4whLAGMWamZeUX5HAmrF550TGgqXqFf/unGJsYLwg38XIxSEkMJ1R 4nFLOxuIwyIwj1liyctZYI6EQD+rxMlD7YxdjJxATpzEvt0XmSDsSonFi2+CxYUEtCSOnprNC jGqmUni+6RLLF2MHBxsAiYSszokQGpEBJQk7q2azARSwyzwllGi/+MpVpCEsICnxNPWx+wgNo uAqsTK7l1gvbwC3hKP1hRD7JKTuHmukxnE5hTwkbjWv4wdYq+3RHfDPJYJjAILGBlWMWoUpxa VpRbpGhnqJRVlpmeU5CZm5ugaGhjr5aYWFyemp+YkJhXrJefnbmIEhlY9AwPjDsaevX6HGCU5 mJREeSvdmSOF+JLyUyozEosz4otKc1KLDzHKcHAoSfAKpAHlBItS01Mr0jJzgEEOk5bg4FES4 U1NBUrzFhck5hZnpkOkTjEac7xb+uE9E8ejlT/eMwmx5OXnpUqJ80aATBIAKc0ozYMbBIu+S4 yyUsK8jAwMDEI8BalFuZklqPKvGMU5GJWEeZVApvBk5pXA7XsFdAoT0CksLgwgp5QkIqSkGhg VvIS3HjteoZ6QsXq1c381b/Tsb5+mP5Pz0Hv9e6eGbWhJw3WmxRkSDPOmKK/4rWIx5d8uoeCP i7w/v5z1as+ZkkMSntaWd/PMed7Is2vbcZ3V/tn4+1vQgldWzXe7HnzPfXy/e77ThTUHfTb+r OlMDM7hZX+1TNBeZ+cjpZlXWyzL5YNN115VYinOSDTUYi4qTgQAo1+/TbkCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-12.tower-31.messagelabs.com!1493395308!81142128!1 X-Originating-IP: [74.125.83.47] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.4.12; banners=-,-,- X-VirusChecked: Checked Received: (qmail 16829 invoked from network); 28 Apr 2017 16:01:49 -0000 Received: from mail-pg0-f47.google.com (HELO mail-pg0-f47.google.com) (74.125.83.47) by server-12.tower-31.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 28 Apr 2017 16:01:49 -0000 Received: by mail-pg0-f47.google.com with SMTP id o3so11673294pgn.2 for ; Fri, 28 Apr 2017 09:01:49 -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=l+KGAUe62TLj7so7bVciyFWpDWa4oYTNJ/q6Tyo1TgQ=; b=e2VseITdAioshggD2YRGQBVlwB603Rqy+PGhxsQgwVeYVd+lTys33eGS16ZbXwNiwV ohhefwfbbWdHR9vBVGUyRCI6tefzfPgfSwaHoYzosYL+WVDYv7eI/dH0BTrFmaKtoezv iacXSm8snBkDiWRw0reAijeKRvMzmr8GWkccU= 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=l+KGAUe62TLj7so7bVciyFWpDWa4oYTNJ/q6Tyo1TgQ=; b=FZPJPSQzXEX7Y1/xLIP2Ud3N1gbEjSqW7FnGrEz1Qlftk505wvM2jdG3GXczMQHPXO gVYy0aTq9EWiiGZ4wsfc3P53OLJK1C/Fr6sduP85Aws0E+otnVPnxIYYe2LeiL2RLsyV lIKGMplexp99ssWAM+Te2Tat++WDskLyucD2X/uQuH7CYq4uY6Kzb/HbuBIjURNvoVRH P6B69Uo/4A1s4XBEhlhke0QYyByyJULGk7Y4JmQICDskJA6p2nph1Qw3BCSoCK5eam2Q yvi7Ku76dZpqZmdseOcjhBvaS5wYub8pbUo0xtzFsPkSKt34Blo221FEYbW5f3JkwpDB paGg== X-Gm-Message-State: AN3rC/6a+MIMqehdxSZaXorlTbPwHeIADytDfP7RngjHuOz/jg2YaTso CAUWdyDAhwAW+xiG X-Received: by 10.98.62.141 with SMTP id y13mr13007823pfj.93.1493395307545; Fri, 28 Apr 2017 09:01:47 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([103.5.19.18]) by smtp.gmail.com with ESMTPSA id n65sm9870239pga.8.2017.04.28.09.01.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 28 Apr 2017 09:01:46 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 28 Apr 2017 21:31:18 +0530 Message-Id: <1493395284-18430-5-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493395284-18430-1-git-send-email-bhupinder.thakur@linaro.org> References: <1493395284-18430-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Stefano Stabellini , Wei Liu , Andrew Cooper , Ian Jackson , Julien Grall , Jan Beulich Subject: [Xen-devel] [PATCH 04/10 v2] 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 v1: - Modified the syntax for taking the pl011 as a console type in the configuration file. Now the syntax is vuart = "pl011". - Replaced the console type VCON with VUART, as it is more intuitive. tools/libxl/libxl.h | 6 ++++++ tools/libxl/libxl_create.c | 10 ++++++++++ tools/libxl/libxl_internal.h | 4 ++++ tools/libxl/libxl_types.idl | 2 ++ tools/xl/xl_console.c | 4 +++- tools/xl/xl_parse.c | 3 +++ 6 files changed, 28 insertions(+), 1 deletion(-) 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_create.c b/tools/libxl/libxl_create.c index bffbc45..5d70bc2 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -536,6 +536,9 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config, flags |= libxl_defbool_val(info->oos) ? 0 : XEN_DOMCTL_CDF_oos_off; } + if (!strcmp(d_config->b_info.vuart, "pl011")) + flags |= XEN_DOMCTL_VUART_enable; + /* Ultimately, handle is an array of 16 uint8_t, same as uuid */ libxl_uuid_copy(ctx, (libxl_uuid *)handle, &info->uuid); @@ -900,6 +903,11 @@ static void initiate_domain_create(libxl__egc *egc, goto error_out; } + if (!strcmp(d_config->b_info.vuart, "pl011")) + state->vuart_enabled = true; + else + state->vuart_enabled = false; + if (d_config->c_info.type == LIBXL_DOMAIN_TYPE_HVM && (libxl_defbool_val(d_config->b_info.u.hvm.nested_hvm) && (libxl_defbool_val(d_config->b_info.u.hvm.altp2m) || @@ -918,6 +926,8 @@ static void initiate_domain_create(libxl__egc *egc, goto error_out; } + state->config.console_domid = state->console_domid; + ret = libxl__domain_make(gc, d_config, &domid, &state->config); if (ret) { LOGD(ERROR, domid, "cannot make domain: %d", ret); diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 5d082c5..9dba8e7 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1135,6 +1135,10 @@ typedef struct { uint32_t num_vmemranges; xc_domain_configuration_t config; + + unsigned long vuart_mfn; + uint32_t vuart_port; + bool vuart_enabled; } 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..5d53f2c 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", [ @@ -470,6 +471,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("disable_migrate", libxl_defbool), ("cpuid", libxl_cpuid_policy_list), ("blkdev_start", string), + ("vuart", string), ("vnuma_nodes", Array(libxl_vnode_info, "num_vnuma_nodes")), diff --git a/tools/xl/xl_console.c b/tools/xl/xl_console.c index 0508dda..6f3cd7f 100644 --- a/tools/xl/xl_console.c +++ b/tools/xl/xl_console.c @@ -34,8 +34,10 @@ int main_console(int argc, char **argv) type = LIBXL_CONSOLE_TYPE_PV; else if (!strcmp(optarg, "serial")) type = LIBXL_CONSOLE_TYPE_SERIAL; + else if (!strcmp(optarg, "vuart")) + type = LIBXL_CONSOLE_TYPE_VUART; else { - fprintf(stderr, "console type supported are: pv, serial\n"); + fprintf(stderr, "console type supported are: pv, serial, vuart\n"); return EXIT_FAILURE; } break; diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index 856a304..80fd184 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -916,6 +916,9 @@ 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_replace_string(config, "vuart", &b_info->vuart, 0)) + b_info->vuart = strdup("unknown"); + parse_vnuma_config(config, b_info); /* Set max_memkb to target_memkb and max_vcpus to avail_vcpus if