Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


more extension ports
Jack Lange [Wed, 8 Jun 2011 22:08:27 +0000 (17:08 -0500)]
linux_module/palacios-dev.c
linux_module/palacios-graphics-console.c
linux_module/palacios-graphics-console.h
linux_module/palacios-keyed-stream.c
linux_module/palacios-keyed-stream.h [deleted file]
linux_module/palacios-packet.c
linux_module/palacios-packet.h [deleted file]
linux_module/palacios-vm.c
linux_module/palacios.h

index 29d047d..71e861d 100644 (file)
 #include "linux-exts.h"
 
 
-#ifdef V3_CONFIG_KEYED_STREAMS
-#include "palacios-keyed-stream.h"
-#endif
-
 
 MODULE_LICENSE("GPL");
 
@@ -254,13 +250,7 @@ static int __init v3_init(void) {
 
 
 
-#ifdef V3_CONFIG_KEYED_STREAMS
-    palacios_init_keyed_streams();
-#endif
 
-#ifdef V3_CONFIG_GRAPHICS_CONSOLE
-    palacios_init_graphics_console();
-#endif
 
 #ifdef V3_CONFIG_VNET
     palacios_vnet_init();
index 21c9457..2602df9 100644 (file)
 
 #include <interfaces/vmm_console.h>
 #include <palacios/vmm_host_events.h>
+#include "palacios-graphics-console.h"
+
 
 #include "palacios.h"
-#include "palacios-graphics-console.h"
+#include "linux-exts.h"
+#include "palacios-vm.h"
 
 #include <linux/vmalloc.h>
 
 
 */
 
+
+
+struct palacios_graphics_console {
+    // descriptor for the data in the shared frame buffer
+    struct v3_frame_buffer_spec spec;
+    // the actual shared frame buffer
+    // Note that "shared" here means shared between palacios and us
+    // This data could of course also be shared with userland
+    void *data;
+
+    int cons_refcount;
+    int data_refcount;
+
+    uint32_t num_updates;
+
+    // Currently keystrokes and mouse movements are ignored
+
+    // currently, we will not worry about locking this
+    // lock_t ...
+};
+
+
 static v3_graphics_console_t g_open(void * priv_data, 
                                    struct v3_frame_buffer_spec *desired_spec,
                                    struct v3_frame_buffer_spec *actual_spec)
 {
     struct v3_guest * guest = (struct v3_guest *)priv_data;
-    struct palacios_graphics_console *gc = (struct palacios_graphics_console *) &(guest->graphics_console);
+    struct palacios_graphics_console * gc = NULL;
     uint32_t mem;
 
-    if(gc->data) { 
+    if (guest == NULL) {
+       return 0;
+    }
+
+    gc = get_vm_ext_data(guest, "GFX_CONSOLE_INTERFACE");
+    
+    if (gc == NULL) {
+       printk("ERROR: Could not locate gfx console data for extension GFX_CONSOLE_INTERFACE\n");
+       return 0;
+    }
+
+    if (gc->data != NULL) { 
        printk("palacios: framebuffer already allocated - returning it\n");
-       *actual_spec=gc->spec;
+
+       *actual_spec = gc->spec;
        gc->cons_refcount++;
        gc->data_refcount++;
+
        return gc;
     }
 
@@ -69,7 +107,6 @@ static v3_graphics_console_t g_open(void * priv_data,
 
     *actual_spec = gc->spec;
 
-    gc->guest=guest;
     
     gc->cons_refcount++;
     gc->data_refcount++;
@@ -167,25 +204,29 @@ static int g_changed(v3_graphics_console_t cons)
 
 
 
-static int palacios_graphics_console_key(struct palacios_graphics_console *cons, uint8_t scancode)
+static int palacios_graphics_console_key(struct v3_guest * guest, 
+                                        struct palacios_graphics_console *cons, 
+                                        uint8_t scancode)
 {
     struct v3_keyboard_event e;
-    e.status=0;
-    e.scan_code=scancode;
+    e.status = 0;
+    e.scan_code = scancode;
 
-    v3_deliver_keyboard_event(cons->guest->v3_ctx,&e);
+    v3_deliver_keyboard_event(guest->v3_ctx, &e);
     
     return 0;
 }
 
-static int palacios_graphics_console_mouse(struct palacios_graphics_console *cons, uint8_t x, uint8_t y, uint8_t buttons)
+static int palacios_graphics_console_mouse(struct v3_guest * guest, 
+                                          struct palacios_graphics_console *cons, 
+                                          uint8_t x, uint8_t y, uint8_t buttons)
 {
     struct v3_mouse_event e;
     e.data[0]=x;
     e.data[1]=y;
     e.data[2]=buttons;   // These three are completely wrong, of course - ignoring mouse for now
 
-    v3_deliver_mouse_event(cons->guest->v3_ctx,&e);
+    v3_deliver_mouse_event(guest->v3_ctx,&e);
 
     return 0;
 }
@@ -204,7 +245,7 @@ static struct v3_graphics_console_hooks palacios_graphics_console_hooks =
 };
 
 
-int palacios_init_graphics_console( void ) {
+static int gfx_console_init( void ) {
 
     V3_Init_Graphics_Console(&palacios_graphics_console_hooks);
     
@@ -212,9 +253,11 @@ int palacios_init_graphics_console( void ) {
 }
 
 
-int palacios_graphics_console_user_query(struct palacios_graphics_console *cons, 
-                                        struct v3_fb_query_response __user *u)
-{
+static int fb_query(struct v3_guest * guest, unsigned int cmd, unsigned long arg, 
+                   void * priv_data) {
+
+    struct v3_fb_query_response __user * u = (struct v3_fb_query_response __user *)arg;
+    struct palacios_graphics_console * cons = priv_data;
     struct v3_fb_query_response q;
     
     
@@ -276,11 +319,15 @@ int palacios_graphics_console_user_query(struct palacios_graphics_console *cons,
 
 }
 
-int palacios_graphics_console_user_input(struct palacios_graphics_console *cons,
-                                        struct v3_fb_input __user  *u)
-{
+static int fb_input(struct v3_guest * guest, 
+                   unsigned int cmd, 
+                   unsigned long arg, 
+                   void * priv_data) {
+
+    struct v3_fb_input __user * u = (struct v3_fb_input __user *)arg;
+    struct palacios_graphics_console * cons = priv_data;
     struct v3_fb_input inp;
-    int rc=0;
+    int rc = 0;
 
 
     if (copy_from_user(&inp,(void __user *) u, sizeof(struct v3_fb_input))) { 
@@ -288,12 +335,13 @@ int palacios_graphics_console_user_input(struct palacios_graphics_console *cons,
        return -EFAULT;
     }
        
-    if (inp.data_type==V3_FB_KEY || inp.data_type==V3_FB_BOTH) { 
-       rc = palacios_graphics_console_key(cons,inp.scan_code);
+    if ((inp.data_type == V3_FB_KEY) || (inp.data_type == V3_FB_BOTH)) { 
+       rc = palacios_graphics_console_key(guest, cons, inp.scan_code);
     }
 
-    if (inp.data_type==V3_FB_MOUSE || inp.data_type==V3_FB_BOTH) { 
-       rc |= palacios_graphics_console_mouse(cons,inp.mouse_data[0],inp.mouse_data[1],inp.mouse_data[2]);
+    if ((inp.data_type == V3_FB_MOUSE) || (inp.data_type == V3_FB_BOTH)) { 
+       rc |= palacios_graphics_console_mouse(guest, cons, inp.mouse_data[0],
+                                             inp.mouse_data[1], inp.mouse_data[2]);
     }
 
     if (rc) { 
@@ -302,3 +350,29 @@ int palacios_graphics_console_user_input(struct palacios_graphics_console *cons,
        return 0;
     }
 }
+
+
+static int gfx_console_guest_init(struct v3_guest * guest, void ** vm_data) {
+    struct palacios_graphics_console * gfx_cons = kmalloc(sizeof(struct palacios_graphics_console), GFP_KERNEL);
+
+    memset(gfx_cons, 0, sizeof(struct palacios_graphics_console));
+
+
+    add_guest_ctrl(guest, V3_VM_FB_INPUT, fb_input, gfx_cons);
+    add_guest_ctrl(guest, V3_VM_FB_QUERY, fb_query, gfx_cons);
+
+    return 0;
+}
+
+
+
+static struct linux_ext gfx_cons_ext = {
+    .name = "GFX_CONSOLE_INTERFACE",
+    .init = gfx_console_init,
+    .deinit = NULL,
+    .guest_init = gfx_console_guest_init,
+    .guest_deinit = NULL
+};
+
+
+register_extension(&gfx_cons_ext);
index 417a26b..aef5330 100644 (file)
@@ -8,26 +8,6 @@
 
 #include <interfaces/vmm_graphics_console.h>
 
-struct palacios_graphics_console {
-    // descriptor for the data in the shared frame buffer
-    struct v3_frame_buffer_spec spec;
-    // the actual shared frame buffer
-    // Note that "shared" here means shared between palacios and us
-    // This data could of course also be shared with userland
-    void *data;
-
-    struct v3_guest * guest;
-
-    int cons_refcount;
-    int data_refcount;
-
-    uint32_t num_updates;
-
-    // Currently keystrokes and mouse movements are ignored
-
-    // currently, we will not worry about locking this
-    // lock_t ...
-};
 
 
 // This is the data structure that is passed back and forth with user-land
@@ -48,13 +28,6 @@ struct v3_fb_input {
 };
 
 
-int palacios_init_graphics_console(void);
-
-int palacios_graphics_console_user_query(struct palacios_graphics_console *cons, 
-                                        struct v3_fb_query_response __user *fb);
-
-int palacios_graphics_console_user_input(struct palacios_graphics_console *cons,
-                                        struct v3_fb_input __user  *in);
 
 
 #endif
index b3fbe2b..ef185a5 100644 (file)
@@ -1,6 +1,6 @@
 #include "palacios.h"
-#include "palacios-keyed-stream.h"
 #include "palacios-hashtable.h"
+#include "linux-exts.h"
 
 #define sint64_t int64_t
 #include <interfaces/vmm_keyed_stream.h>
@@ -275,7 +275,7 @@ static struct v3_keyed_stream_hooks hooks = {
 };
 
 
-int palacios_init_keyed_streams()
+static int init_keyed_streams( void )
 {
     streams = palacios_create_htable(DEF_NUM_STREAMS,hash_func,hash_comp);
 
@@ -290,8 +290,20 @@ int palacios_init_keyed_streams()
 
 }
 
-int palacios_deinit_keyed_streams()
+static int deinit_keyed_streams( void )
 {
     printk("DEINIT OF PALACIOS KEYED STREAMS NOT IMPLEMENTED - WE HAVE JUST LEAKED MEMORY!\n");
     return -1;
 }
+
+
+static struct linux_ext key_stream_ext = {
+    .name = "KEYED_STREAM_INTERFACE",
+    .init = init_keyed_streams,
+    .deinit = deinit_keyed_streams,
+    .guest_init = NULL,
+    .guest_deinit = NULL
+};
+
+
+register_extension(&key_stream_ext);
diff --git a/linux_module/palacios-keyed-stream.h b/linux_module/palacios-keyed-stream.h
deleted file mode 100644 (file)
index 218ed51..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Palacios VM Keyed Stream Interface (for checkpoint/restore)
- * Copyright (c) 2011 Peter Dinda <pdinda@northwestern.edu>
- */
-
-#ifndef __PALACIOS_KEYED_STREAM_H__
-#define __PALACIOS_KEYED_STREAM_H__
-
-
-
-int palacios_init_keyed_streams(void);
-int palacios_deinit_keyed_streams(void);
-
-
-#endif
index fb9c5b7..d51c7e7 100644 (file)
@@ -260,7 +260,6 @@ static int packet_init( void ) {
 
 static int packet_deinit( void ) {
 
-    const char * eth_dev = NULL;
 
     kthread_stop(packet_state.server_thread);
     packet_state.raw_sock->ops->release(packet_state.raw_sock);
diff --git a/linux_module/palacios-packet.h b/linux_module/palacios-packet.h
deleted file mode 100644 (file)
index 9b26e40..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Palacios VM Raw Packet interface
- * (c) Lei Xia, 2010
- */
-
-#ifndef __PALACIOS_PACKET_H__
-#define __PALACIOS_PACKET_H__
-
-int palacios_init_packet(const char * eth_dev);
-int palacios_deinit_packet(void);
-
-#endif
index 8be10c9..d325c8b 100644 (file)
@@ -114,9 +114,6 @@ static struct vm_ctrl * get_ctrl(struct v3_guest * guest, unsigned int cmd) {
 
 
 
-#ifdef V3_CONFIG_GRAPHICS_CONSOLE
-#include "palacios-graphics-console.h"
-#endif
 
 #ifdef V3_CONFIG_HOST_DEVICE
 #include "palacios-host-dev.h"
@@ -161,23 +158,6 @@ static long v3_vm_ioctl(struct file * filp,
            break;
        }
 
-       case V3_VM_FB_INPUT: 
-#ifdef V3_CONFIG_GRAPHICS_CONSOLE
-           return palacios_graphics_console_user_input(&(guest->graphics_console),
-                                                       (struct v3_fb_input __user *) arg) ;
-#else
-           return -EFAULT;
-#endif
-           break;
-           
-       case V3_VM_FB_QUERY: 
-#ifdef V3_CONFIG_GRAPHICS_CONSOLE
-           return palacios_graphics_console_user_query(&(guest->graphics_console),
-                                                       (struct v3_fb_query_response __user *) arg);
-#else
-           return -EFAULT;
-#endif
-           break;
 
 
        default: {
index a5a5aeb..95f8d90 100644 (file)
@@ -7,9 +7,7 @@
 #include <linux/slab.h>
 
 
-#ifdef V3_CONFIG_GRAPHICS_CONSOLE
-#include "palacios-graphics-console.h"
-#endif
+
 
 #ifdef V3_CONFIG_HOST_DEVICE
 #include "palacios-host-dev.h"
@@ -63,10 +61,6 @@ struct v3_guest {
     struct list_head exts;
 
 
-#ifdef V3_CONFIG_GRAPHICS_CONSOLE
-    struct palacios_graphics_console graphics_console;
-#endif
-
 #ifdef V3_CONFIG_HOST_DEVICE
     struct palacios_host_dev hostdev;
 #endif