Skip to contentSkip to conversation

xen: add vkbd support for PV on HVM guests

PATCH Applied [email protected] 2 participants 2 messages Jun 24, 2011 – Jun 30, 2011

lore
Share & tools
lore
#0 lore raw

PATCH v2 2/2 xen: add vkbd support for PV on HVM guests

From: Stefano Stabellini <[email protected]>

Register the vkbd backend even when running as device emulator for HVM
guests: it is useful because it doesn't need a frequent timer like usb.

Check whether the XenInput DisplayState has been set in the initialise state, rather than the input state.
In case the DisplayState hasn't been set and there is no vfb for this domain, then set the XenInput DisplayState to the default one.

Changed in v2:

- use qemu_free instead of free;

---
 hw/xenfb.c |   19 ++++++++++++-------
 xen-all.c  |    1 +
 2 files changed, 13 insertions(+), 7 deletions(-)
hw/xenfb.c +12 -7
index a3301ac..d964318 100644
@@ -347,13 +347,6 @@ static void xenfb_mouse_event(void *opaque,
 
 static int input_init(struct XenDevice *xendev)
 {
-    struct XenInput *in = container_of(xendev, struct XenInput, c.xendev);
-
-    if (!in->c.ds) {
-        xen_be_printf(xendev, 1, "ds not set (yet)\n");
-	return -1;
-    }
-
     xenstore_write_be_int(xendev, "feature-abs-pointer", 1);
     return 0;
 }
@@ -363,6 +356,18 @@ static int input_initialise(struct XenDevice *xendev)
     struct XenInput *in = container_of(xendev, struct XenInput, c.xendev);
     int rc;
 
+    if (!in->c.ds) {
+        char *vfb = xenstore_read_str(NULL, "device/vfb");
+        if (vfb == NULL) {
+            /* there is no vfb, run vkbd on its own */
+            in->c.ds = get_displaystate();
+        } else {
+            qemu_free(vfb);
+            xen_be_printf(xendev, 1, "ds not set (yet)\n");
+            return -1;
+        }
+    }
+
     rc = common_bind(&in->c);
     if (rc != 0)
 	return rc;
xen-all.c +1 -0
index 93fa2ee..6099bff 100644
@@ -868,6 +868,7 @@ int xen_hvm_init(void)
         exit(1);
     }
     xen_be_register("console", &xen_console_ops);
+    xen_be_register("vkbd", &xen_kbdmouse_ops);
     xen_be_register("qdisk", &xen_blkdev_ops);
 
     return 0;
Signature · 1 line
1.7.2.3
#1 lore raw
Quoted 11 lines · On 06/24/2011 06:36 PM, [email protected] wrote:

From: Stefano Stabellini<[email protected]>

Register the vkbd backend even when running as device emulator for HVM
guests: it is useful because it doesn't need a frequent timer like usb.

Check whether the XenInput DisplayState has been set in the initialise state, rather than the input state.
In case the DisplayState hasn't been set and there is no vfb for this domain, then set the XenInput DisplayState to the default one.

Quoted 4 lines

Changed in v2:

- use qemu_free instead of free;

Thanks applied to xen-next branch.

Alex