From patchwork Mon Sep 18 10:31:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 112889 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp3501183qgf; Mon, 18 Sep 2017 03:34:53 -0700 (PDT) X-Received: by 10.107.135.147 with SMTP id r19mr20367173ioi.26.1505730893777; Mon, 18 Sep 2017 03:34:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505730893; cv=none; d=google.com; s=arc-20160816; b=e5RkWzNlGJNQuWHxXlTBXPdrZAtUGUQ3UWDw3UD2DqFeTvmQyky1Le1vbh1drKEiO0 tFEqDz0vIBPH0J+3zEu3nDw1vkqqBgCv2fGjqJpAi5KPCky3a7v+WW/RDx90Z1WZ6jbY u//VFRm1eXqjlBwu0EZlfJqSuW7ATvbfMnMgkeCqDwrB+DQ7rOaMH7CpXDD3LAavOvl7 MNDi2fYSm6RS8q1RVbhyp2GrRnoeEYSM/AD4mKbr9k0y9Sh/OOWhIgjUu79lMiLlWRDm m+C9Jt0Of3Di9UhohCQ4KcoUb17VYfW3mihHQFzYlVyfQvpRPNEZHllcdi9DjkiiZ6Fr zTjQ== 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=DmRwMRT+ra3PNIYHq+0kidi0emxQV3nZuOjuwKPRsa4=; b=aD63ULU2WwhhGO7j6Q9nQo+0F4MFbWg7pYl5D2B9LAJd3koo8gAWao0c0Tu639DRv9 tCB/bLC60wAi9ZwZ6QbdoRUdrCgYFYPIZeWla8+T/nGAm6I7MhmfWMQIwbsYiNFwYm2d yKJeTO9sV5D26ncK7mmZBUfuYty8K8qa7J6BGOzn916JgaugBXFx22vN1OKqYpFg9MVb 8SZdvhIPyE1UU5lK+wMdhybLRQ93g1l7+F/+nCJtq7vypZUjFc3Hv6kpQXNY1VUHxxNF SetiYJSvSvju5V4jE1XX5u9DuK/1c9bbowoO0hCoHTvnvrl9ICVFh+9w2lyaR2IJ5JWJ GLEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=iIf8Ath9; 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 82si5509964ioc.178.2017.09.18.03.34.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Sep 2017 03:34: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 header.s=google header.b=iIf8Ath9; 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 1dttM4-0001mN-TJ; Mon, 18 Sep 2017 10:32:44 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dttM3-0001kX-GO for xen-devel@lists.xenproject.org; Mon, 18 Sep 2017 10:32:43 +0000 Received: from [85.158.139.211] by server-12.bemta-5.messagelabs.com id A1/0E-30935-AC0AFB95; Mon, 18 Sep 2017 10:32:42 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrEIsWRWlGSWpSXmKPExsXiVRusq3tqwf5 Ig423uC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1owX55MKOqwrHrcdZGpgXKPbxcjFISQwhVHi 36MpbCAOi8A8ZonNnfPYQRwJgX5WiZur3rJ2MXICOWkSzUvXM8HYh3aeYIOwqyV27z/DDGILC WhJHD01mxVi7A4miYnLXgEVcXCwCZhIzOqQAKkREVCSuLdqMhNIDbPAfEaJpkm9YIOEBfwlLj c3gS1jEVCVeLhyKlicV8Bb4sO1PqjFchI3z3WCLeMU8JE4v/4BK8Rib4l5v64wTmAUXMDIsIp Rozi1qCy1SNfQSC+pKDM9oyQ3MTNH19DAVC83tbg4MT01JzGpWC85P3cTIzDkGIBgB2PfLOdD jJIcTEqivKKR+yOF+JLyUyozEosz4otKc1KLDzHKcHAoSfCung+UEyxKTU+tSMvMAQY/TFqCg 0dJhHcdSJq3uCAxtzgzHSJ1itGYY9+eW3+YODpu3v3DJMSSl5+XKiXOWwdSKgBSmlGaBzcIFp WXGGWlhHkZgU4T4ilILcrNLEGVf8UozsGoJMy7DGQKT2ZeCdy+V0CnMAGd0rJjD8gpJYkIKak GxkSZJB2jCme2y1XN0zdsvjW3z+71soKZXQkZ14tEA6MXVOv0z/zzoODMcQapi+s4pfgOCvrr xCY5vPp/WtHl2z33Pp0ldQJd6xQVFac+b7izYsMW4f7AJmVB4d3fxWa/7FsmEtZ//d+vCx9zr 97fL6cyce+U7e6brh3R99VzPHNWZO/DhaEbcpVYijMSDbWYi4oTARkax+/FAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-5.tower-206.messagelabs.com!1505730760!110410516!1 X-Originating-IP: [74.125.83.45] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 23605 invoked from network); 18 Sep 2017 10:32:41 -0000 Received: from mail-pg0-f45.google.com (HELO mail-pg0-f45.google.com) (74.125.83.45) by server-5.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 18 Sep 2017 10:32:41 -0000 Received: by mail-pg0-f45.google.com with SMTP id d8so32859pgt.4 for ; Mon, 18 Sep 2017 03:32:41 -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=s3/gWfHm1xRDkfl4rM3PTmmMPTppea4twhsagiIEdTk=; b=iIf8Ath9xzwGUku0ojiczll+Rf1m7efmsimIgFjGxxWq71EnRiW1bXaNUimmYm+Nvc rVSZOotJfqlAQraLgS2Fk+2u7e/XCap4BrabUq/Lx+aLA0m3Lzxmu/A/i9svk55t9qXW ywb/Kc6Bl0fqALZHxls0UOQA+2BJR10G6VhjI= 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=s3/gWfHm1xRDkfl4rM3PTmmMPTppea4twhsagiIEdTk=; b=ExFyG5N43oHQMa5TxAKgp2WBfqGF9muTkqW2Qj0barTT6b9+MjCCQrJ0zQ2ujDEeu9 QYy0LtL8/zNgQx1gg5WZnZp1tL/OoFGQCtBw1vdP1ighpkRcDfRgFackP34YeuxwgwTR bd82Mes+HbDEtFt12AcnPC7JJe/ObP/Ax13W4qEhR3Nd9PZOggCJmjFIoCWDQOnpLkzP vFN7/O80tjU5lY1W9rl3ausu1TU1Mxh+EJ2fzOsik9Ni0yN+T+pyK8b6bapOihGDLgTE YlxH4HbueIVKBuR5KhPcZlBJr4AVnciifRKrrgcZ2ZN4OCReCcEcSljAiZ2jy3SlxAKV cUhw== X-Gm-Message-State: AHPjjUiGn6ELME+rJS175wWaFuIJ/oRjklfkxP0U5WW3UDuRhvMhiYqM 7iQHKdV6qkJIMpziGQYfgg== X-Google-Smtp-Source: ADKCNb6d7CJrs0GMQJKlewWBzFdq1hUkqZjZgLIguotQMOW2ClzLn+KmEUyUu0RUoqPqI4+KRdtcRQ== X-Received: by 10.84.148.203 with SMTP id y11mr35786365plg.277.1505730760383; Mon, 18 Sep 2017 03:32:40 -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 b7sm12937845pge.79.2017.09.18.03.32.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 18 Sep 2017 03:32:39 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Mon, 18 Sep 2017 16:01:51 +0530 Message-Id: <1505730731-10947-8-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> References: <1505730731-10947-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 07/27 v9] 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 Reviewed-by: Stefano Stabellini Acked-by: Wei Liu --- CC: Ian Jackson CC: Wei Liu CC: Stefano Stabellini CC: Julien Grall Changes since v4: - vuart_device moved inside libxl__device_vuart_add() as a local variable. 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 | 9 +++++++- tools/libxl/libxl_device.c | 9 ++++++-- tools/libxl/libxl_internal.h | 3 +++ tools/libxl/libxl_types_internal.idl | 1 + 5 files changed, 63 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c index 853be15..cdaf7fd 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 9123585..a3a3254 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1369,7 +1369,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, } case LIBXL_DOMAIN_TYPE_PV: { - libxl__device_console console; + libxl__device_console console, vuart; libxl__device device; for (i = 0; i < d_config->num_vfbs; i++) { @@ -1377,6 +1377,13 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, libxl__device_vkb_add(gc, domid, &d_config->vkbs[i]); } + if (d_config->b_info.arch_arm.vuart == LIBXL_VUART_TYPE_SBSA_UART) { + init_console_info(gc, &vuart, 0); + vuart.backend_domid = state->console_domid; + libxl__device_vuart_add(gc, domid, &vuart, state); + 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 00356af..3b10c58 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 6b38453..3f7cff9 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1206,6 +1206,9 @@ _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); /* 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", [