From patchwork Fri Sep 22 08:23:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 113981 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3011126qgf; Fri, 22 Sep 2017 01:26:04 -0700 (PDT) X-Received: by 10.36.249.69 with SMTP id l66mr4788466ith.85.1506068764626; Fri, 22 Sep 2017 01:26:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506068764; cv=none; d=google.com; s=arc-20160816; b=TJIggKXYOspT1jIBolwArICY2A94jepYOL2aSQ07AOhGRaHS0yCWdaQ15mOpgSMouZ L6KGfxB3Az55NGmJPgW8K+FoDuScAoeXBMyl6FJeJy0BtCbAl8LIL5ogibNNOuTEe1WU 32woX5euDQcepp18vvPHhsn/Hu8OFP4Nk+QEf9DyTfbry+S9ffxXOTizmURepr4BBy1e SGFbbNV7NzsuCVUMe+GMA1+eba2XieolckRHWE/6ZfjNGhqhYpNvM1gqRvXs3dsFGx40 QwgAFT5XtyMULx/z0fjHR1gqPxJMZ+Tc/Uu3RZVh2lpsCF08hsRUA5y5wtojefCloSWR krPg== 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=CE5Bdy5qyzmR31Oifvf1YJnVhxYEBxdqf0MkgR7yYzw=; b=OCu5Itgj/QcpuoA8EUk4kiKlCaWQu4uKJdz9GYtrNHjjmO4n35DsUDyYtrA27qQqNG L3QQHCTs9JfqNfqVDip7+kf5pOAWwQ/J04q9pO9iDHoDv0EQPOmZLfqB3zzwA6Vq/oY1 pWmMiKx/EPlKJG43sc3q2+d028YF4m7jKWAuL7+dh26tEgcl7jr/WGuaRhXvPHvBV2F+ h25s+8++WpN6oSov3hfElizMRuhRwOWbh8DtDebsEcyvZGQ8vlGmIBq6CnurIzLVjqKZ X80KbzaZcSb0wC9g10vUF++ZCG8zwJ+3bSt8t5MGyuOplvc+bnzSSk+fqDzzZi8aAIsi q8kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=MGT5+tW7; 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 s71si3502767itb.75.2017.09.22.01.26.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Sep 2017 01:26:04 -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.s=google header.b=MGT5+tW7; 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 1dvJFW-0003h7-Uc; Fri, 22 Sep 2017 08:23:50 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dvJFV-0003en-3p for xen-devel@lists.xenproject.org; Fri, 22 Sep 2017 08:23:49 +0000 Received: from [85.158.139.211] by server-12.bemta-5.messagelabs.com id 5B/9C-30935-498C4C95; Fri, 22 Sep 2017 08:23:48 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRWlGSWpSXmKPExsVyMfTAGt3JJ45 EGkzaqGLxfctkJgdGj8MfrrAEMEaxZuYl5VcksGY0NjWzFmwwqfiwqp25gfGcZhcjF4eQwAxG idlr9rN2MXJysAjMY5ZYtBAsISHQzyrRvu0eE0hCQiBPYu/RPjYIO03iUe8OIJsDyK6UOLugH iQsJKAlcfTUbFYIeweTxK7liSAlbAImErM6JEDCIgJKEvdWTWYCGc8sMJ9RomlSL9hIYQEviV /rTrFA3KAqMXffNEYQm1fAW2LS+05GiLVyEjfPdTKD2JwCPhJr/29ggdjlLbH1xlWWCYyCCxg ZVjGqF6cWlaUW6ZrpJRVlpmeU5CZm5ugaGpjq5aYWFyemp+YkJhXrJefnbmIEBhsDEOxgnNrg fIhRkoNJSZT38ZEjkUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeO2PA+UEi1LTUyvSMnOAYQ+Tl uDgURLhDQdJ8xYXJOYWZ6ZDpE4x2nNcuHPpDxPHsU2XgeSBPbeAZMfNu3+YhFjy8vNSpcR5A0 DaBEDaMkrz4IbC4vQSo6yUMC8j0JlCPAWpRbmZJajyrxjFORiVhHkVQabwZOaVwO1+BXQWE9B Z5avBzipJREhJNTBatBt/9WJbdVX/LJ/fm936vO93pzYuX2hrqMN1/HHoJL3LYWkfEqYbqf87 w/oh1m1uIF/C9t5nc04ejhEQuzbhZt+rzrM83SV9pvUJphwhzjyFt3n75QqKM4rlO4wctV61N UyWVtqZsIGH7XwQv+LkHpXMbblxCayGVv83HXEXb+jZXvX0rxJLcUaioRZzUXEiAPV3ryHOAg AA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-3.tower-206.messagelabs.com!1506068626!109170707!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.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 51255 invoked from network); 22 Sep 2017 08:23:47 -0000 Received: from mail-pf0-f172.google.com (HELO mail-pf0-f172.google.com) (209.85.192.172) by server-3.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 22 Sep 2017 08:23:47 -0000 Received: by mail-pf0-f172.google.com with SMTP id r71so228992pfe.12 for ; Fri, 22 Sep 2017 01:23:47 -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=LGLhx7Och6xef4nWNZ5DPoUrb0BM0rjwbeTkFLXpAzY=; b=MGT5+tW7zQQkMGocLTatgyCg6FUSE0lSfAmIIFSkBgUKDr8L0JHRtuT8KSJqHpB3ea xah2cXPEzC3YCqhfmJSeAcs1JsAiWkTT5jUYoxfdRh3V8aTrDzCiOrZ/uY4Et7Js4sC+ NdaZTc3SMfm6BwxpwPBsSHIHw3g0xwY0r0eCA= 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=LGLhx7Och6xef4nWNZ5DPoUrb0BM0rjwbeTkFLXpAzY=; b=F7fQEIoK/8SjV4lM3hefyY5f7NdWSxca7YW5UfPye1JcSvoOhbs/vUF2p8ZXwnVHGf y5xjjcIJAFFAAIzyGsYxLvH3PIC8MPz5r4feczDsOs7Mn8rZIdJ4taOy995ryaUiOsj+ zenaLDq0Y1pMGgAKic+phQ+1+qT5QdhoLvQGmYyryPIwDZ1FrsrvKld3yCPP+vuaQeuX txjaefV4QpC9XxQolCD24/IE63NqoMDIMf26y21sS+z779uquLmAyI8z5ABywqrGG7dm GRtqzRlpffV8b0x+EHXHYhK0yIjcAfDyI3OjbSqvc+f7pLqbSrNacZti/gK1n8e8gqqz b6Sw== X-Gm-Message-State: AHPjjUgSNQ4aokkKzcQNgY3ueMbHg+sK6j0dmdsi7gKAW0XSVosscc+J oh5GvApRFCIOvslDNvARf/VZpLni8ks= X-Google-Smtp-Source: AOwi7QCjaZab/SP9BQ41exIS3d9OdcYmNUv1pepaQaZcC89HsFUen2auyn9MDGQQrPLkb84/DHIAfg== X-Received: by 10.84.129.226 with SMTP id b89mr8349645plb.42.1506068625759; Fri, 22 Sep 2017 01:23:45 -0700 (PDT) Received: from blr-ubuntu-linaro.qualcomm.com (blr-bdr-fw-01_globalnat_allzones-outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id f74sm5569284pfa.36.2017.09.22.01.23.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 22 Sep 2017 01:23:45 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Fri, 22 Sep 2017 13:53:03 +0530 Message-Id: <1506068606-17066-5-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 04/27 v10] 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 SBSA vuart while creating a guest domain. Libxl now supports a generic vuart console and SBSA uart is a specific type. In future support can be added for multiple vuart of different types. User can enable SBSA vuart by adding the following line in the guest configuration file: vuart = "sbsa_uart" Signed-off-by: Bhupinder Thakur Acked-by: Stefano Stabellini Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall Changes since v4: - Renamed "pl011" to "sbsa_uart". 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. tools/libxl/libxl.h | 7 +++++++ tools/libxl/libxl_console.c | 3 +++ tools/libxl/libxl_dom.c | 1 + tools/libxl/libxl_internal.h | 3 +++ tools/libxl/libxl_types.idl | 7 +++++++ tools/xl/xl_cmdtable.c | 2 +- tools/xl/xl_console.c | 5 ++++- tools/xl/xl_parse.c | 8 ++++++++ 8 files changed, 34 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h index 7d853ca..9dfd964 100644 --- a/tools/libxl/libxl.h +++ b/tools/libxl/libxl.h @@ -308,9 +308,16 @@ /* * LIBXL_HAVE_P9S indicates that the p9 field in IDL has been changed to p9s */ + #define LIBXL_HAVE_P9S 1 /* + * LIBXL_HAVE_BUILDINFO_ARM_VUART indicates that the toolstack supports virtual UART + * for ARM. + */ +#define LIBXL_HAVE_BUILDINFO_ARM_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 68511d7..f4f64ad 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_dom.c b/tools/libxl/libxl_dom.c index f54fd49..e0f0d78 100644 --- a/tools/libxl/libxl_dom.c +++ b/tools/libxl/libxl_dom.c @@ -803,6 +803,7 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid, if (xc_dom_translated(dom)) { state->console_mfn = dom->console_pfn; state->store_mfn = dom->xenstore_pfn; + state->vuart_gfn = dom->vuart_gfn; } else { state->console_mfn = xc_dom_p2m(dom, dom->console_pfn); state->store_mfn = xc_dom_p2m(dom, dom->xenstore_pfn); diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 81e87ae..30a5cb2 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1139,6 +1139,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 756e120..37ac8ec 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, "sbsa_uart"), + ]) + # # Complex libxl types # @@ -581,6 +587,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/xl_cmdtable.c b/tools/xl/xl_cmdtable.c index 48f0324..2126e70 100644 --- a/tools/xl/xl_cmdtable.c +++ b/tools/xl/xl_cmdtable.c @@ -133,7 +133,7 @@ struct cmd_spec cmd_table[] = { &main_console, 0, 0, "Attach to domain's console", "[options] \n" - "-t console type, pv or serial\n" + "-t console type, pv , serial or vuart\n" "-n console number" }, { "vncviewer", diff --git a/tools/xl/xl_console.c b/tools/xl/xl_console.c index 0508dda..4e65d73 100644 --- a/tools/xl/xl_console.c +++ b/tools/xl/xl_console.c @@ -27,6 +27,7 @@ int main_console(int argc, char **argv) uint32_t domid; int opt = 0, num = 0; libxl_console_type type = 0; + char *console_names = "pv, serial, vuart"; SWITCH_FOREACH_OPT(opt, "n:t:", NULL, "console", 1) { case 't': @@ -34,8 +35,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: %s\n", console_names); return EXIT_FAILURE; } break; diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index 0678fbc..edcdd9e 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -965,6 +965,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