From: Bhupinder Thakur <bhupinder.thakur@linaro.org>
To: xen-devel@lists.xenproject.org
Cc: Wei Liu <wei.liu2@citrix.com>,
Julien Grall <julien.grall@arm.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Ian Jackson <ian.jackson@eu.citrix.com>
Subject: [PATCH 07/27 v10] xen/arm: vpl011: Add a new vuart node in the xenstore
Date: Fri, 22 Sep 2017 13:53:06 +0530 [thread overview]
Message-ID: <1506068606-17066-8-git-send-email-bhupinder.thakur@linaro.org> (raw)
In-Reply-To: <1506068606-17066-1-git-send-email-bhupinder.thakur@linaro.org>
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 <bhupinder.thakur@linaro.org>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Wei Liu <wei.liu2@citrix.com>
---
CC: Ian Jackson <ian.jackson@eu.citrix.com>
CC: Wei Liu <wei.liu2@citrix.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien.grall@arm.com>
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", [
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-09-22 8:23 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-22 8:22 [PATCH 00/27 v10] SBSA UART emulation support in Xen Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 01/27 v10] xen/arm: vpl011: Define common ring buffer helper functions in console.h Bhupinder Thakur
2017-09-22 22:44 ` Stefano Stabellini
2017-09-23 13:25 ` Julien Grall
2017-09-23 15:09 ` Bhupinder Thakur
2017-09-25 7:51 ` Jan Beulich
2017-09-25 7:49 ` Jan Beulich
2017-09-25 23:08 ` Bhupinder Thakur
2017-09-26 7:15 ` Jan Beulich
2017-09-26 8:16 ` Bhupinder Thakur
2017-09-26 11:41 ` Jan Beulich
2017-09-22 8:23 ` [PATCH 02/27 v10] xen/arm: vpl011: Add SBSA UART emulation in Xen Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 03/27 v10] xen/arm: vpl011: Allocate a new GFN in the toolstack for vuart Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 04/27 v10] xen/arm: vpl011: Add support for vuart in libxl Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 05/27 v10] xen/arm: vpl011: Rearrange xen header includes in alphabetical order in domctl.c Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 06/27 v10] xen/arm: vpl011: Add a new domctl API to initialize vpl011 Bhupinder Thakur
2017-09-22 8:28 ` Jan Beulich
2017-09-22 21:46 ` Stefano Stabellini
2017-09-25 8:38 ` Wei Liu
2017-09-22 8:23 ` Bhupinder Thakur [this message]
2017-09-22 8:23 ` [PATCH 08/27 v10] xen/arm: vpl011: Modify xenconsole to define and use a new console structure Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 09/27 v10] xen/arm: vpl011: Rename the console structure field conspath to xspath Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 10/27 v10] xen/arm: vpl011: Modify xenconsole functions to take console structure as input Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 11/27 v10] xen/arm: vpl011: Add a new console_init function in xenconsole Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 12/27 v10] xen/arm: vpl011: Add a new buffer_available " Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 13/27 v10] xen/arm: vpl011: Add a new maybe_add_console_evtchn_fd " Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 14/27 v10] xen/arm: vpl011: Add a new maybe_add_console_tty_fd " Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 15/27 v10] xen/arm: vpl011: Add a new console_evtchn_unmask " Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 16/27 v10] xen/arm: vpl011: Add a new handle_console_ring " Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 17/27 v10] xen/arm: vpl011: Add a new handle_console_tty " Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 18/27 v10] xen/arm: vpl011: Add a new console_cleanup " Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 19/27 v10] xen/arm: vpl011: Add a new console_open_log " Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 20/27 v10] xen/arm: vpl011: Add a new console_close_evtchn " Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 21/27 v10] xen/arm: vpl011: Add support for multiple consoles " Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 22/27 v10] xen/arm: vpl011: Add support for vuart console " Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 23/27 v10] xen/arm: vpl011: Add a new vuart console type to xenconsole client Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 24/27 v10] xen/arm: vpl011: Add a pl011 uart DT node in the guest device tree Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 25/27 v10] xen/arm: vpl011: Update documentation for vuart console support Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 26/27 v10] xen/arm: vpl011: Fix the slow early console SBSA UART output Bhupinder Thakur
2017-09-22 8:23 ` [PATCH 27/27 v10] xen/arm: vpl011: Correct the logic for asserting/de-asserting SBSA UART TX interrupt Bhupinder Thakur
2017-09-26 14:38 ` Dave Martin
2017-09-26 15:50 ` Julien Grall
2017-09-26 16:09 ` Dave Martin
2017-10-11 7:58 ` Bhupinder Thakur
2017-10-11 10:08 ` Dave Martin
2017-10-11 13:51 ` Bhupinder Thakur
2017-10-11 19:18 ` Dave Martin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1506068606-17066-8-git-send-email-bhupinder.thakur@linaro.org \
--to=bhupinder.thakur@linaro.org \
--cc=ian.jackson@eu.citrix.com \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).