diff mbox series

[v2,1/3] libxl: introduce new backend type VINPUT

Message ID 20191121181300.6497-2-al1img@gmail.com (mailing list archive)
State New, archived
Headers show
Series Remove backend xen store entry on domain destroy | expand

Commit Message

Oleksandr Grytsov Nov. 21, 2019, 6:12 p.m. UTC
From: Oleksandr Grytsov <oleksandr_grytsov@epam.com>

There are two kind of VKBD devices: with QEMU backend and user space PV
backend. In current implementation they can't be distinguished as both use
VKBD backend type. As result, user space PV KBD backend is started and
stopped as QEMU backend. This commit adds new device kind VINPUT to be
used as backend type for user space PV KBD backend.

Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 tools/libxl/libxl_types_internal.idl |  1 +
 tools/libxl/libxl_vkb.c              | 29 ++++++++++++++++++----------
 2 files changed, 20 insertions(+), 10 deletions(-)

Comments

Anthony PERARD Nov. 22, 2019, 3:18 p.m. UTC | #1
On Thu, Nov 21, 2019 at 08:12:58PM +0200, Oleksandr Grytsov wrote:
> From: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
> 
> There are two kind of VKBD devices: with QEMU backend and user space PV
> backend. In current implementation they can't be distinguished as both use
> VKBD backend type. As result, user space PV KBD backend is started and
> stopped as QEMU backend. This commit adds new device kind VINPUT to be
> used as backend type for user space PV KBD backend.
> 
> Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

That patch removes the "backend-type" node from xenstore but it wasn't
part of the api (kbdif.h) and qemu doesn't read, it so I guess that's
fine:

Acked-by: Anthony PERARD <anthony.perard@citrix.com>

Thanks,
Jürgen Groß Nov. 22, 2019, 3:43 p.m. UTC | #2
On 22.11.19 16:18, Anthony PERARD wrote:
> On Thu, Nov 21, 2019 at 08:12:58PM +0200, Oleksandr Grytsov wrote:
>> From: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
>>
>> There are two kind of VKBD devices: with QEMU backend and user space PV
>> backend. In current implementation they can't be distinguished as both use
>> VKBD backend type. As result, user space PV KBD backend is started and
>> stopped as QEMU backend. This commit adds new device kind VINPUT to be
>> used as backend type for user space PV KBD backend.
>>
>> Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
>> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
> 
> That patch removes the "backend-type" node from xenstore but it wasn't
> part of the api (kbdif.h) and qemu doesn't read, it so I guess that's
> fine:
> 
> Acked-by: Anthony PERARD <anthony.perard@citrix.com>

Release-acked-by: Juergen Gross <jgross@suse.com>


Juergen
Wei Liu Nov. 22, 2019, 4:44 p.m. UTC | #3
On Fri, Nov 22, 2019 at 04:43:03PM +0100, Jürgen Groß wrote:
> On 22.11.19 16:18, Anthony PERARD wrote:
> > On Thu, Nov 21, 2019 at 08:12:58PM +0200, Oleksandr Grytsov wrote:
> > > From: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
> > > 
> > > There are two kind of VKBD devices: with QEMU backend and user space PV
> > > backend. In current implementation they can't be distinguished as both use
> > > VKBD backend type. As result, user space PV KBD backend is started and
> > > stopped as QEMU backend. This commit adds new device kind VINPUT to be
> > > used as backend type for user space PV KBD backend.
> > > 
> > > Signed-off-by: Oleksandr Grytsov <oleksandr_grytsov@epam.com>
> > > Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
> > 
> > That patch removes the "backend-type" node from xenstore but it wasn't
> > part of the api (kbdif.h) and qemu doesn't read, it so I guess that's
> > fine:
> > 
> > Acked-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> Release-acked-by: Juergen Gross <jgross@suse.com>

I take it this applies to both patch 1 and 3?

Wei.

> 
> 
> Juergen
Ian Jackson Nov. 22, 2019, 6:08 p.m. UTC | #4
Wei Liu writes ("Re: [Xen-devel] [PATCH v2 1/3] libxl: introduce new backend type VINPUT"):
> On Fri, Nov 22, 2019 at 04:43:03PM +0100, Jürgen Groß wrote:
> > Release-acked-by: Juergen Gross <jgross@suse.com>
> 
> I take it this applies to both patch 1 and 3?

In the absence of a reply to the contrary by 21:00 UTC today, I will
assume this to be the case and push this to staging.  I hope that
meets with everyone's approval.

Ian.
Wei Liu Nov. 25, 2019, 11:01 a.m. UTC | #5
On Fri, Nov 22, 2019 at 06:08:13PM +0000, Ian Jackson wrote:
> Wei Liu writes ("Re: [Xen-devel] [PATCH v2 1/3] libxl: introduce new backend type VINPUT"):
> > On Fri, Nov 22, 2019 at 04:43:03PM +0100, Jürgen Groß wrote:
> > > Release-acked-by: Juergen Gross <jgross@suse.com>
> > 
> > I take it this applies to both patch 1 and 3?
> 
> In the absence of a reply to the contrary by 21:00 UTC today, I will
> assume this to be the case and push this to staging.  I hope that
> meets with everyone's approval.

Got confirmation from Juergen on IRC, so I have just pushed patch 1 and
3.

Wei.

> 
> Ian.
diff mbox series

Patch

diff --git a/tools/libxl/libxl_types_internal.idl b/tools/libxl/libxl_types_internal.idl
index cb85c3b37f..3593e21dbb 100644
--- a/tools/libxl/libxl_types_internal.idl
+++ b/tools/libxl/libxl_types_internal.idl
@@ -31,6 +31,7 @@  libxl__device_kind = Enumeration("device_kind", [
     (13, "VUART"),
     (14, "PVCALLS"),
     (15, "VSND"),
+    (16, "VINPUT"),
     ])
 
 libxl__console_backend = Enumeration("console_backend", [
diff --git a/tools/libxl/libxl_vkb.c b/tools/libxl/libxl_vkb.c
index 26376a7eef..4c44a813c1 100644
--- a/tools/libxl/libxl_vkb.c
+++ b/tools/libxl/libxl_vkb.c
@@ -38,9 +38,6 @@  static int libxl__set_xenstore_vkb(libxl__gc *gc, uint32_t domid,
                                    flexarray_t *back, flexarray_t *front,
                                    flexarray_t *ro_front)
 {
-    flexarray_append_pair(back, "backend-type",
-                          (char *)libxl_vkb_backend_to_string(vkb->backend_type));
-
     if (vkb->unique_id) {
         flexarray_append_pair(back, XENKBD_FIELD_UNIQUE_ID, vkb->unique_id);
     }
@@ -93,7 +90,8 @@  static int libxl__vkb_from_xenstore(libxl__gc *gc, const char *libxl_path,
                                     libxl_devid devid,
                                     libxl_device_vkb *vkb)
 {
-    const char *be_path, *be_type, *fe_path, *tmp;
+    const char *be_path, *fe_path, *tmp;
+    libxl__device dev;
     int rc;
 
     vkb->devid = devid;
@@ -111,13 +109,11 @@  static int libxl__vkb_from_xenstore(libxl__gc *gc, const char *libxl_path,
     rc = libxl__backendpath_parse_domid(gc, be_path, &vkb->backend_domid);
     if (rc) goto out;
 
-    rc = libxl__xs_read_mandatory(gc, XBT_NULL,
-                                  GCSPRINTF("%s/backend-type", be_path),
-                                  &be_type);
+    rc = libxl__parse_backend_path(gc, be_path, &dev);
     if (rc) goto out;
 
-    rc = libxl_vkb_backend_from_string(be_type, &vkb->backend_type);
-    if (rc) goto out;
+    vkb->backend_type = dev.backend_kind == LIBXL__DEVICE_KIND_VINPUT ?
+                                            LIBXL_VKB_BACKEND_LINUX : LIBXL_VKB_BACKEND_QEMU;
 
     vkb->unique_id = xs_read(CTX->xsh, XBT_NULL, GCSPRINTF("%s/"XENKBD_FIELD_UNIQUE_ID, be_path), NULL);
 
@@ -218,6 +214,20 @@  out:
     return rc;
 }
 
+static int libxl__device_from_vkb(libxl__gc *gc, uint32_t domid,
+                                  libxl_device_vkb *type, libxl__device *device)
+{
+    device->backend_devid   = type->devid;
+    device->backend_domid   = type->backend_domid;
+    device->backend_kind    = type->backend_type == LIBXL_VKB_BACKEND_LINUX ?
+                              LIBXL__DEVICE_KIND_VINPUT : LIBXL__DEVICE_KIND_VKBD;
+    device->devid           = type->devid;
+    device->domid           = domid;
+    device->kind            = LIBXL__DEVICE_KIND_VKBD;
+
+    return 0;
+}
+
 int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb,
                          const libxl_asyncop_how *ao_how)
 {
@@ -318,7 +328,6 @@  out:
      return rc;
 }
 
-static LIBXL_DEFINE_DEVICE_FROM_TYPE(vkb)
 static LIBXL_DEFINE_UPDATE_DEVID(vkb)
 
 #define libxl__add_vkbs NULL