From patchwork Tue Jun 6 17:25:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 103176 Delivered-To: patch@linaro.org Received: by 10.140.91.77 with SMTP id y71csp1536707qgd; Tue, 6 Jun 2017 10:27:53 -0700 (PDT) X-Received: by 10.36.58.196 with SMTP id m187mr18094879itm.89.1496770073297; Tue, 06 Jun 2017 10:27:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496770073; cv=none; d=google.com; s=arc-20160816; b=SxWmuqbn27QOpNDs7btXBKhrp5PBpHSF45ecGIHWEt90Rl1gka2+RRwukoM2MMq0Cs M5d0gFQ8dB/hQpdybMQMNCs5KA8QgVDNyfm3yaJ+1JS8/3mYeLuD4tj/W/+NUlBL20Qi +zNZJmkk9nqDXzEcfw/Kbg6QnV6tPVlVrC9MOkMpVdn8e9oJs6Yd58OjQFMkNS3VUIeD fqJ4XPUhzI40Z3bnSh6Dy1/p3xIHTp0j3mLf3JP5jVQ1OdFUE/lFySVF1Ut0V6WYurbR RH0dYQJfhDfXXpeyEAwPYq9AHTg9DfNuohK9L50J6MnNkAjhrz3OQA5I0Nd7GyCXsiM6 oPyg== 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=0MZnY3or4jlSUGrHPDVyGoYKIQBH33b5DclwUNy4BKo=; b=Oy//wCRqJ8ZRsUJo4hB63KYHjsQFeij5Vm7A7dDQxnEu/M7ef3ekpdHVhFfbUDA5Ql IEDvllugHkGWzDzRljTkGUNqZ/DpSya2f9Ao/co1Flh7aJYWlfl6dGMo+kD5K5E7mn6d N/VWgI8eMqxgOkqUrzSOYutc/lsfx/kA/VErjpvgk6MDFNpIp6AlBwGNGy3Pj1y3Cn6/ dk/T3BZ/X7YITG1ddBWoEs37/B6s0H1monCKV0nwswmn2PE1Ov9Nw0LhEBVztYybv8XA lmaG6yjJQRFpHu8aZRA057bY6S+iKia4jRM7MIg64XqWHDXD+6Hdh7esezTsX7yf3RmN dFIw== 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 m95si34862946ioi.35.2017.06.06.10.27.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Jun 2017 10:27:53 -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 1dIIEy-0001h5-13; Tue, 06 Jun 2017 17:26:00 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dIIEw-0001ey-LO for xen-devel@lists.xenproject.org; Tue, 06 Jun 2017 17:25:58 +0000 Received: from [85.158.143.35] by server-9.bemta-6.messagelabs.com id 78/12-03557-6A5E6395; Tue, 06 Jun 2017 17:25:58 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrAIsWRWlGSWpSXmKPExsXiVRuspbv0qVm kwcXPEhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8a1H92MBUstK+Y/OcnSwDhZu4uRi0NIYDqj xL81t9hBHBaBecwS82Z8YQJxJAT6WSXuTJ7I2MXICeSkSXS2PmWBsCslnnR+ZwKxhQS0JI6em s0KYTczSbzep9DFyMHBJmAiMatDAiQsIqAkcW/VZLCZzALzGSWaJvWygSSEBfwlus78ZQaxWQ RUJd7e/gBm8wp4S/yd2s0KsUtO4ua5TrA4p4CPxMzzSxghdnlL7GloY5zAKLCAkWEVo0ZxalF ZapGuoZleUlFmekZJbmJmjq6hgZlebmpxcWJ6ak5iUrFecn7uJkZgaDEAwQ7G+xsDDjFKcjAp ifJGXjKLFOJLyk+pzEgszogvKs1JLT7EKMPBoSTBG/kEKCdYlJqeWpGWmQMMcpi0BAePkgjv5 AdAad7igsTc4sx0iNQpRl2OSQe2f2ESYsnLz0uVEudVAJkhAFKUUZoHNwIWcZcYZaWEeRmBjh LiKUgtys0sQZV/xSjOwagkzJsCMoUnM68EbtMroCOYgI7gu2QCckRJIkJKqoGxbIpIqOu1lEO 68vw1+b0CEfpXv/lp2HKbif9YyfdznUDzyY0Lap66v0raLKPT/+G04f0KgRRnMwatpKN73q1m epbxkollq8DjSdd2bDTSKz2ueEjsbGdguPbae67/8oyverwVXZqb7sRV2TP5z9fq5Q+X9h2Ir zZ4Z3k0fVXrla0/TVdcrhBXYinOSDTUYi4qTgQA7UKIkbMCAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-12.tower-21.messagelabs.com!1496769955!72556474!1 X-Originating-IP: [74.125.83.42] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 39872 invoked from network); 6 Jun 2017 17:25:57 -0000 Received: from mail-pg0-f42.google.com (HELO mail-pg0-f42.google.com) (74.125.83.42) by server-12.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 6 Jun 2017 17:25:57 -0000 Received: by mail-pg0-f42.google.com with SMTP id k71so4104598pgd.2 for ; Tue, 06 Jun 2017 10:25:57 -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=ypHL0H/QqjMzUVwPRiybi9ujUkTggl200zOr23Q8Rk8=; b=D3ER/tdoVsRGFokrTe+FZZcEGlxE22avaFZtRGeIGEzkeYRCvGkFmuxcnKiG5qg+Gh RVsl4LTbb3T2paE9qk7OBlYjtM3wVmiHthaX0shbMKdeRGPeNgvT9G2UuClFia/HQEZQ YmeaSFvz3DAEmyGkw3s7oLAv9+knFU6oh5x/I= 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=ypHL0H/QqjMzUVwPRiybi9ujUkTggl200zOr23Q8Rk8=; b=h6P5veqNc4ixCikfRH52lgmVaP5bT4//RvvVoCq+e8p5z8t8KLwKu97iuLGOasPFEv 2bSBkIbzmopqVn9nlfPBceUjR09ZYi8xUcEe5pOzzUZv/mIb0cfNLZPrgQnOXf9NF1ss lcIc51faTZGxlLV9kytnvzkk6sTnnDKp4J4ikHxm/OdkoJAESWxi5C/4QL/mntGdS+uQ n0m3ul9dFUF4xocKDviiHKI57SVjRxiZdXjLF4tRMYAwDVllmAOVU5CQwL9as/xN8Akl 7mlXVlqQn9KCYgGcbz8nuYldeBcuuSJOAuAysu3Sr3SU+Uz9w7EoLRm9vW04rihE4WXV l79w== X-Gm-Message-State: AODbwcBBdNskz2x36ABzgLaVW64pxcZKUMs+UblR3djMaR/lrZ7nms23 SoZOclMMCNNjw5s+a29lEw== X-Received: by 10.84.140.133 with SMTP id 5mr23148056plt.224.1496769955403; Tue, 06 Jun 2017 10:25:55 -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.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 06 Jun 2017 10:25:54 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Tue, 6 Jun 2017 22:55:22 +0530 Message-Id: <1496769929-23355-8-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 07/14 v4] xen/arm: vpl011: Add a new vuart node in the xenstore 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" Add a new vuart console node to xenstore. This node is added at /local/domain/$DOMID/vuart/0. The node contains information such as the ring-ref, event channel, buffer limit and type of console. Xenconsole reads the node information to setup the ring buffer and event channel for sending/receiving vuart data. Signed-off-by: Bhupinder Thakur --- CC: ij CC: wl CC: ss CC: jg Changes since v3: - Added a backend node for vpl011. - Removed libxl__device_vuart_add() for HVM guest. It is called only for PV guest. tools/libxl/libxl_console.c | 44 ++++++++++++++++++++++++++++++++++++ tools/libxl/libxl_create.c | 12 ++++++++-- tools/libxl/libxl_device.c | 9 ++++++-- tools/libxl/libxl_internal.h | 4 ++++ tools/libxl/libxl_types_internal.idl | 1 + 5 files changed, 66 insertions(+), 4 deletions(-) diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c index 853be15..259f865 100644 --- a/tools/libxl/libxl_console.c +++ b/tools/libxl/libxl_console.c @@ -344,6 +344,50 @@ out: return rc; } +int libxl__device_vuart_add(libxl__gc *gc, uint32_t domid, + libxl__device_console *console, + libxl__domain_build_state *state, + libxl__device *device) +{ + flexarray_t *ro_front; + flexarray_t *back; + int rc; + + ro_front = flexarray_make(gc, 16, 1); + back = flexarray_make(gc, 16, 1); + + device->backend_devid = console->devid; + device->backend_domid = console->backend_domid; + device->backend_kind = LIBXL__DEVICE_KIND_VUART; + device->devid = console->devid; + device->domid = domid; + device->kind = LIBXL__DEVICE_KIND_VUART; + + flexarray_append(back, "frontend-id"); + flexarray_append(back, GCSPRINTF("%d", domid)); + flexarray_append(back, "online"); + flexarray_append(back, "1"); + flexarray_append(back, "state"); + flexarray_append(back, GCSPRINTF("%d", XenbusStateInitialising)); + flexarray_append(back, "protocol"); + flexarray_append(back, LIBXL_XENCONSOLE_PROTOCOL); + + flexarray_append(ro_front, "port"); + flexarray_append(ro_front, GCSPRINTF("%"PRIu32, state->vuart_port)); + flexarray_append(ro_front, "ring-ref"); + flexarray_append(ro_front, GCSPRINTF("%lu", state->vuart_gfn)); + flexarray_append(ro_front, "limit"); + flexarray_append(ro_front, GCSPRINTF("%d", LIBXL_XENCONSOLE_LIMIT)); + flexarray_append(ro_front, "type"); + flexarray_append(ro_front, "xenconsoled"); + + rc = libxl__device_generic_add(gc, XBT_NULL, device, + libxl__xs_kvs_of_flexarray(gc, back), + NULL, + libxl__xs_kvs_of_flexarray(gc, ro_front)); + return rc; +} + int libxl__init_console_from_channel(libxl__gc *gc, libxl__device_console *console, int dev_num, diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index bffbc45..091a661 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1367,14 +1367,22 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, } case LIBXL_DOMAIN_TYPE_PV: { - libxl__device_console console; - libxl__device device; + libxl__device_console console, vuart; + libxl__device device, vuart_device; for (i = 0; i < d_config->num_vfbs; i++) { libxl__device_vfb_add(gc, domid, &d_config->vfbs[i]); libxl__device_vkb_add(gc, domid, &d_config->vkbs[i]); } + if (d_config->b_info.arch_arm.vuart) + { + init_console_info(gc, &vuart, 0); + vuart.backend_domid = state->console_domid; + libxl__device_vuart_add(gc, domid, &vuart, state, &vuart_device); + libxl__device_console_dispose(&vuart); + } + init_console_info(gc, &console, 0); console.backend_domid = state->console_domid; libxl__device_console_add(gc, domid, &console, state, &device); diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index 5e96676..b110041 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -26,6 +26,9 @@ static char *libxl__device_frontend_path(libxl__gc *gc, libxl__device *device) if (device->kind == LIBXL__DEVICE_KIND_CONSOLE && device->devid == 0) return GCSPRINTF("%s/console", dom_path); + if (device->kind == LIBXL__DEVICE_KIND_VUART) + return GCSPRINTF("%s/vuart/%d", dom_path, device->devid); + return GCSPRINTF("%s/device/%s/%d", dom_path, libxl__device_kind_to_string(device->kind), device->devid); @@ -170,7 +173,8 @@ retry_transaction: * historically contained other information, such as the * vnc-port, which we don't want the guest fiddling with. */ - if (device->kind == LIBXL__DEVICE_KIND_CONSOLE && device->devid == 0) + if ((device->kind == LIBXL__DEVICE_KIND_CONSOLE && device->devid == 0) || + (device->kind == LIBXL__DEVICE_KIND_VUART)) xs_set_permissions(ctx->xsh, t, frontend_path, ro_frontend_perms, ARRAY_SIZE(ro_frontend_perms)); else @@ -800,7 +804,8 @@ void libxl__devices_destroy(libxl__egc *egc, libxl__devices_remove_state *drs) dev->domid = domid; dev->kind = kind; dev->devid = atoi(devs[j]); - if (dev->backend_kind == LIBXL__DEVICE_KIND_CONSOLE) { + if (dev->backend_kind == LIBXL__DEVICE_KIND_CONSOLE || + dev->backend_kind == LIBXL__DEVICE_KIND_VUART) { /* Currently console devices can be destroyed * synchronously by just removing xenstore entries, * this is what libxl__device_destroy does. diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 4e2c247..7a22db0 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1202,6 +1202,10 @@ _hidden int libxl__device_console_add(libxl__gc *gc, uint32_t domid, libxl__device_console *console, libxl__domain_build_state *state, libxl__device *device); +_hidden int libxl__device_vuart_add(libxl__gc *gc, uint32_t domid, + libxl__device_console *console, + libxl__domain_build_state *state, + libxl__device *device); /* Returns 1 if device exists, 0 if not, ERROR_* (<0) on error. */ _hidden int libxl__device_exists(libxl__gc *gc, xs_transaction_t t, diff --git a/tools/libxl/libxl_types_internal.idl b/tools/libxl/libxl_types_internal.idl index 7dc4d0f..c463c33 100644 --- a/tools/libxl/libxl_types_internal.idl +++ b/tools/libxl/libxl_types_internal.idl @@ -26,6 +26,7 @@ libxl__device_kind = Enumeration("device_kind", [ (9, "VUSB"), (10, "QUSB"), (11, "9PFS"), + (12, "VUART"), ]) libxl__console_backend = Enumeration("console_backend", [