From patchwork Wed May 10 14:28:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 9719983 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 B486F60236 for ; Wed, 10 May 2017 14:32:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A579D1FF13 for ; Wed, 10 May 2017 14:32:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A20F201BD; Wed, 10 May 2017 14:32:27 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,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 F1D431FF13 for ; Wed, 10 May 2017 14:32:26 +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 1d8SdB-0003h4-5q; Wed, 10 May 2017 14:30:21 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8SdA-0003gl-3g for xen-devel@lists.xenproject.org; Wed, 10 May 2017 14:30:20 +0000 Received: from [85.158.139.211] by server-1.bemta-5.messagelabs.com id 55/3E-01992-BF323195; Wed, 10 May 2017 14:30:19 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprCIsWRWlGSWpSXmKPExsVyMfTANt1fysK RBu3HTSy+b5nM5MDocfjDFZYAxijWzLyk/IoE1ozzb38zFnRqVLx928rewNit0MXIxSEkMJNR YsHJ1YwgDotAO7PE1xP/2EEcCYF3LBJd37YzdzFyAjlxEnsmLIeyKyU29HSxgNhCAloSR0/NZ oUY1cwkse3qQyCHg4NNwERiVocESI2IgJLEvVWTmUBsZgFviQ9HQBZwcggLeErsmL+GFcRmEV CV+HNyAZjNC1Sz6t9qFohdchI3z3UyT2DkW8DIsIpRozi1qCy1SNfQSC+pKDM9oyQ3MTNH19D AVC83tbg4MT01JzGpWC85P3cTIzBUGIBgB2PfLOdDjJIcTEqivLq7hCKF+JLyUyozEosz4otK c1KLDzHKcHAoSfBWKQlHCgkWpaanVqRl5gCDFiYtwcGjJMKbBpLmLS5IzC3OTIdInWK05Hhx+ f17Jo53Sz8AyScrf7xnEmLJy89LlRLndQRpEABpyCjNgxsHi6xLjLJSwryMQAcK8RSkFuVmlq DKv2IU52BUEuYtA5nCk5lXArf1FdBBTEAHBTIIgBxUkoiQkmpg5Ki+MUH7vbVVVFzPxMWzWWM j/vdmbuy+6DVF5L7mppIKt9fcj2KKvwVO8FpW39f0Z+7li1Yq7TfMzjywvPDzLs++CyvmzZUN iWYJ6X4iE7g4+PJEcRurtaoXIqeKBLHZnw6RbOEo/Nty2mGR5/116S8vpeedMP4lz2TmFzDV5 vRxj6MRApWhSizFGYmGWsxFxYkA1glLLKcCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-11.tower-206.messagelabs.com!1494426617!77528532!1 X-Originating-IP: [209.85.192.182] 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 50268 invoked from network); 10 May 2017 14:30:18 -0000 Received: from mail-pf0-f182.google.com (HELO mail-pf0-f182.google.com) (209.85.192.182) by server-11.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 10 May 2017 14:30:18 -0000 Received: by mail-pf0-f182.google.com with SMTP id e64so16806949pfd.1 for ; Wed, 10 May 2017 07:30:18 -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=RUv5IXzi4tvukMDS1Ws1d7FbB+sIz+n/tSEcnmSlblI=; b=XMVMSlz0uPXDYJ3TGS25zvwOr7Bq5agH3/YOmOVbF8u4FMv3SYOAlABVuyznNHRqVG f0OdMbxDMEbT4tZOJEGIfPv1Qcrfkfr02WSwR8eII8SGg3YXgJBX86126Z6lufld5Hiw kLSaxWZY4BrNm3qB8sdizlaXPyS8FOm7dwoW0= 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=RUv5IXzi4tvukMDS1Ws1d7FbB+sIz+n/tSEcnmSlblI=; b=rbXGBycFVIznZL2u8RY+ftCxJ6wq/kwwgzZOtPw4u3XEgnnI/d61JN3ZMO87eI+CTw U1x1hUPy5cCBFQODwammCudANNlqPr9ALy1eMW+5EeYvjB9YjmsLV3B/zUoUwO7+TDis Iio9e1tw0ROmSoF7YcRDP6l8JoYQL2K7ldBZoULEb7X3aF0IT6k/P0eF8lqvW7inrZcV dVZrSaAExGfMqX631PJvioE+O+rvstQ82FtxDiBhK+yXdvSPgixJmt+v+eAHQ+DaR91J C4eby4XBPkDyQd4hmO2Yz5G7Yf7796kotKnERbHgqurph/OAAeEfrase7F7FUbNkmq3v pC2Q== X-Gm-Message-State: AODbwcA5UQzApaiH/Z3FRhpkDdcA0leNErlFtQasXY0dzW6m32AZ0Ooe 0K9K9yE9Hg04i2UI X-Received: by 10.84.217.20 with SMTP id o20mr8606271pli.103.1494426617048; Wed, 10 May 2017 07:30:17 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([61.0.91.57]) by smtp.gmail.com with ESMTPSA id k23sm6342827pgn.11.2017.05.10.07.30.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 May 2017 07:30:16 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 10 May 2017 19:58:01 +0530 Message-Id: <1494426481-32562-1-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 Cc: Wei Liu , Ian Jackson Subject: [Xen-devel] [PATCH 04/12 v3] 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" X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Wei Liu Acked-by: Stefano Stabellini --- 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 | 6 ++++++ tools/libxl/libxl_console.c | 3 +++ tools/libxl/libxl_create.c | 2 ++ tools/libxl/libxl_internal.h | 3 +++ tools/libxl/libxl_types.idl | 7 +++++++ tools/xl/xl_console.c | 4 +++- tools/xl/xl_parse.c | 8 ++++++++ 7 files changed, 32 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_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_create.c b/tools/libxl/libxl_create.c index bffbc45..29daa35 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -918,6 +918,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..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..f5dc62c 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 # @@ -470,6 +476,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("disable_migrate", libxl_defbool), ("cpuid", libxl_cpuid_policy_list), ("blkdev_start", string), + ("vuart", libxl_vuart_type), ("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..504ca7c 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->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