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.


updated linux module to new build framework
Jack Lange [Mon, 2 May 2011 21:52:09 +0000 (16:52 -0500)]
Makefile
linux_module/Makefile
linux_module/palacios-dev.c
linux_module/palacios-serial.c [deleted file]
linux_module/palacios-stream.c
linux_module/palacios-stream.h
linux_module/palacios-vm.c
linux_module/palacios.h
palacios/include/palacios/vmm_instr_decoder.h

index 695a64b..f65e7d6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -621,7 +621,7 @@ palacios: libv3vee.a
 
 
 linux_module/v3vee.ko: linux_module/*.c linux_module/*.h libv3vee.a
-       cd linux_module/ && make V3_CONFIG_LINUX_KERN=$(V3_CONFIG_LINUX_KERN)
+       cd linux_module/ && make
        cp linux_module/v3vee.ko v3vee.ko
 
 
index 04c6d7a..1f11379 100644 (file)
@@ -6,30 +6,42 @@ ifdef V3_CONFIG_SYMMOD
 LDFLAGS += --script=$(PWD)/ld.symmod.cmd
 endif
 
-EXTRA_CFLAGS  += -I$(PWD)/../palacios/include/ -DMODULE=1 -D__KERNEL__=1
+EXTRA_CFLAGS  += -I$(PWD)/../palacios/include/ -include autoconf.h -DMODULE=1 -D__KERNEL__=1
 
 
-v3vee-objs:=   palacios.o \
+v3vee-objs :=  palacios.o \
                palacios-dev.o \
                palacios-vm.o \
-               palacios-file.o \
-               palacios-console.o \
                palacios-mm.o \
-               palacios-serial.o \
-               palacios-stream.o \
-               palacios-queue.o \
-               palacios-ringbuffer.o \
-               palacios-debugfs.o
+               palacios-queue.o 
 
+ifdef V3_CONFIG_CONSOLE
+       v3vee-objs +=   palacios-console.o
+endif
 
-ifdef V3_CONFIG_PALACIOS_VNET
-               v3vee-objs += palacios-vnet.o           
+ifdef V3_CONFIG_FILE
+       v3vee-objs +=   palacios-file.o 
 endif
-ifdef V3_CONFIG_PALACIOS_PACKET
-               v3vee-objs += palacios-packet.o
+
+ifdef V3_CONFIG_STREAM
+       v3vee-objs +=   palacios-stream.o \
+                       palacios-ringbuffer.o
 endif
-ifdef V3_CONFIG_PALACIOS_SOCKET
-               v3vee-objs += palacios-socket.o
+
+ifdef V3_CONFIG_EXT_INSPECTOR
+       v3vee-objs += palacios-debugfs.o
+endif
+
+ifdef V3_CONFIG_VNET
+       v3vee-objs += palacios-vnet.o           
+endif
+
+ifdef V3_CONFIG_PACKET
+       v3vee-objs += palacios-packet.o
+endif
+
+ifdef V3_CONFIG_SOCKET
+       v3vee-objs += palacios-socket.o
 endif
 
 v3vee-objs += ../libv3vee.a 
index e1143f8..bb9598f 100644 (file)
@@ -28,7 +28,7 @@
 #include "palacios-vnet.h"
 #include "palacios-packet.h"
 
-#ifdef CONFIG_DEBUG_FS
+#ifdef V3_CONFIG_EXT_INSPECTOR
 #include "palacios-debugfs.h"
 #endif
 
@@ -241,24 +241,31 @@ static int __init v3_init(void) {
     
     palacios_vmm_init();
 
+#ifdef V3_CONFIG_STREAM
     palacios_init_stream();
+#endif
+
+#ifdef V3_CONFIG_FILE
     palacios_file_init();
-    palacios_init_console();
+#endif
 
+#ifdef V3_CONFIG_CONSOLE
+    palacios_init_console();
+#endif
 
-#ifdef CONFIG_DEBUG_FS
+#ifdef V3_CONFIG_INSPECTOR
     palacios_init_debugfs();
 #endif
 
-#ifdef CONFIG_PALACIOS_SOCKET
+#ifdef V3_CONFIG_SOCKET
     palacios_socket_init();
 #endif
 
-#ifdef CONFIG_PALACIOS_PACKET
+#ifdef V3_CONFIG_PACKET
     palacios_init_packet(NULL);
 #endif
 
-#ifdef CONFIG_PALACIOS_VNET
+#ifdef V3_CONFIG_VNET
     palacios_init_vnet();
 #endif
 
@@ -303,12 +310,17 @@ static void __exit v3_exit(void) {
 
 
 
-#ifdef CONFIG_DEBUG_FS
+#ifdef V3_CONFIG_EXT_INSPECTOR
     palacios_deinit_debugfs();
 #endif
 
+#ifdef V3_CONFIG_FILE
     palacios_file_deinit();
+#endif
+
+#ifdef V3_CONFIG_STREAM
     palacios_deinit_stream();
+#endif
 
     palacios_deinit_mm();
 
diff --git a/linux_module/palacios-serial.c b/linux_module/palacios-serial.c
deleted file mode 100644 (file)
index 355f4d4..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/* 
- * VM Serial Controls
- * (c) Lei Xia, 2010
- */
-
-#include <linux/device.h>
-#include <linux/cdev.h>
-#include <linux/errno.h>
-#include <linux/fs.h>
-#include <linux/uaccess.h>
-#include <linux/poll.h>
-#include <linux/anon_inodes.h>
-#include <linux/file.h>
-
-#include <palacios/vmm.h>
-#include <palacios/vmm_host_events.h>
-
-#include "palacios.h"
-#include "palacios-stream.h"
-
-
-void
-send_serial_input_to_palacios( unsigned char *input,
-                              unsigned int len,
-                              struct v3_vm_info * vm ) {
-    struct v3_serial_event event;
-
-    if (len > 128) {
-       len = 128;
-    }
-
-    memcpy(event.data, input, len);
-    event.len = len;
-       
-    v3_deliver_serial_event(vm, &event);
-}
-
-static ssize_t 
-serial_read(struct file * filp, char __user * buf, size_t size, loff_t * offset) {
-
-    int len = 0;
-    char temp[128];
-    struct stream_buffer * stream = filp->private_data;
-       
-    memset(temp, 0, 128);
-
-    if (size > 128) {
-       size = 128;
-    }
-       
-    len =  stream_dequeue(stream, temp, size);
-       
-    if (copy_to_user(buf, temp, len)) {
-       printk("Read fault\n");
-       return -EFAULT;
-    }
-
-    printk("Returning %d bytes\n", len);
-
-    return len;
-}
-
-static ssize_t 
-serial_write(struct file * filp, const char __user * buf, size_t size, loff_t * offset) {
-    char temp[128];
-    struct stream_buffer * stream = filp->private_data;
-    struct v3_vm_info * vm;
-
-    memset(temp, 0, 128);
-
-    if (size > 128) {
-       size = 128;
-    }
-
-    if (copy_from_user(temp, buf, size)) {
-       printk("Write fault\n");
-       return -EFAULT;
-    }
-
-    vm = stream->guest->v3_ctx;
-    send_serial_input_to_palacios(temp, size, vm);
-   
-    return size;
-}
-
-
-static unsigned int 
-serial_poll(struct file * filp, struct poll_table_struct * poll_tb) {
-    unsigned int mask = 0;
-    struct stream_buffer *stream = filp->private_data;
-  
-    poll_wait(filp, &(stream->intr_queue), poll_tb);
-
-    if(stream_datalen(stream) > 0){
-       mask = POLLIN | POLLRDNORM;
-    }
-       
-    printk("polling v3 serial\n");
-
-    return mask;
-}
-
-static struct file_operations v3_cons_fops = {
-    .read     = serial_read,
-    .write    = serial_write,
-    .poll     = serial_poll,
-};
-
-
-int open_serial(char * name) {
-    int cons_fd;
-    void *stream;
-
-    printk("open path: %s\n", name);
-
-    stream = find_stream_by_name(NULL, name);
-
-    if (stream == NULL) {
-       return -1;
-    }
-
-    cons_fd = anon_inode_getfd("v3-cons", &v3_cons_fops, stream, 0);
-    
-    if (cons_fd < 0) {
-       printk("Error creating serial inode\n");
-       return cons_fd;
-    }
-
-    printk("Returning new serial fd\n");
-           
-    return cons_fd;
-}
index e79f093..340d27f 100644 (file)
@@ -12,7 +12,7 @@
 
 static struct list_head global_streams;
 
-int stream_enqueue(struct stream_buffer * stream, char * buf, int len) {
+static int stream_enqueue(struct stream_buffer * stream, char * buf, int len) {
     int bytes = 0;
 
     bytes = ringbuf_write(stream->buf, buf, len);
@@ -34,6 +34,12 @@ int stream_datalen(struct stream_buffer * stream){
 }
 
 
+int open_stream(const char * name) {
+    return -1;
+}
+
+
+
 struct stream_buffer * find_stream_by_name(struct v3_guest * guest, const char * name) {
     struct stream_buffer * stream = NULL;
     struct list_head * stream_list = NULL;
index f3b21a0..d3b73e1 100644 (file)
@@ -32,11 +32,12 @@ struct stream_buffer {
 
 void palacios_init_stream(void);
 void palacios_deinit_stream(void);
-int stream_enqueue(struct stream_buffer * stream, char * buf, int len);
+
 int stream_dequeue(struct stream_buffer * stream, char * buf, int len);
 int stream_datalen(struct stream_buffer * stream);
 
 struct stream_buffer * find_stream_by_name(struct v3_guest * guest, const char * name);
 
+int open_stream(const char * name);
 #endif
 
index 0e1f51e..3490548 100644 (file)
 #include <linux/file.h>
 #include <linux/spinlock.h>
 
-#ifdef CONFIG_DEBUG_FS
-#include "palacios-debugfs.h"
-#endif
 
 #include <palacios/vmm.h>
 
 #include "palacios.h"
-#include "palacios-console.h"
-#include "palacios-serial.h"
 #include "palacios-vm.h"
 
+#ifdef V3_CONFIG_STREAM
+#include "palacios-stream.h"
+#endif
+
+#ifdef V3_CONFIG_CONSOLE
+#include "palacios-console.h"
+#endif
+
+#ifdef V3_CONFIG_EXT_INSPECTOR
+#include "palacios-debugfs.h"
+#endif
+
+
 
 extern struct class * v3_class;
 #define STREAM_NAME_LEN 128
 
 static long v3_vm_ioctl(struct file * filp,
                        unsigned int ioctl, unsigned long arg) {
-    void __user * argp = (void __user *)arg;
-    char path_name[STREAM_NAME_LEN];
 
     struct v3_guest * guest = filp->private_data;
 
@@ -43,24 +49,39 @@ static long v3_vm_ioctl(struct file * filp,
 
     switch (ioctl) {
 
+       case V3_VM_STOP: {
+           printk("Stopping VM\n");
+           stop_palacios_vm(guest);
+           break;
+       }
+
        case V3_VM_CONSOLE_CONNECT: {
+#ifdef V3_CONFIG_CONSOLE
            return connect_console(guest);
+#else
+           printk("Console support not available\n");
+           return -EFAULT;
+#endif
            break;
        }
-       case V3_VM_SERIAL_CONNECT: {
+       case V3_VM_STREAM_CONNECT: {
+#ifdef V3_CONFIG_STREAM
+           void __user * argp = (void __user *)arg;
+           char path_name[STREAM_NAME_LEN];
+
            if (copy_from_user(path_name, argp, STREAM_NAME_LEN)) {
-               printk("copy from user error getting guest image...\n");
+               printk("%s(%d): copy from user error...\n", __FILE__, __LINE__);
                return -EFAULT;
            }
 
-           return open_serial(path_name);
-           break;
-       }
-       case V3_VM_STOP: {
-           printk("Stopping VM\n");
-           stop_palacios_vm(guest);
+           return open_stream(path_name);
+#else
+           printk("Stream support Not available\n");
+           return -EFAULT;
+#endif
            break;
        }
+
        default: 
            printk("\tUnhandled\n");
            return -EINVAL;
@@ -150,7 +171,7 @@ int start_palacios_vm(void * arg)  {
 
 
 
-#if CONFIG_DEBUG_FS
+#if V3_CONFIG_EXT_INSPECTOR
     dfs_register_vm(guest);
 #endif
 
index 9f27187..c0e3ba2 100644 (file)
@@ -6,7 +6,9 @@
 #include <linux/sched.h>
 #include <linux/slab.h>
 
+#ifdef V3_CONFIG_CONSOLE
 #include "palacios-console.h"
+#endif
 
 /* Global Control IOCTLs */
 #define V3_START_GUEST 10
@@ -15,7 +17,7 @@
 
 /* VM Specific IOCTLs */
 #define V3_VM_CONSOLE_CONNECT 20
-#define V3_VM_SERIAL_CONNECT 21
+#define V3_VM_STREAM_CONNECT 21
 #define V3_VM_STOP 22
 
 struct v3_guest_img {
@@ -51,7 +53,9 @@ struct v3_guest {
     struct list_head streams;
     struct list_head sockets;
 
+#ifdef V3_CONFIG_CONSOLE
     struct palacios_console console;
+#endif
 
     struct completion start_done;
     struct completion thread_done;
index 4341910..f36a738 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <palacios/vmm_types.h>
 
-
 /* .... Giant fucking switch tables */
 
 
@@ -450,7 +449,7 @@ static inline int decode_cr(struct guest_info * core,
 
     struct v3_ctrl_regs * crs = &(core->ctrl_regs);
 
-    PrintDebug("\t Ctrl regs %d\n", reg_code);
+//    PrintDebug("\t Ctrl regs %d\n", reg_code);
 
     switch (reg_code) {
        case 0: