From patchwork Wed Sep 27 06:13:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 114345 Delivered-To: patch@linaro.org Received: by 10.140.106.117 with SMTP id d108csp4665562qgf; Tue, 26 Sep 2017 23:17:14 -0700 (PDT) X-Received: by 10.36.173.33 with SMTP id c33mr888899itf.5.1506493034013; Tue, 26 Sep 2017 23:17:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506493034; cv=none; d=google.com; s=arc-20160816; b=T+VuDXbPQ68S87e98Ko1xElH0cJolEh8xXWqkCTBhtn6gsQMkFKkestMx3MBE7rxmk 0Pa4OVS3kgT/2/8I+s2GKoX2yczPvoYn4Sp1I8nOrOyaVHDCpeqWw+m4An+dXQXNmMyx O+BJ2tO/USqTPZbVMSjMfJavV05LYIoTzOaNnoZWPTkZb6YVvgZNt+XLc1IuVSasf0pY EC+AUbnvHcrGcC9+Nv8ErM831ZLjQDrZ/w/kW1aP04uIImYfzVdQlaEmuBYVWr2t+DC3 shGw4OOFC5lA/pY2ofYpiYiZ97KUu3OqHphV1lSLo8gBAOU6ThZYoAxl7JjuHd2rh5/3 HxAg== 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=NQu2U2Y0mmfBaEBqfsKZpaOj5vrCPTemt8YZW0wsXZs=; b=NgEf49z7lK5Wccfy8ZM1hBx3CYJfSX/tbbvW7wi3lYp0VfFBrIaduCWmhOoTJ1J+yn 2hJPwZ4k780AXRW658eKrF+oPDLPI7JpzBx3cOJqCdvHwUnn5TM0wYLZaHXvAv5RUFKa YquTIjdtyMyrgda8E9oLI5BsYDpYaJ1membgLxYr8UKtw024rB2ka0VBbbjH/5xPcZxF S2FG87V0TjRG70q12Wzv4Nphz6TAOflcA6FqvTxY9ytC80/NbWaoBCSQUHxj2+upcqFe tpva1knAzpxuCLE4v2AUnuZu5j4RlK1+cwLo7pZjvwx4V9OFJg3nSM/uczZgs237AW1H vrBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=AN0QUx8G; 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 f75si4321838ioe.372.2017.09.26.23.17.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2017 23:17:14 -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=AN0QUx8G; 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 1dx5bY-0002Zx-S4; Wed, 27 Sep 2017 06:13:56 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dx5bX-0002Xd-88 for xen-devel@lists.xenproject.org; Wed, 27 Sep 2017 06:13:55 +0000 Received: from [193.109.254.147] by server-6.bemta-6.messagelabs.com id 66/05-03423-2A14BC95; Wed, 27 Sep 2017 06:13:54 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrNIsWRWlGSWpSXmKPExsVyMfTAFt15jqc jDS6dU7P4vmUykwOjx+EPV1gCGKNYM/OS8isSWDNONHEX/LGqmNh+nLmBcYJuFyMXh5DADEaJ Zb+3M4E4LALzmCX2z5vHCuJICPSzSmxd8Iili5ETyMmTWHD8FzOEnSbxqWcHI4RdIdH+vhGsR khAS+LoqdmsEPYKJokX06K6GDk42ARMJGZ1SICERQSUJO6tmgy2jFlgPqNE06ReNpCEsECAxK tT/9lBbBYBVYkZa+cxgfTyCnhLTL3hBrFKTuLmuU6wEzgFfCRO999mg1jlLXFpZT/rBEbBBYw MqxjVi1OLylKLdC31kooy0zNKchMzc3QNDcz0clOLixPTU3MSk4r1kvNzNzECg40BCHYw3t0U cIhRkoNJSZS35v+pSCG+pPyUyozE4oz4otKc1OJDjDIcHEoSvPMcTkcKCRalpqdWpGXmAMMeJ i3BwaMkwnsNJM1bXJCYW5yZDpE6xWjPceHOpT9MHF96bwDJA3tuAcmOm3f/MAmx5OXnpUqJ81 aBtAmAtGWU5sENhcXpJUZZKWFeRqAzhXgKUotyM0tQ5V8xinMwKgnzLgSZwpOZVwK3+xXQWUx AZ/VOPQFyVkkiQkqqgbHl8rMtU3YmbHyfpvL45uzzv4JCQwo3bZ8nIDWt8sHLparnrtYX7UhI 7Z1ixDDpdfu6h1VGIbnrkiSv3Jxfe+hntUhSgdnBdfXrzq9z6XrEFPUucf7vb9YXP55IOPCn1 mn52wPTzVS2H7jpszLyaNu/hGk//yaFXrktskRHldmMV3HthLLd1Wk9SizFGYmGWsxFxYkAew cuJ84CAAA= X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-9.tower-27.messagelabs.com!1506492829!118773469!1 X-Originating-IP: [209.85.192.180] 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 12031 invoked from network); 27 Sep 2017 06:13:50 -0000 Received: from mail-pf0-f180.google.com (HELO mail-pf0-f180.google.com) (209.85.192.180) by server-9.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 27 Sep 2017 06:13:50 -0000 Received: by mail-pf0-f180.google.com with SMTP id b70so6746470pfl.8 for ; Tue, 26 Sep 2017 23:13:50 -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=4sd+jityzyLKl9T+2Zny6hdYes/xeKdW5J2msJXqt9U=; b=AN0QUx8GJs3uBEubDT+sDKCWRSllGssWlut9nRPIknZMEHkLtNuBFoFPrXiDBzYe1b KCtgoIWvDuHKcmcG3AEfiaZI4PmNLpG1JBAq8knuKcgYfzTU0aPKdVQ4F1YvWvXItYo7 N3f/BTumYj5UhIfAZHboT8I3rLnjDLB2TRJvs= 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=4sd+jityzyLKl9T+2Zny6hdYes/xeKdW5J2msJXqt9U=; b=VWKbcsT7fQOooKMlB/En2f09aPUsVhFzv1TzwYCRL5vBTbpfJ62Cb34gUCmCLgCQEE 6z0CRFfOYtVeKeV/V8aQoYyfMpZvOll0UJ7HYFVWEhjJ9VGB2zZTIbBtKp4GdYpBIijf bA0r+PrCViX+IkAPfUSEbSDzqn05fmvRrLh0BHbCGiCmostM73Av7DT4C152JjdxAPXL m65UfFPUHTchueGY/VafsS3b1FJQDjtJx/JQo9heZdW7QRQT+dN5Qq/oToup2dxhVxbJ YuXNH9JbbiiValEQOIMiwLsgVppTRlzGziXwUJ0o4sV6nq5hLgqyr1rX/v9R8KGJJIPR ui2Q== X-Gm-Message-State: AHPjjUjyR6+74LFSiztfHp164Jk7i7IaQKGs8wc3y/b+OcMBdlx1UxXe o0j2bVkQfoIwwRj3KnleN3r0ZYO8Shw= X-Google-Smtp-Source: AOwi7QC+ap6bnAsTaJFVORh6ndgzaPzvPFVaqck8po/9dliseEv0Nx1MoaxIAIjDyMDHrQZEA/+7PQ== X-Received: by 10.99.125.81 with SMTP id m17mr323845pgn.343.1506492828547; Tue, 26 Sep 2017 23:13:48 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com (h3.248.139.40.ip.windstream.net. [40.139.248.3]) by smtp.gmail.com with ESMTPSA id s187sm18013485pgb.82.2017.09.26.23.13.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Sep 2017 23:13:48 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 27 Sep 2017 11:43:16 +0530 Message-Id: <1506492816-25954-8-git-send-email-bhupinder.thakur@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506492816-25954-1-git-send-email-bhupinder.thakur@linaro.org> References: <1506492816-25954-1-git-send-email-bhupinder.thakur@linaro.org> Cc: Wei Liu , Julien Grall , Stefano Stabellini , Ian Jackson Subject: [Xen-devel] [PATCH 07/27 v11] 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 f4f64ad..0db9cd0 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 0ef54d2..9dcbe48 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1370,7 +1370,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++) { @@ -1380,6 +1380,13 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, &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 67b7afb..3473687 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 30a5cb2..1f878de 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 673a6d5..d144dd6 100644 --- a/tools/libxl/libxl_types_internal.idl +++ b/tools/libxl/libxl_types_internal.idl @@ -27,6 +27,7 @@ libxl__device_kind = Enumeration("device_kind", [ (10, "QUSB"), (11, "9PFS"), (12, "VDISPL"), + (13, "VUART"), ]) libxl__console_backend = Enumeration("console_backend", [