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
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
#include "palacios-vnet.h"
#include "palacios-packet.h"
-#ifdef CONFIG_DEBUG_FS
+#ifdef V3_CONFIG_EXT_INSPECTOR
#include "palacios-debugfs.h"
#endif
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
-#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();
+++ /dev/null
-/*
- * 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;
-}
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);
}
+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;
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
#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;
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;
-#if CONFIG_DEBUG_FS
+#if V3_CONFIG_EXT_INSPECTOR
dfs_register_vm(guest);
#endif
#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
/* 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 {
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;
#include <palacios/vmm_types.h>
-
/* .... Giant fucking switch tables */
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: