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] [PATCH 1/4][RFC] Paravirtual Framebuffer/Keyboard

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 1/4][RFC] Paravirtual Framebuffer/Keyboard
From: Anthony Liguori <aliguori@xxxxxxxxxx>
Date: Sun, 15 Jan 2006 17:40:31 -0600
Delivery-date: Sun, 15 Jan 2006 23:47:52 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0.7 (X11/20051013)

# HG changeset patch
# User Anthony Liguori <anthony@xxxxxxxxxxxxx>
# Node ID 431a5f12b57f2fbc2f462523f0ff71a667837a9d
# Parent  d783bdd14f2eff514e36b92ded0e3d22be7cf3d0
General plumbing for Xen Framebuffer and Keyboard.  This includes:

1) Some modifications to VT setup to remove our null console hacks
2) Additional resume plumbing for framebuffer/keyboard resume
3) Modifications to the build/resume to setup shared memory and event channels
   for framebuffer/keyboard devices
4) Modifications to Xend to support a new vnc directive for paravirtual domains

Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx>

diff -r d783bdd14f2e -r 431a5f12b57f 
linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c
--- a/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c Sat Jan 14 23:40:09 
2006 +0100
+++ b/linux-2.6-xen-sparse/arch/xen/i386/kernel/setup.c Sun Jan 15 18:05:57 
2006 -0500
@@ -1752,13 +1752,13 @@
 #endif
 #endif
        } else {
-#ifdef CONFIG_XEN_PHYSDEV_ACCESS
-               extern const struct consw xennull_con;
-               extern int console_use_vt;
-#if defined(CONFIG_VGA_CONSOLE)
+#if defined(CONFIG_XEN_PHYSDEV_ACCESS) && defined(CONFIG_VGA_CONSOLE)
                /* disable VGA driver */
                ORIG_VIDEO_ISVGA = VIDEO_TYPE_VLFB;
 #endif
+#if defined(CONFIG_DUMMY_CONSOLE)
+               conswitchp = &dummy_con;
+#else
                conswitchp = &xennull_con;
                console_use_vt = 0;
 #endif
diff -r d783bdd14f2e -r 431a5f12b57f 
linux-2.6-xen-sparse/arch/xen/kernel/reboot.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c     Sat Jan 14 23:40:09 
2006 +0100
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/reboot.c     Sun Jan 15 18:05:57 
2006 -0500
@@ -16,6 +16,8 @@
 #include <linux/cpu.h>
 #include <linux/kthread.h>
 #include <asm-xen/xencons.h>
+#include <linux/xenkbd.h>
+#include <linux/xenfb.h>
 
 #if defined(__i386__) || defined(__x86_64__)
 /*
@@ -148,6 +150,8 @@
 
        xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn);
        xen_start_info->console_mfn = mfn_to_pfn(xen_start_info->console_mfn);
+       xen_start_info->fbdev_mfn = mfn_to_pfn(xen_start_info->fbdev_mfn);
+       xen_start_info->kbd_mfn = mfn_to_pfn(xen_start_info->kbd_mfn);
 
        /*
         * We'll stop somewhere inside this hypercall. When it returns,
@@ -188,6 +192,12 @@
        __sti();
 
        xencons_resume();
+#ifndef CONFIG_XEN_PRIVILEGED_GUEST
+#if 1
+       xenfb_resume();
+#endif
+       xenkbd_resume();
+#endif
 
 #ifdef CONFIG_SMP
        for_each_cpu(i)
diff -r d783bdd14f2e -r 431a5f12b57f tools/libxc/xc_linux_build.c
--- a/tools/libxc/xc_linux_build.c      Sat Jan 14 23:40:09 2006 +0100
+++ b/tools/libxc/xc_linux_build.c      Sun Jan 15 18:05:57 2006 -0500
@@ -434,6 +434,8 @@
     shared_info_t *shared_info;
     xc_mmu_t *mmu = NULL;
     int rc;
+    unsigned long _fbdev_mfn = 0, *fbdev_mfn = &_fbdev_mfn;
+    unsigned long _kbd_mfn = 0, *kbd_mfn = &_kbd_mfn;
 
     unsigned long nr_pt_pages;
     unsigned long physmap_pfn;
@@ -451,11 +453,17 @@
     unsigned long vstoreinfo_end;
     unsigned long vconsole_start;
     unsigned long vconsole_end;
+    unsigned long vfbdev_start;
+    unsigned long vfbdev_end;
+    unsigned long vkbd_start;
+    unsigned long vkbd_end;
     unsigned long vstack_start;
     unsigned long vstack_end;
     unsigned long vpt_start;
     unsigned long vpt_end;
     unsigned long v_end;
+    int fbdev_evtchn;
+    int kbd_evtchn;
 
     rc = probeimageformat(image, image_size, &load_funcs);
     if ( rc != 0 )
@@ -490,7 +498,11 @@
     vstoreinfo_end   = vstoreinfo_start + PAGE_SIZE;
     vconsole_start   = vstoreinfo_end;
     vconsole_end     = vconsole_start + PAGE_SIZE;
-    vpt_start        = vconsole_end; 
+    vfbdev_start     = vconsole_end;
+    vfbdev_end       = vfbdev_start + PAGE_SIZE;
+    vkbd_start       = vfbdev_end;
+    vkbd_end         = vkbd_start + PAGE_SIZE;
+    vpt_start        = vkbd_end; 
 
     for ( nr_pt_pages = 2; ; nr_pt_pages++ )
     {
@@ -667,8 +679,54 @@
 
     *store_mfn = page_array[(vstoreinfo_start-dsi.v_start) >> PAGE_SHIFT];
     *console_mfn = page_array[(vconsole_start-dsi.v_start) >> PAGE_SHIFT];
+    *fbdev_mfn = page_array[(vfbdev_start-dsi.v_start) >> PAGE_SHIFT];
+    *kbd_mfn = page_array[(vkbd_start-dsi.v_start) >> PAGE_SHIFT];
+
+    fbdev_evtchn = xc_evtchn_alloc_unbound(xc_handle, dom, 0);
+    if (fbdev_evtchn == -1)
+        goto error_out;
+
+    kbd_evtchn = xc_evtchn_alloc_unbound(xc_handle, dom, 0);
+    if (kbd_evtchn == -1)
+        goto error_out;
+
+    {
+        char buffer[1024];
+        FILE *f;
+
+        snprintf(buffer, sizeof(buffer), "/var/run/xenfb/%d.mfn", dom);
+        f = fopen(buffer, "w");
+        if (f) {
+            fprintf(f, "%lu\n", *fbdev_mfn);
+            fclose(f);
+        }
+
+        snprintf(buffer, sizeof(buffer), "/var/run/xenfb/%d.evtchn", dom);
+        f = fopen(buffer, "w");
+        if (f) {
+            fprintf(f, "%d\n", fbdev_evtchn);
+            fclose(f);
+        }
+
+        snprintf(buffer, sizeof(buffer), "/var/run/xenkbd/%d.mfn", dom);
+        f = fopen(buffer, "w");
+        if (f) {
+            fprintf(f, "%lu\n", *kbd_mfn);
+            fclose(f);
+        }
+
+        snprintf(buffer, sizeof(buffer), "/var/run/xenkbd/%d.evtchn", dom);
+        f = fopen(buffer, "w");
+        if (f) {
+            fprintf(f, "%d\n", kbd_evtchn);
+            fclose(f);
+        }
+    }
+
     if ( xc_clear_domain_page(xc_handle, dom, *store_mfn) ||
-         xc_clear_domain_page(xc_handle, dom, *console_mfn) )
+         xc_clear_domain_page(xc_handle, dom, *console_mfn) ||
+         xc_clear_domain_page(xc_handle, dom, *fbdev_mfn) ||
+         xc_clear_domain_page(xc_handle, dom, *kbd_mfn) )
         goto error_out;
 
     start_info = xc_map_foreign_range(
@@ -689,6 +747,11 @@
     start_info->store_evtchn = store_evtchn;
     start_info->console_mfn   = *console_mfn;
     start_info->console_evtchn = console_evtchn;
+    start_info->fbdev_mfn    = *fbdev_mfn;
+    start_info->fbdev_evtchn = fbdev_evtchn;
+    start_info->kbd_mfn      = *kbd_mfn;
+    start_info->kbd_evtchn   = kbd_evtchn;
+
     if ( initrd_len != 0 )
     {
         start_info->mod_start    = vinitrd_start;
diff -r d783bdd14f2e -r 431a5f12b57f tools/libxc/xc_linux_restore.c
--- a/tools/libxc/xc_linux_restore.c    Sat Jan 14 23:40:09 2006 +0100
+++ b/tools/libxc/xc_linux_restore.c    Sun Jan 15 18:05:57 2006 -0500
@@ -149,6 +149,9 @@
 
     struct mmuext_op pin[MAX_PIN_BATCH];
     unsigned int nr_pins; 
+
+    unsigned long xenkbd_mfn, xenfb_mfn;
+    int xenkbd_evtchn, xenfb_evtchn;
 
 
     max_pfn = nr_pfns; 
@@ -627,6 +630,48 @@
     start_info->store_evtchn                 = store_evtchn;
     *console_mfn = start_info->console_mfn   = p2m[start_info->console_mfn];
     start_info->console_evtchn               = console_evtchn;
+    xenfb_mfn = start_info->fbdev_mfn        = p2m[start_info->fbdev_mfn];
+    xenkbd_mfn = start_info->kbd_mfn         = p2m[start_info->kbd_mfn];
+
+    xenfb_evtchn = xc_evtchn_alloc_unbound(xc_handle, dom, 0);
+    xenkbd_evtchn = xc_evtchn_alloc_unbound(xc_handle, dom, 0);
+
+    start_info->fbdev_evtchn = xenfb_evtchn;
+    start_info->kbd_evtchn = xenkbd_evtchn;
+
+    {
+        char buffer[1024];
+        FILE *f;
+
+        snprintf(buffer, sizeof(buffer), "/var/run/xenfb/%d.mfn", dom);
+        f = fopen(buffer, "w");
+        if (f) {
+            fprintf(f, "%lu\n", xenfb_mfn);
+            fclose(f);
+        }
+
+        snprintf(buffer, sizeof(buffer), "/var/run/xenfb/%d.evtchn", dom);
+        f = fopen(buffer, "w");
+        if (f) {
+            fprintf(f, "%d\n", xenfb_evtchn);
+            fclose(f);
+        }
+
+        snprintf(buffer, sizeof(buffer), "/var/run/xenkbd/%d.mfn", dom);
+        f = fopen(buffer, "w");
+        if (f) {
+            fprintf(f, "%lu\n", xenkbd_mfn);
+            fclose(f);
+        }
+
+        snprintf(buffer, sizeof(buffer), "/var/run/xenkbd/%d.evtchn", dom);
+        f = fopen(buffer, "w");
+        if (f) {
+            fprintf(f, "%d\n", xenkbd_evtchn);
+            fclose(f);
+        }
+    }
+
     munmap(start_info, PAGE_SIZE);
 
     /* Uncanonicalise each GDT frame number. */
diff -r d783bdd14f2e -r 431a5f12b57f tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Sat Jan 14 23:40:09 2006 +0100
+++ b/tools/python/xen/xend/image.py    Sun Jan 15 18:05:57 2006 -0500
@@ -163,6 +163,20 @@
 
     ostype = "linux"
 
+    def configure(self, imageConfig, deviceConfig):
+        ImageHandler.configure(self, imageConfig, deviceConfig)
+
+        vnc = sxp.child_value(imageConfig, 'vnc')
+
+        self.pid = 0
+        
+        if vnc:
+            log.info('spawning vncfb: %s %s', '/usr/lib/xen/bin/vncfb', 
['vncfb', str(self.vm.getDomid())])
+            self.pid = os.spawnv(os.P_NOWAIT, '/usr/lib/xen/bin/vncfb', 
['vncfb', str(self.vm.getDomid())])
+            log.info('vncfb pid: %d', self.pid)
+        else:
+            log.info('vnc is not set (disabling)')
+
     def buildDomain(self):
         store_evtchn = self.vm.getStorePort()
         console_evtchn = self.vm.getConsolePort()
@@ -181,6 +195,14 @@
                               console_evtchn = console_evtchn,
                               cmdline        = self.cmdline,
                               ramdisk        = self.ramdisk)
+
+    def destroy(self):
+        import signal
+        if not self.pid:
+            return
+        os.kill(self.pid, signal.SIGKILL)
+        os.waitpid(self.pid, 0)
+        self.pid = 0
 
 class VmxImageHandler(ImageHandler):
 
diff -r d783bdd14f2e -r 431a5f12b57f tools/python/xen/xm/create.py
--- a/tools/python/xen/xm/create.py     Sat Jan 14 23:40:09 2006 +0100
+++ b/tools/python/xen/xm/create.py     Sun Jan 15 18:05:57 2006 -0500
@@ -436,6 +436,8 @@
 
     if vals.builder == 'vmx':
         configure_vmx(config_image, vals)
+    elif vals.vnc:
+        config_image.append(['vnc', vals.vnc])
         
     return config_image
     
diff -r d783bdd14f2e -r 431a5f12b57f xen/include/public/xen.h
--- a/xen/include/public/xen.h  Sat Jan 14 23:40:09 2006 +0100
+++ b/xen/include/public/xen.h  Sun Jan 15 18:05:57 2006 -0500
@@ -408,6 +408,10 @@
     uint32_t store_evtchn;      /* Event channel for store communication. */
     unsigned long console_mfn;  /* MACHINE address of console page.       */
     uint32_t console_evtchn;    /* Event channel for console messages.    */
+    unsigned long fbdev_mfn;
+    uint32_t fbdev_evtchn;
+    unsigned long kbd_mfn;
+    uint32_t kbd_evtchn;
     /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME).     */
     unsigned long pt_base;      /* VIRTUAL address of page directory.     */
     unsigned long nr_pt_frames; /* Number of bootstrap p.t. frames.       */
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 1/4][RFC] Paravirtual Framebuffer/Keyboard, Anthony Liguori <=