#include <linux/file.h>
#include <linux/spinlock.h>
+#ifdef CONFIG_DEBUG_FS
+#include "palacios-debugfs.h"
+#endif
#include <palacios/vmm.h>
#include "palacios-serial.h"
#include "palacios-vm.h"
+
extern struct class * v3_class;
#define STREAM_NAME_LEN 128
extern u32 mallocs;
extern u32 frees;
-
int start_palacios_vm(void * arg) {
struct v3_guest * guest = (struct v3_guest *)arg;
int err;
unlock_kernel();
-
-
guest->v3_ctx = v3_create_vm(guest->img, (void *)guest, guest->name);
if (guest->v3_ctx == NULL) {
return -1;
}
- complete(&(guest->thread_done));
-
+ complete(&(guest->start_done));
printk("palacios: launching vm\n");
+
+
+#if CONFIG_DEBUG_FS
+ dfs_register_vm(guest);
+#endif
+
+
if (v3_start_vm(guest->v3_ctx, 0xffffffff) < 0) {
printk("palacios: launch of vm failed\n");
return -1;
- }
+ }
complete(&(guest->thread_done));
-
printk("palacios: vm completed. returning.\n");
return 0;
int stop_palacios_vm(struct v3_guest * guest) {
-
+
v3_stop_vm(guest->v3_ctx);
wait_for_completion(&(guest->thread_done));
v3_free_vm(guest->v3_ctx);
+ device_destroy(v3_class, guest->vm_dev);
+
+ cdev_del(&(guest->cdev));
+
+ kfree(guest->img);
+ kfree(guest);
return 0;
}