From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51844) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qa7iZ-0001yQ-KH for qemu-devel@nongnu.org; Fri, 24 Jun 2011 10:50:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qa7iY-0008S9-9P for qemu-devel@nongnu.org; Fri, 24 Jun 2011 10:50:47 -0400 Received: from smtp.citrix.com ([66.165.176.89]:46231) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qa7iX-0008Ru-Pl for qemu-devel@nongnu.org; Fri, 24 Jun 2011 10:50:45 -0400 From: Date: Fri, 24 Jun 2011 15:54:49 +0100 Message-ID: <1308927289-10474-2-git-send-email-stefano.stabellini@eu.citrix.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH 2/2] xen: add vkbd support for PV on HVM guests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: xen-devel@lists.xensource.com, agraf@suse.de, Stefano Stabellini From: Stefano Stabellini 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. Signed-off-by: Stefano Stabellini --- hw/xenfb.c | 19 ++++++++++++------- xen-all.c | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/hw/xenfb.c b/hw/xenfb.c index a3301ac..13b9b1b 100644 --- a/hw/xenfb.c +++ b/hw/xenfb.c @@ -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 { + free(vfb); + xen_be_printf(xendev, 1, "ds not set (yet)\n"); + return -1; + } + } + rc = common_bind(&in->c); if (rc != 0) return rc; diff --git a/xen-all.c b/xen-all.c index 93fa2ee..6099bff 100644 --- a/xen-all.c +++ b/xen-all.c @@ -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; -- 1.7.2.3