Skip to contentSkip to conversation

libxl: create standalone vkb device

PATCH In review Oleksandr Grytsov 2 participants 16 messages Oct 5, 2017 – Oct 31, 2017

lore
Share & tools
lore
#3 lore raw

PATCH 2/6 libxl: fix vkb XS entry and type

In reply to Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

vkb has vkbd name in XS.

---
 tools/libxl/libxl_vkb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/libxl/libxl_vkb.c +2 -2
index 0d01262..ea6fca8 100644
@@ -51,7 +51,7 @@ out:
     return AO_INPROGRESS;
 }
 
-static LIBXL_DEFINE_UPDATE_DEVID(vkb, "vkb")
+static LIBXL_DEFINE_UPDATE_DEVID(vkb, "vkbd")
 
 #define libxl__add_vkbs NULL
 #define libxl_device_vkb_list NULL
@@ -59,7 +59,7 @@ static LIBXL_DEFINE_UPDATE_DEVID(vkb, "vkb")
 
 LIBXL_DEFINE_DEVICE_REMOVE(vkb)
 
-DEFINE_DEVICE_TYPE_STRUCT(vkb,
+DEFINE_DEVICE_TYPE_STRUCT_X(vkb, vkb, vkbd
     .skip_attach = 1
 );
 
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#0 lore raw

cover libxl: create standalone vkb device

From: Oleksandr Grytsov <[email protected]>

Currently vkb device is the part of FB and console. In embedded application we use vkb protocol to communicate with user space backend. For this purpose we need to have possibility to enable vkb device without QEMU, FB etc.

This particular issue was already discussed int the mail thread [1]. There were few possible solutions. We've implemented one suggested by Stefano: add "type" field for vkb. Each backend (QEMU or user space) shall read this field and serve frontend only for own type. I will provide the patch for QEMU backend, once this solution is submitted to libxl.

This patchset consist of following changes:

* vkb related code is moved to libxl_vkb.c - as it now used not only by console and FB;
* add backend type support in order to support QEMU and user space backends;
* add getting vkb list and getting device by id in order to implement CLI commands to attach, detach and list vkb devices;
* add new vkb entry in xl.cfg to handle separate vkb configuration;
* add CLI vkb-attach, vkb-detach and vkb-list commands;
* update documentation accordingly.

[1] https://marc.info/?l=qemu-devel&m=149219237030212&w=2

Oleksandr Grytsov (6):
libxl: move vkb device to libxl_vkb.c
libxl: fix vkb XS entry and type
libxl: add backend type to vkb
libxl: vkb add list and info functions
xl: add vkb config parser and CLI
docs: add vkb device to xl.cfg and xl

 docs/man/xl.cfg.pod.5.in    |  24 ++++++
 docs/man/xl.pod.1.in        |  22 ++++++
 tools/libxl/Makefile        |   1 +
 tools/libxl/libxl.h         |  10 +++
 tools/libxl/libxl_console.c |  53 -------------
 tools/libxl/libxl_create.c  |   4 +
 tools/libxl/libxl_dm.c      |   2 +
 tools/libxl/libxl_types.idl |  18 +++++s
 tools/libxl/libxl_utils.h   |   3 +
 tools/libxl/libxl_vkb.c     | 180 ++++++++++++++++++++++++++++++++++++++++++++
 tools/xl/Makefile           |   2 +-
 tools/xl/xl.h               |   3 +
 tools/xl/xl_cmdtable.c      |  15 ++++
 tools/xl/xl_parse.c         |  77 ++++++++++++++++++-
 tools/xl/xl_parse.h         |   2 +-
 tools/xl/xl_vkb.c           | 141 ++++++++++++++++++++++++++++++++++
 16 files changed, 501 insertions(+), 56 deletions(-)
 create mode 100644 tools/libxl/libxl_vkb.c
 create mode 100644 tools/xl/xl_vkb.c
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#8 lore raw

PATCH 3/6 libxl: add backend type to vkb

From: Oleksandr Grytsov <[email protected]>

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.

---
 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(-)
tools/libxl/libxl_create.c +4 -0
index f813114..7268f7f 100644
@@ -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]);
         }
tools/libxl/libxl_dm.c +2 -0
index 98f89a9..d8b0ee7 100644
@@ -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;
 }
 
tools/libxl/libxl_types.idl +7 -0
index cd0c06f..65cd81a 100644
@@ -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", [
tools/libxl/libxl_vkb.c +9 -1
index ea6fca8..07b5428 100644
@@ -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
 );
 
 /*
tools/xl/xl_parse.c +4 -0
index d4c2efb..7cfd7fd 100644
@@ -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);
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#11 lore raw

PATCH 4/6 libxl: vkb add list and info functions

In reply to Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

---
 tools/libxl/libxl.h         |  10 +++++
 tools/libxl/libxl_types.idl |  11 +++++
 tools/libxl/libxl_utils.h   |   3 ++
 tools/libxl/libxl_vkb.c     | 106 ++++++++++++++++++++++++++++++++++++++++++--
 4 files changed, 127 insertions(+), 3 deletions(-)
tools/libxl/libxl.h +10 -0
index acb73ce..f2f8442 100644
@@ -1950,6 +1950,16 @@ int libxl_device_vkb_destroy(libxl_ctx *ctx, uint32_t domid,
                              const libxl_asyncop_how *ao_how)
                             LIBXL_EXTERNAL_CALLERS_ONLY;
 
+libxl_device_vkb *libxl_device_vkb_list(libxl_ctx *ctx,
+                                        uint32_t domid, int *num)
+                                        LIBXL_EXTERNAL_CALLERS_ONLY;
+void libxl_device_vkb_list_free(libxl_device_vkb* list, int num)
+                                LIBXL_EXTERNAL_CALLERS_ONLY;
+int libxl_device_vkb_getinfo(libxl_ctx *ctx, uint32_t domid,
+                             libxl_device_vkb *vkb,
+                             libxl_vkbinfo *vkbinfo)
+                             LIBXL_EXTERNAL_CALLERS_ONLY;
+
 /* Framebuffer */
 int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb,
                          const libxl_asyncop_how *ao_how)
tools/libxl/libxl_types.idl +11 -0
index 65cd81a..a647bfc 100644
@@ -1014,6 +1014,17 @@ libxl_vsndinfo = Struct("vsndinfo", [
     ("pcms", Array(libxl_pcminfo, "num_vsnd_pcms"))
     ])
 
+libxl_vkbinfo = Struct("vkbinfo", [
+    ("backend", string),
+    ("backend_id", uint32),
+    ("frontend", string),
+    ("frontend_id", uint32),
+    ("devid", libxl_devid),
+    ("state", integer),
+    ("evtch", integer),
+    ("rref", integer)
+    ], dir=DIR_OUT)
+
 # NUMA node characteristics: size and free are how much memory it has, and how
 # much of it is free, respectively. dists is an array of distances from this
 # node to each other node.
tools/libxl/libxl_utils.h +3 -0
index 5455752..44409af 100644
@@ -79,6 +79,9 @@ int libxl_devid_to_device_vtpm(libxl_ctx *ctx, uint32_t domid,
 int libxl_devid_to_device_usbctrl(libxl_ctx *ctx, uint32_t domid,
                                   int devid, libxl_device_usbctrl *usbctrl);
 
+int libxl_devid_to_device_vkb(libxl_ctx *ctx, uint32_t domid,
+                              int devid, libxl_device_vkb *vkb);
+
 int libxl_devid_to_device_vdispl(libxl_ctx *ctx, uint32_t domid,
                                  int devid, libxl_device_vdispl *vdispl);
 
tools/libxl/libxl_vkb.c +103 -3

132 lines not on this page · raw message

Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#12 lore raw

PATCH 5/6 xl: add vkb config parser and CLI

In reply to Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

---
 tools/xl/Makefile      |   2 +-
 tools/xl/xl.h          |   3 ++
 tools/xl/xl_cmdtable.c |  15 ++++++
 tools/xl/xl_parse.c    |  77 +++++++++++++++++++++++++--
 tools/xl/xl_parse.h    |   2 +-
 tools/xl/xl_vkb.c      | 141 +++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 235 insertions(+), 5 deletions(-)
 create mode 100644 tools/xl/xl_vkb.c
tools/xl/Makefile +1 -1
index 66bdbde..2769295 100644
@@ -22,7 +22,7 @@ XL_OBJS += xl_vtpm.o xl_block.o xl_nic.o xl_usb.o
 XL_OBJS += xl_sched.o xl_pci.o xl_vcpu.o xl_cdrom.o xl_mem.o
 XL_OBJS += xl_info.o xl_console.o xl_misc.o
 XL_OBJS += xl_vmcontrol.o xl_saverestore.o xl_migrate.o
-XL_OBJS += xl_vdispl.o xl_vsnd.o
+XL_OBJS += xl_vdispl.o xl_vsnd.o xl_vkb.o
 
 $(XL_OBJS): CFLAGS += $(CFLAGS_libxentoollog)
 $(XL_OBJS): CFLAGS += $(CFLAGS_XL)
tools/xl/xl.h +3 -0
index 703caa6..826e9c1 100644
@@ -170,6 +170,9 @@ int main_vtpmdetach(int argc, char **argv);
 int main_vdisplattach(int argc, char **argv);
 int main_vdispllist(int argc, char **argv);
 int main_vdispldetach(int argc, char **argv);
+int main_vkbattach(int argc, char **argv);
+int main_vkblist(int argc, char **argv);
+int main_vkbdetach(int argc, char **argv);
 int main_vsndattach(int argc, char **argv);
 int main_vsndlist(int argc, char **argv);
 int main_vsnddetach(int argc, char **argv);
tools/xl/xl_cmdtable.c +15 -0
index 8e162ce..f495e55 100644
@@ -378,6 +378,21 @@ struct cmd_spec cmd_table[] = {
       "Destroy a domain's virtual TPM device",
       "<Domain> <DevId|uuid>",
     },
+    { "vkb-attach",
+      &main_vkbattach, 1, 1,
+      "Create a new virtual keyboard device",
+      "<Domain> [backend-type=<BackendType>] [backend=<BackDomain>]",
+    },
+    { "vkb-list",
+      &main_vkblist, 0, 0,
+      "List virtual keyboard devices for a domain",
+      "<Domain(s)>",
+    },
+    { "vkb-detach",
+      &main_vkbdetach, 0, 1,
+      "Destroy a domain's virtual keyboard device",
+      "<Domain> <DevId>",
+    },
     { "vdispl-attach",
       &main_vdisplattach, 1, 1,
       "Create a new virtual display device",
tools/xl/xl_parse.c +74 -3

101 lines not on this page · raw message

tools/xl/xl_parse.h +1 -1
index 9a948ea..19f453a 100644
@@ -35,7 +35,7 @@ int parse_cpurange(const char *cpu, libxl_bitmap *cpumap);
 int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token);
 int parse_vdispl_config(libxl_device_vdispl *vdispl, char *token);
 int parse_vsnd_item(libxl_device_vsnd *vsnd, const char *spec);
-
+int parse_vkb_config(libxl_device_vkb *vkb, char *token);
 int match_option_size(const char *prefix, size_t len,
                       char *arg, char **argopt);
 #define MATCH_OPTION(prefix, arg, oparg) \
tools/xl/xl_vkb.c new file +141 -0

141 lines not on this page · raw message

Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#13 lore raw

PATCH 6/6 docs: add vkb device to xl.cfg and xl

In reply to Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

---
 docs/man/xl.cfg.pod.5.in | 24 ++++++++++++++++++++++++
 docs/man/xl.pod.1.in     | 22 ++++++++++++++++++++++
 2 files changed, 46 insertions(+)
docs/man/xl.cfg.pod.5.in +24 -0
index 4948dd7..a9e10aa 100644
@@ -1317,6 +1317,30 @@ I<EXAMPLE:>
 
 =back
 
+=over 4
+
+=item B<vkb=[ "VKB_SPEC_STRING", "VKB_SPEC_STRING", ...]>
+
+Specifies the virtual keyboard device to be provided to the guest.
+
+Each B<VKB_SPEC_STRING> is a comma-separated list of C<KEY=VALUE>
+settings from the following list:
+
+=over 4
+
+=item B<backend=domain-id>
+
+Specifies the backend domain name or id.
+
+=item B<backend-type=type>
+
+Specifies the backend type: qemu - for QEMU backend or linux - for Linux PV
+domain.
+
+=back
+
+=back
+
 =head2 Paravirtualised (PV) Guest Specific Options
 
 The following options apply only to Paravirtual (PV) guests.
docs/man/xl.pod.1.in +22 -0
index 0a88fd5..17b1e53 100644
@@ -1506,6 +1506,28 @@ List vsnd devices for a domain.
 
 =back
 
+=head2 KEYBOARD DEVICES
+
+=over 4
+
+=item B<vkb-attach> I<domain-id> I<vkb-device>
+
+Creates a new keyboard device in the domain specified by I<domain-id>.
+I<vkb-device> describes the device to attach, using the same format as the
+B<VKB_SPEC_STRING> string in the domain config file. See L<xl.cfg(5)>
+for more informations.
+
+=item B<vkb-detach> I<domain-id> I<devid>
+
+Removes the keyboard device from the domain specified by I<domain-id>.
+I<devid> is the virtual interface device number within the domain
+
+=item B<vkb-list> I<domain-id>
+
+List virtual network interfaces for a domain.
+
+=back
+
 =head1 PCI PASS-THROUGH
 
 =over 4
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

PATCH 1/6 libxl: move vkb device to libxl_vkb.c

In reply to Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

Logically it is better to move vkb to
separate file as vkb device used not only by vfb
and console.

---
 tools/libxl/Makefile        |  1 +
 tools/libxl/libxl_console.c | 53 ---------------------------------
 tools/libxl/libxl_vkb.c     | 72 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 73 insertions(+), 53 deletions(-)
 create mode 100644 tools/libxl/libxl_vkb.c
tools/libxl/Makefile +1 -0
index 2d52435..df1b710 100644
@@ -139,6 +139,7 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
 			libxl_vtpm.o libxl_nic.o libxl_disk.o libxl_console.o \
 			libxl_cpupool.o libxl_mem.o libxl_sched.o libxl_tmem.o \
 			libxl_9pfs.o libxl_domain.o libxl_vdispl.o libxl_vsnd.o \
+			libxl_vkb.o \
                         $(LIBXL_OBJS-y)
 LIBXL_OBJS += libxl_genid.o
 LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
tools/libxl/libxl_console.c +0 -53

71 lines not on this page · raw message

tools/libxl/libxl_vkb.c new file +72 -0

72 lines not on this page · raw message

Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#4 lore raw

Re: [PATCH 2/6] libxl: fix vkb XS entry and type

In reply to Oleksandr Grytsov
Quoted 5 lines · Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

vkb has vkbd name in XS.

This series won't make it to 4.10 but this issue should be fixed right away -- assuming the patch is correct.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw

Re: [PATCH 2/6] libxl: fix vkb XS entry and type

Quoted 9 lines · Wei Liu
Quoted 5 lines · Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

vkb has vkbd name in XS.

This series won't make it to 4.10 but this issue should be fixed right away -- assuming the patch is correct.

Ok. I will send just this fix as another patchset.

Signature · 7 lines
Best Regards,
Oleksandr Grytsov.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#6 lore raw

Re: [PATCH 2/6] libxl: fix vkb XS entry and type

Quoted 11 lines · Oleksandr Grytsov
Quoted 9 lines · Wei Liu
Quoted 5 lines · Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

vkb has vkbd name in XS.

This series won't make it to 4.10 but this issue should be fixed right away -- assuming the patch is correct.

Quoted 6 lines

Ok. I will send just this fix as another patchset.

--
Best Regards,
Oleksandr Grytsov.

Actually in current implementation it is not possible to create more than one vkb per domain.
It means this issue will not happen any case.

So, I'm ok to wait with all this patchset for next release.

Signature · 7 lines
Best Regards,
Oleksandr Grytsov.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#14 lore raw
In reply to Oleksandr Grytsov
Quoted 59 lines · Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

Currently vkb device is the part of FB and console. In embedded application we use vkb protocol to communicate with user space backend. For this purpose we need to have possibility to enable vkb device without QEMU, FB etc.

This particular issue was already discussed int the mail thread [1]. There were few possible solutions. We've implemented one suggested by Stefano: add "type" field for vkb. Each backend (QEMU or user space) shall read this field and serve frontend only for own type. I will provide the patch for QEMU backend, once this solution is submitted to libxl.

This patchset consist of following changes:

* vkb related code is moved to libxl_vkb.c - as it now used not only by console and FB;
* add backend type support in order to support QEMU and user space backends;
* add getting vkb list and getting device by id in order to implement CLI commands to attach, detach and list vkb devices;
* add new vkb entry in xl.cfg to handle separate vkb configuration;
* add CLI vkb-attach, vkb-detach and vkb-list commands;
* update documentation accordingly.

[1] https://marc.info/?l=qemu-devel&m=149219237030212&w=2

Oleksandr Grytsov (6):
libxl: move vkb device to libxl_vkb.c
libxl: fix vkb XS entry and type
libxl: add backend type to vkb
libxl: vkb add list and info functions
xl: add vkb config parser and CLI
docs: add vkb device to xl.cfg and xl

 docs/man/xl.cfg.pod.5.in    |  24 ++++++
 docs/man/xl.pod.1.in        |  22 ++++++
 tools/libxl/Makefile        |   1 +
 tools/libxl/libxl.h         |  10 +++
 tools/libxl/libxl_console.c |  53 -------------
 tools/libxl/libxl_create.c  |   4 +
 tools/libxl/libxl_dm.c      |   2 +
 tools/libxl/libxl_types.idl |  18 +++++s
 tools/libxl/libxl_utils.h   |   3 +
 tools/libxl/libxl_vkb.c     | 180 ++++++++++++++++++++++++++++++
++++++++++++++
 tools/xl/Makefile           |   2 +-
 tools/xl/xl.h               |   3 +
 tools/xl/xl_cmdtable.c      |  15 ++++
 tools/xl/xl_parse.c         |  77 ++++++++++++++++++-
 tools/xl/xl_parse.h         |   2 +-
 tools/xl/xl_vkb.c           | 141 ++++++++++++++++++++++++++++++++++
 16 files changed, 501 insertions(+), 56 deletions(-)
 create mode 100644 tools/libxl/libxl_vkb.c
 create mode 100644 tools/xl/xl_vkb.c
Quoted 4 lines

--
2.7.4

ping

Signature · 2 lines
Best Regards,
Oleksandr Grytsov.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#15 lore raw
Quoted 66 lines · Oleksandr Grytsov
Quoted 59 lines · Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

Currently vkb device is the part of FB and console. In embedded application we use vkb protocol to communicate with user space backend. For this purpose we need to have possibility to enable vkb device without QEMU, FB etc.

This particular issue was already discussed int the mail thread [1]. There were few possible solutions. We've implemented one suggested by Stefano: add "type" field for vkb. Each backend (QEMU or user space) shall read this field and serve frontend only for own type. I will provide the patch for QEMU backend, once this solution is submitted to libxl.

This patchset consist of following changes:

* vkb related code is moved to libxl_vkb.c - as it now used not only by console and FB;
* add backend type support in order to support QEMU and user space backends;
* add getting vkb list and getting device by id in order to implement CLI commands to attach, detach and list vkb devices;
* add new vkb entry in xl.cfg to handle separate vkb configuration;
* add CLI vkb-attach, vkb-detach and vkb-list commands;
* update documentation accordingly.

[1] https://marc.info/?l=qemu-devel&m=149219237030212&w=2

Oleksandr Grytsov (6):
libxl: move vkb device to libxl_vkb.c
libxl: fix vkb XS entry and type
libxl: add backend type to vkb
libxl: vkb add list and info functions
xl: add vkb config parser and CLI
docs: add vkb device to xl.cfg and xl

 docs/man/xl.cfg.pod.5.in    |  24 ++++++
 docs/man/xl.pod.1.in        |  22 ++++++
 tools/libxl/Makefile        |   1 +
 tools/libxl/libxl.h         |  10 +++
 tools/libxl/libxl_console.c |  53 -------------
 tools/libxl/libxl_create.c  |   4 +
 tools/libxl/libxl_dm.c      |   2 +
 tools/libxl/libxl_types.idl |  18 +++++s
 tools/libxl/libxl_utils.h   |   3 +
 tools/libxl/libxl_vkb.c     | 180 ++++++++++++++++++++++++++++++
++++++++++++++
 tools/xl/Makefile           |   2 +-
 tools/xl/xl.h               |   3 +
 tools/xl/xl_cmdtable.c      |  15 ++++
 tools/xl/xl_parse.c         |  77 ++++++++++++++++++-
 tools/xl/xl_parse.h         |   2 +-
 tools/xl/xl_vkb.c           | 141 ++++++++++++++++++++++++++++++++++
 16 files changed, 501 insertions(+), 56 deletions(-)
 create mode 100644 tools/libxl/libxl_vkb.c
 create mode 100644 tools/xl/xl_vkb.c
Quoted 4 lines

--
2.7.4

Quoted 6 lines

ping

--
Best Regards,
Oleksandr Grytsov.

ping

Signature · 2 lines
Best Regards,
Oleksandr Grytsov.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by on v1 1/6
#2 lore raw

Re: [PATCH 1/6] libxl: move vkb device to libxl_vkb.c

In reply to Oleksandr Grytsov
Quoted 7 lines · Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

Logically it is better to move vkb to
separate file as vkb device used not only by vfb
and console.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#9 lore raw

Re: [PATCH 3/6] libxl: add backend type to vkb

In reply to Oleksandr Grytsov
Quoted 22 lines · Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

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.

---
 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(-)
tools/libxl/libxl_create.c +0 -0
index f813114..7268f7f 100644

tools/libxl/libxl_create.c static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, · line 1352

Quoted 4 lines
tools/libxl/libxl_create.c +1 -0
@@ -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;

Hmm... See below.

Quoted 31 lines
tools/libxl/libxl_create.c +3 -0
         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]);
         }
tools/libxl/libxl_dm.c +2 -0
index 98f89a9..d8b0ee7 100644
@@ -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;
 }
 
tools/libxl/libxl_types.idl +0 -0
index cd0c06f..65cd81a 100644

tools/libxl/libxl_types.idl libxl_checkpointed_stream = Enumeration("checkpointed_stream", [ · line 247

Quoted 8 lines
tools/libxl/libxl_types.idl +5 -0
@@ -240,6 +240,12 @@ libxl_checkpointed_stream = Enumeration("checkpointed_stream", [
     (2, "COLO"),
     ])
 
+libxl_vkb_backend = Enumeration("vkb_backend", [
+    (0, "UNKNOWN"),
+    (1, "QEMU"),
+    (2, "LINUX")
+    ])

Originally this is only internal detail, but now you want to expose this. You need to set the default value for this; otherwise you could break migration.

And then you also need to provide a setdefault function for libxl_device_vkb.

Also I'm a bit confused because the LINUX type is not used in this series.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#10 lore raw

Re: [PATCH 3/6] libxl: add backend type to vkb

Quoted 74 lines · Wei Liu

tools/libxl/libxl_create.c static void domcreate_launch_dm(libxl__egc *egc,

Quoted 22 lines · Oleksandr Grytsov

From: Oleksandr Grytsov <[email protected]>

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.

---
 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(-)
tools/libxl/libxl_create.c +0 -0
index f813114..7268f7f 100644
@@ -1349,6 +1349,7 @@ static void domcreate_launch_dm(libxl__egc *egc,

libxl__multidev *multidev,

tools/libxl/libxl_create.c static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, · line 1352

Quoted 4 lines
tools/libxl/libxl_create.c +1 -0
         }
 
         libxl_device_vkb_init(&vkb);
+        vkb.backend_type = LIBXL_VKB_BACKEND_QEMU;

Hmm... See below.

tools/libxl/libxl_create.c static void domcreate_launch_dm(libxl__egc *egc,

Quoted 4 lines
tools/libxl/libxl_create.c +0 -0
         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,

tools/libxl/libxl_dm.c static int libxl__vfb_and_vkb_from_hvm_guest_config(libxl__gc

Quoted 14 lines
tools/libxl/libxl_create.c +3 -0
         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]);
         }
tools/libxl/libxl_dm.c +0 -0
index 98f89a9..d8b0ee7 100644
@@ -1728,6 +1728,8 @@ static int libxl__vfb_and_vkb_from_hvm_guest_config(libxl__gc

*gc,

tools/libxl/libxl_types.idl libxl_checkpointed_stream =

Quoted 13 lines
tools/libxl/libxl_dm.c +2 -0
     vkb->backend_domid = 0;
     vkb->devid = 0;
+    vkb->backend_type = LIBXL_VKB_BACKEND_QEMU;
+
     return 0;
 }
 
tools/libxl/libxl_types.idl +0 -0
index cd0c06f..65cd81a 100644
@@ -240,6 +240,12 @@ libxl_checkpointed_stream =

Enumeration("checkpointed_stream", [

tools/libxl/libxl_types.idl libxl_checkpointed_stream = Enumeration("checkpointed_stream", [ · line 247

Quoted 8 lines
tools/libxl/libxl_types.idl +5 -0
     (2, "COLO"),
     ])
 
+libxl_vkb_backend = Enumeration("vkb_backend", [
+    (0, "UNKNOWN"),
+    (1, "QEMU"),
+    (2, "LINUX")
+    ])
Quoted 4 lines

Originally this is only internal detail, but now you want to expose this. You need to set the default value for this; otherwise you could break migration.

Yes, I will set default to QEMU.

Quoted 7 lines

And then you also need to provide a setdefault function for libxl_device_vkb.

Also I'm a bit confused because the LINUX type is not used in this series.

LINUX type will be used by the linux backend. libxl just set the xenstore entry.
The linux backend will service only frontend which has LINUX type.

Signature · 2 lines
Best Regards,
Oleksandr Grytsov.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel