From patchwork Wed May 10 14:35:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhupinder Thakur X-Patchwork-Id: 99001 Delivered-To: patch@linaro.org Received: by 10.182.142.97 with SMTP id rv1csp234168obb; Wed, 10 May 2017 07:39:25 -0700 (PDT) X-Received: by 10.36.31.143 with SMTP id d137mr1696329itd.95.1494427165354; Wed, 10 May 2017 07:39:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494427165; cv=none; d=google.com; s=arc-20160816; b=eFfq/3NAxyl1y6QQUmcUaXWokL6uDjC+YwQJCcwvphYvEJ2hSzuzsDj4ysjX5lzQMw Umbmp4O92KhK7V7HTskVbtfmZe2gumnSi7jUpAKVkdx+SqonhdL77WklFq07/rpIRRs3 ib5hClwtBaS/pNqz/ehUGcfDdRSJBJYYBY83iEMLSXLAy8BduJBM3Y1TdhGDfGINj77J I49ov2I5v7QnDAW1euQ1h759gAvQLJWq2Jw/olPCr8QS/TVJMAkSM+LljrwNI9B9E8ZL 9sBSnA3OIxq8FTPsdiTH5+6Cf6XCKw9+EcfzWSY/0tIRT5TUgc6OD0nVZRklq808OCse BO4A== 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:message-id:date:to:from:dkim-signature :arc-authentication-results; bh=YmQsn5QEMwhdIcuS+XxbsfKjp/Z/CkkRCNQHLq4LItM=; b=Jv/cWzcufapaN7eJjS3+UptOBejgnxX3R8/Ag6eDMzONaIFpOzutFdcBHQsU1e/ijY oFqLsYBiqQGq08sjqVFRbn6nEzQkBsWqtc7Oedo/3btXL+o/cKdDUkJAfocaHvGX1swh Ugi3rucNT+ZVtsc537Jlq5yzP/CZgRWO3CPR2qw3axPNjN0mz4DFj7yja8L99Jortiey EdChGFr6FRfLn3i3YFAn5QRu/d1SHSfehZNittXP4kEACUG3ccrko0nTVShYu57/kOia vm2iu7tJztmG8/jeln3/DWj29kt6XlnNiCoIRDJ6BjZgkoIcjYXA//WN8cuKz4WbFPcL KODg== 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 201si3922747itw.49.2017.05.10.07.39.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 10 May 2017 07:39:25 -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 1d8SkB-0004jN-H7; Wed, 10 May 2017 14:37:35 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8SkA-0004iG-PY for xen-devel@lists.xenproject.org; Wed, 10 May 2017 14:37:34 +0000 Received: from [85.158.139.211] by server-15.bemta-5.messagelabs.com id 38/FF-01730-EA523195; Wed, 10 May 2017 14:37:34 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpjkeJIrShJLcpLzFFi42Lxqg3W1V2rKhx psHOPqMX3LZOZHBg9Dn+4whLAGMWamZeUX5HAmtFw0bbgjU9F19k2lgbGH2ZdjFwcQgIzGCU+ 333DBuKwCLQzS0y8O4kZxJEQeMcica3/OnsXIweQEyfxbF1GFyMnkFkpsermPRYQW0hAS+Loq dmsEJOamSQ+nT/OCFLPJmAiMatDAqRGREBJ4t6qyUwgNrOAt8SHI//YQWxhAX+Jo+9mM4PYLA KqElsungaL8wLVTDm7jxFil5zEzXOdzBMY+RYwMqxi1ChOLSpLLdI1tNRLKspMzyjJTczM0TU 0MNXLTS0uTkxPzUlMKtZLzs/dxAgMk3oGBsYdjI/6/Q4xSnIwKYny6u4SihTiS8pPqcxILM6I LyrNSS0+xCjDwaEkwRulIhwpJFiUmp5akZaZAwxYmLQEB4+SCG8zSJq3uCAxtzgzHSJ1ilGX4 9HKH++ZhFjy8vNSpcR5O0GKBECKMkrz4EbAoucSo6yUMC8jAwODEE9BalFuZgmq/CtGcQ5GJW FeWZApPJl5JXCbXgEdwQR0RCCDAMgRJYkIKakGxlkfBazj3rS/Co56VFvEe70xcXL2HPlVdu8 yloesNilWFxcWP3083zFdR0/R/U/klcjSDfZ/tkRx2/9l356yom7jQb7VzoU72qcXKU3jqjJY cTZo8fNu7yM3yk6LfxRoyFy2y058Y8VO4aD5Fu//S6/SSjodet7v+898yzt+1Zrpm5Lu9qjMV WIpzkg01GIuKk4EANiQ+ymZAgAA X-Env-Sender: bhupinder.thakur@linaro.org X-Msg-Ref: server-4.tower-206.messagelabs.com!1494427051!97288007!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.12; banners=-,-,- X-VirusChecked: Checked Received: (qmail 53111 invoked from network); 10 May 2017 14:37:33 -0000 Received: from mail-pg0-f45.google.com (HELO mail-pg0-f45.google.com) (74.125.83.45) by server-4.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 10 May 2017 14:37:33 -0000 Received: by mail-pg0-f45.google.com with SMTP id u28so17710925pgn.1 for ; Wed, 10 May 2017 07:37:32 -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=FE2nmDnhcMOMFKEcmeYebitEJNL/bFbJ3zZcPiKbL4U=; b=ccqHqZwLvX3jNelGr+rSeejZ0aBS/mUC4InMDWAEN7STbaAGJNZDB9jQCHgHBKFpbK 37ln69wDBWjNCIkbh3UOD0eC/CPcMOfH97v5yJXdTWYsnaaiM1hpq2uSgMB1MbBCxItk 7VT8I8YlvQvv08KWr6F7kc8JaM16el++kKZ5o= 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=FE2nmDnhcMOMFKEcmeYebitEJNL/bFbJ3zZcPiKbL4U=; b=VKd+0R5V+F383kYMkfCHUsEVovxsuzAWnYhd3kj+RsO0tUnIoRcy0bsTOG06VU5w+f pmJa4rzR53UBkKeI2Syt85PZjTHLWTZKRzUHZeZyZBexXRxrmQWHBpLsIqc26qY3bajK uKB3TQVVhFbnZWuiPfklSiXdimOrUKljjGCSgohNZAMj1msXzM9s5p1m/UiMzkrE0Ou2 CO1MZVUoq34ddtlBjPNnmkLIJXZl74MHg2k1oLKXbsUqfGOGCHVm9loAPhYkItMdenH+ 6VuDcnLZ632iJsES3HX0HZTKBrX/NAlapBlGfz0zzb5gZpBNVsSibgCo3JothczX5cTq fCoQ== X-Gm-Message-State: AODbwcBkMj0xZtgMMz+eZika1GYFPJf/x6AdbAVhVBsalTjscNOP6Gvy vW6SyGZdMc5RdXWI X-Received: by 10.84.232.76 with SMTP id f12mr8748531pln.101.1494427051320; Wed, 10 May 2017 07:37:31 -0700 (PDT) Received: from blr-ubuntu-linaro.wlan.qualcomm.com ([61.0.91.57]) by smtp.gmail.com with ESMTPSA id r73sm6167781pfa.65.2017.05.10.07.37.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 10 May 2017 07:37:30 -0700 (PDT) From: Bhupinder Thakur To: xen-devel@lists.xenproject.org Date: Wed, 10 May 2017 20:05:12 +0530 Message-Id: <1494426918-32737-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 06/12 v3] 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. Signed-off-by: Bhupinder Thakur --- tools/libxl/libxl_console.c | 33 ++++++++++++++++++++++++++ tools/libxl/libxl_create.c | 24 +++++++++++++++---- tools/libxl/libxl_device.c | 45 ++++++++++++++++++++++++++---------- tools/libxl/libxl_internal.h | 4 ++++ tools/libxl/libxl_types_internal.idl | 1 + 5 files changed, 91 insertions(+), 16 deletions(-) diff --git a/tools/libxl/libxl_console.c b/tools/libxl/libxl_console.c index 853be15..870cb9c 100644 --- a/tools/libxl/libxl_console.c +++ b/tools/libxl/libxl_console.c @@ -344,6 +344,39 @@ 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; + int rc; + + ro_front = 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(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, + NULL, + 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 29daa35..39da2d0 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1332,10 +1332,18 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, switch (d_config->c_info.type) { case LIBXL_DOMAIN_TYPE_HVM: { - libxl__device_console console; - libxl__device device; + libxl__device_console console, vuart; + libxl__device device, vuart_device; libxl_device_vkb vkb; + if (d_config->b_info.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); @@ -1369,14 +1377,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.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..bb25672 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); @@ -151,13 +154,19 @@ retry_transaction: if (rc) goto out; if (!libxl_only) { - rc = libxl__xs_write_checked(gc, t, GCSPRINTF("%s/frontend",libxl_path), - frontend_path); - if (rc) goto out; + if (fents || ro_fents) + { + rc = libxl__xs_write_checked(gc, t, GCSPRINTF("%s/frontend",libxl_path), + frontend_path); + if (rc) goto out; + } - rc = libxl__xs_write_checked(gc, t, GCSPRINTF("%s/backend",libxl_path), - backend_path); - if (rc) goto out; + if (bents) + { + rc = libxl__xs_write_checked(gc, t, GCSPRINTF("%s/backend",libxl_path), + backend_path); + if (rc) goto out; + } } /* xxx much of this function lacks error checks! */ @@ -170,14 +179,20 @@ 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 xs_set_permissions(ctx->xsh, t, frontend_path, frontend_perms, ARRAY_SIZE(frontend_perms)); - xs_write(ctx->xsh, t, GCSPRINTF("%s/backend", frontend_path), - backend_path, strlen(backend_path)); + /* + * Create backend node only if there are entries to be populated in the + * backend node. + */ + if (bents) + xs_write(ctx->xsh, t, GCSPRINTF("%s/backend", frontend_path), + backend_path, strlen(backend_path)); if (fents) libxl__xs_writev_perms(gc, t, frontend_path, fents, frontend_perms, ARRAY_SIZE(frontend_perms)); @@ -192,8 +207,13 @@ retry_transaction: xs_mkdir(ctx->xsh, t, backend_path); xs_set_permissions(ctx->xsh, t, backend_path, backend_perms, ARRAY_SIZE(backend_perms)); - xs_write(ctx->xsh, t, GCSPRINTF("%s/frontend", backend_path), - frontend_path, strlen(frontend_path)); + /* + * Create frontend node only if there are entries populated in the + * frontend node. + */ + if (fents || ro_fents) + xs_write(ctx->xsh, t, GCSPRINTF("%s/frontend", backend_path), + frontend_path, strlen(frontend_path)); libxl__xs_writev(gc, t, backend_path, bents); } @@ -800,7 +820,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", [