[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 3/6] libxl: add backend type to vkb
From: Oleksandr Grytsov <oleksandr_grytsov@xxxxxxxx> New field backend_type is added to vkb device in order to have QEMU and user space backend simultaneously. Each vkb backend shall read appropriate XS entry and service only own frontends. Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@xxxxxxxx> --- tools/libxl/libxl_create.c | 4 ++++ tools/libxl/libxl_dm.c | 2 ++ tools/libxl/libxl_types.idl | 7 +++++++ tools/libxl/libxl_vkb.c | 10 +++++++++- tools/xl/xl_parse.c | 4 ++++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index f813114..7268f7f 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -1349,6 +1349,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, } libxl_device_vkb_init(&vkb); + vkb.backend_type = LIBXL_VKB_BACKEND_QEMU; libxl__device_add(gc, domid, &libxl__vkb_devtype, &vkb); libxl_device_vkb_dispose(&vkb); @@ -1376,6 +1377,9 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, for (i = 0; i < d_config->num_vfbs; i++) { libxl__device_add(gc, domid, &libxl__vfb_devtype, &d_config->vfbs[i]); + } + + for (i = 0; i < d_config->num_vkbs; i++) { libxl__device_add(gc, domid, &libxl__vkb_devtype, &d_config->vkbs[i]); } diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 98f89a9..d8b0ee7 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -1728,6 +1728,8 @@ static int libxl__vfb_and_vkb_from_hvm_guest_config(libxl__gc *gc, vkb->backend_domid = 0; vkb->devid = 0; + vkb->backend_type = LIBXL_VKB_BACKEND_QEMU; + return 0; } diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index cd0c06f..65cd81a 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -240,6 +240,12 @@ libxl_checkpointed_stream = Enumeration("checkpointed_stream", [ (2, "COLO"), ]) +libxl_vkb_backend = Enumeration("vkb_backend", [ + (0, "UNKNOWN"), + (1, "QEMU"), + (2, "LINUX") + ]) + # # Complex libxl types # @@ -603,6 +609,7 @@ libxl_device_vkb = Struct("device_vkb", [ ("backend_domid", libxl_domid), ("backend_domname", string), ("devid", libxl_devid), + ("backend_type", libxl_vkb_backend) ]) libxl_device_disk = Struct("device_disk", [ diff --git a/tools/libxl/libxl_vkb.c b/tools/libxl/libxl_vkb.c index ea6fca8..07b5428 100644 --- a/tools/libxl/libxl_vkb.c +++ b/tools/libxl/libxl_vkb.c @@ -34,6 +34,13 @@ static int libxl__device_from_vkb(libxl__gc *gc, uint32_t domid, return 0; } +static int libxl__device_vkb_dm_needed(libxl_device_vkb *vkb, uint32_t domid) +{ + if (vkb->backend_type == LIBXL_VKB_BACKEND_QEMU) + return 1; + return 0; +} + int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb, const libxl_asyncop_how *ao_how) { @@ -60,7 +67,8 @@ static LIBXL_DEFINE_UPDATE_DEVID(vkb, "vkbd") LIBXL_DEFINE_DEVICE_REMOVE(vkb) DEFINE_DEVICE_TYPE_STRUCT_X(vkb, vkb, vkbd - .skip_attach = 1 + .skip_attach = 1, + .dm_needed = (device_dm_needed_fn_t)libxl__device_vkb_dm_needed ); /* diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index d4c2efb..7cfd7fd 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -1941,6 +1941,8 @@ skip_nic: vkb = ARRAY_EXTEND_INIT(d_config->vkbs, d_config->num_vkbs, libxl_device_vkb_init); + vkb->backend_type = LIBXL_VKBD_BACKEND_QEMU; + p = strtok(buf2, ","); if (!p) goto skip_vfb; @@ -2272,6 +2274,8 @@ skip_usbdev: vkb = ARRAY_EXTEND_INIT(d_config->vkbs, d_config->num_vkbs, libxl_device_vkb_init); + vkb->backend_type = LIBXL_VKBD_BACKEND_QEMU; + parse_top_level_vnc_options(config, &vfb->vnc); parse_top_level_sdl_options(config, &vfb->sdl); xlu_cfg_replace_string (config, "keymap", &vfb->keymap, 0); -- 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |