WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH 2/2] PV framebuffer

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] Re: [PATCH 2/2] PV framebuffer
From: Markus Armbruster <armbru@xxxxxxxxxx>
Date: Fri, 17 Nov 2006 14:26:05 +0100
Delivery-date: Fri, 17 Nov 2006 05:26:16 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <874psydx6m.fsf@xxxxxxxxxxxxxxxxx> (Markus Armbruster's message of "Fri, 17 Nov 2006 14:23:13 +0100")
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <87lkmjptqq.fsf@xxxxxxxxxxxxxxxxx> <874psydx6m.fsf@xxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)
Diffs since last iteration:

diff -rupN -x '*.orig' xen-unstable.old/tools/python/xen/xend/XendDevices.py 
xen-unstable.new/tools/python/xen/xend/XendDevices.py
--- xen-unstable.old/tools/python/xen/xend/XendDevices.py       2006-11-17 
13:56:52.000000000 +0100
+++ xen-unstable.new/tools/python/xen/xend/XendDevices.py       2006-11-17 
13:56:21.000000000 +0100
@@ -42,7 +42,7 @@ class XendDevices:
         'usb': usbif.UsbifController,
         'tap': BlktapController,
         'vfb': vfbif.VfbifController,
-        'vkbd': vfif.VkbdifController,
+        'vkbd': vfbif.VkbdifController,
     }
 
     #@classmethod
diff -rupN -x '*.orig' xen-unstable.old/tools/python/xen/xm/create.py 
xen-unstable.new/tools/python/xen/xm/create.py
--- xen-unstable.old/tools/python/xen/xm/create.py      2006-11-17 
13:53:39.000000000 +0100
+++ xen-unstable.new/tools/python/xen/xm/create.py      2006-11-17 
13:56:21.000000000 +0100
@@ -280,6 +280,14 @@ gopts.var('usbport', val='PATH',
           use="""Add a physical USB port to a domain, as specified by the path
           to that port.  This option may be repeated to add more than one 
port.""")
 
+gopts.var('vfb', val="no|yes'",
+          fn=set_bool, default=0,
+          use="Make the domain a framebuffer backend.")
+
+gopts.var('vkbd', val="no|yes'",
+          fn=set_bool, default=0,
+          use="Make the domain a keyboard backend.")
+
 gopts.var('vif', 
val="type=TYPE,mac=MAC,bridge=BRIDGE,ip=IPADDR,script=SCRIPT,backend=DOM,vifname=NAME",
           fn=append_value, default=[],
           use="""Add a network interface with the given MAC address and bridge.
@@ -560,6 +568,13 @@ def configure_usb(config_devs, vals):
         config_usb = ['usbport', ['path', path]]
         config_devs.append(['device', config_usb])
 
+def configure_vfbs(config_devs, vals):
+    if vals.vfb:
+        config_devs.append(['device', ['vfb', []]])
+
+def configure_vkbds(config_devs, vals):
+    if vals.vkbd:
+        config_devs.append(['device', ['vkbd', []]])
 
 def configure_security(config, vals):
     """Create the config for ACM security labels.
@@ -738,6 +753,8 @@ def make_config(vals):
     configure_vifs(config_devs, vals)
     configure_usb(config_devs, vals)
     configure_vtpm(config_devs, vals)
+    configure_vfbs(config_devs, vals)
+    configure_vkbds(config_devs, vals)
     configure_security(config, vals)
     config += config_devs
 
diff -rupN -x '*.orig' xen-unstable.old/tools/xenfb/vncfb.c 
xen-unstable.new/tools/xenfb/vncfb.c
--- xen-unstable.old/tools/xenfb/vncfb.c        2006-11-17 13:56:52.000000000 
+0100
+++ xen-unstable.new/tools/xenfb/vncfb.c        2006-11-17 13:56:21.000000000 
+0100
@@ -260,7 +260,7 @@ int main(int argc, char **argv)
        rfbScreenInfoPtr server;
        char *fake_argv[7] = { "vncfb", "-rfbport", "5901", 
                                "-desktop", "xen-vncfb", 
-                               "-listen", "0.0.0.0" };
+                               "-listen", "127.0.0.1" };
        int fake_argc = sizeof(fake_argv) / sizeof(fake_argv[0]);
        int domid = -1, port = -1;
        char *title = NULL;
diff -rupN -x '*.orig' xen-unstable.old/tools/xenfb/xenfb.c 
xen-unstable.new/tools/xenfb/xenfb.c
--- xen-unstable.old/tools/xenfb/xenfb.c        2006-11-17 13:56:52.000000000 
+0100
+++ xen-unstable.new/tools/xenfb/xenfb.c        2006-11-17 13:56:21.000000000 
+0100
@@ -187,6 +187,38 @@ static int xenfb_xs_printf(struct xs_han
        return 0;
 }
 
+static void xenfb_dev_fatal(struct xs_handle *xsh, unsigned domid,
+                           const char *dir, int err, const char *fmt, ...)
+{
+       va_list ap;
+       char errdir[80];
+       char buf[1024];
+       int n;
+
+       fprintf(stderr, "%s ", dir); /* somewhat crude */
+       va_start(ap, fmt);
+       vfprintf(stderr, fmt, ap);
+       va_end(ap);
+       if (err)
+               fprintf(stderr, " (%s)", strerror(err));
+       putc('\n', stderr);
+
+       if (!xenfb_path_in_dom(xsh, errdir, sizeof(errdir), domid,
+                              "error/%s", dir))
+               goto out;       /* FIXME complain */
+
+       va_start(ap, fmt);
+       n = snprintf(buf, sizeof(buf), "%d ", err);
+       snprintf(buf + n, sizeof(buf) - n, fmt, ap);
+       va_end(ap);
+
+       if (xenfb_xs_printf(xsh, buf, "error", "%s", buf) < 0)
+               goto out;       /* FIXME complain */
+
+ out:
+       xenfb_xs_printf(xsh, dir, "state", "%d", XenbusStateClosing);
+}
+
 static int xenfb_wait_for_state(struct xs_handle *xsh, const char *dir,
                                unsigned awaited)
 {
@@ -210,21 +242,19 @@ static int xenfb_wait_for_state(struct x
        }
 }
 
-static int xenfb_hotplug(struct xs_handle *xsh, const char *backdir)
+static int xenfb_wait_for_backend_creation(struct xs_handle *xsh,
+                                          const char *backdir)
 {
-       if (xenfb_xs_printf(xsh, backdir, "hotplug-status", "connected"))
-               return -1;
-
        if (!xs_watch(xsh, backdir, ""))
                return -1;
 
        switch (xenfb_wait_for_state(xsh, backdir,
-#if 1 /* TODO fudging state to permit restarting; to be removed */
                        (1 << XenbusStateInitialising)
+                       | (1 << XenbusStateClosed)
+#if 1 /* TODO fudging state to permit restarting; to be removed */
                        | (1 << XenbusStateInitWait)
                        | (1 << XenbusStateConnected)
-#else
-                       1 << XenbusStateInitialising,
+                       | (1 << XenbusStateClosing)
 #endif
                        )) {
 #if 1
@@ -233,6 +263,8 @@ static int xenfb_hotplug(struct xs_handl
                printf("Fudging state to %d\n", XenbusStateInitialising); /* 
FIXME */
 #endif
        case XenbusStateInitialising:
+       case XenbusStateClosing:
+       case XenbusStateClosed:
                break;
        default:
                return -1;
@@ -241,7 +273,15 @@ static int xenfb_hotplug(struct xs_handl
        xs_unwatch(xsh, backdir, "");
        return 0;
 }
-                
+
+static int xenfb_hotplug(struct xs_handle *xsh, const char *backdir)
+{
+       printf("Hotplugging %s\n", backdir);
+       if (xenfb_xs_printf(xsh, backdir, "hotplug-status", "connected"))
+               return -1;
+       return 0;
+}
+
 static int xenfb_wait_for_frontend_initialised(struct xs_handle *xsh,
                                               const char *frontdir)
 {
@@ -336,13 +376,13 @@ bool xenfb_attach_dom(struct xenfb *xenf
                goto error;
        }
 
-       if (xenfb_hotplug(xsh, vfb_backdir) < 0)
+       if (xenfb_wait_for_backend_creation(xsh, vfb_backdir) < 0)
                goto error;
-       if (xenfb_hotplug(xsh, vkbd_backdir) < 0)
+       if (xenfb_wait_for_backend_creation(xsh, vkbd_backdir) < 0)
                goto error;
 
        if (xenfb_xs_printf(xsh, vkbd_backdir, "feature-abs-pointer", "1"))
                goto error;
        if (xenfb_xs_printf(xsh, vfb_backdir, "state", "%d",
                            XenbusStateInitWait))
                goto error;
@@ -350,6 +391,11 @@ bool xenfb_attach_dom(struct xenfb *xenf
                            XenbusStateInitWait))
                goto error;
 
+       if (xenfb_hotplug(xsh, vfb_backdir) < 0)
+               goto error;
+       if (xenfb_hotplug(xsh, vkbd_backdir) < 0)
+               goto error;
+
        if (!xs_watch(xsh, vfb_frontdir, ""))
                goto error;
        if (!xs_watch(xsh, vkbd_frontdir, ""))
@@ -453,7 +499,7 @@ bool xenfb_attach_dom(struct xenfb *xenf
 
        return true;
 
- error:        
+ error:
        serrno = errno;
        if (xenfb->fb)
                munmap(xenfb->fb, xenfb->fb_len);
@@ -467,6 +513,8 @@ bool xenfb_attach_dom(struct xenfb *xenf
        xc_evtchn_unbind(xenfb->evt_xch, xenfb->kbd_port);
         if (xenfb->fbdev_port)
                xc_evtchn_unbind(xenfb->evt_xch, xenfb->fbdev_port);
+       xenfb_dev_fatal(xsh, domid, vfb_backdir, serrno, "on fire");
+       xenfb_dev_fatal(xsh, domid, vkbd_backdir, serrno, "on fire");
         if (xsh) 
                xs_daemon_close(xsh);
         errno = serrno;

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel