X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_module%2Fpalacios-vm.c;h=0e1f51eac6aab9541e7fa96b478751861f9f5c47;hb=b4bf1f847791efa011e6cd121face4c930759923;hp=cd3ba2c23e622fb76db87ea7011d23a8878c80f2;hpb=260bb3e805ebc92ae294c3c2b36d027ba8bca488;p=palacios.git diff --git a/linux_module/palacios-vm.c b/linux_module/palacios-vm.c index cd3ba2c..0e1f51e 100644 --- a/linux_module/palacios-vm.c +++ b/linux_module/palacios-vm.c @@ -17,6 +17,9 @@ #include #include +#ifdef CONFIG_DEBUG_FS +#include "palacios-debugfs.h" +#endif #include @@ -25,6 +28,7 @@ #include "palacios-serial.h" #include "palacios-vm.h" + extern struct class * v3_class; #define STREAM_NAME_LEN 128 @@ -102,7 +106,6 @@ extern u32 pg_frees; extern u32 mallocs; extern u32 frees; - int start_palacios_vm(void * arg) { struct v3_guest * guest = (struct v3_guest *)arg; int err; @@ -113,8 +116,6 @@ int start_palacios_vm(void * arg) { unlock_kernel(); - - guest->v3_ctx = v3_create_vm(guest->img, (void *)guest, guest->name); if (guest->v3_ctx == NULL) { @@ -143,19 +144,24 @@ int start_palacios_vm(void * arg) { 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; @@ -165,13 +171,19 @@ int start_palacios_vm(void * arg) { 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; }