X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_module%2Fvm.c;h=a1af56498537a3de5543c665b3bf5d0837502537;hb=f82ccce5ce7629dce6f1a6feee8b47fa13a6756d;hp=08ae7e016e59be8ed60c2d9cef24e299d8015a1c;hpb=793f9cd53a472668dbeb16341085e5512484485c;p=palacios.git diff --git a/linux_module/vm.c b/linux_module/vm.c index 08ae7e0..a1af564 100644 --- a/linux_module/vm.c +++ b/linux_module/vm.c @@ -127,6 +127,27 @@ static long v3_vm_ioctl(struct file * filp, printk("V3 IOCTL %d\n", ioctl); switch (ioctl) { + case V3_VM_LAUNCH: { + printk("palacios: launching vm\n"); + + if (v3_start_vm(guest->v3_ctx, (0x1 << num_online_cpus()) - 1) < 0) { + printk("palacios: launch of vm failed\n"); + return -1; + } + + break; + } + case V3_VM_STOP: { + printk("Stopping VM (%s) (%p)\n", guest->name, guest); + + if (irqs_disabled()) { + printk("WHAT!!?? IRQs are disabled??\n"); + break; + } + + v3_stop_vm(guest->v3_ctx); + break; + } case V3_VM_PAUSE: { printk("Pausing VM (%s)\n", guest->name); v3_pause_vm(guest->v3_ctx); @@ -246,22 +267,15 @@ 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 create_palacios_vm(struct v3_guest * guest) { int err; - - daemonize(guest->name); - // allow_signal(SIGKILL); - - init_vm_extensions(guest); guest->v3_ctx = v3_create_vm(guest->img, (void *)guest, guest->name); if (guest->v3_ctx == NULL) { printk("palacios: failed to create vm\n"); - complete(&(guest->start_done)); return -1; } @@ -280,7 +294,6 @@ int start_palacios_vm(void * arg) { if (err) { printk("Fails to add cdev\n"); v3_free_vm(guest->v3_ctx); - complete(&(guest->start_done)); return -1; } @@ -288,25 +301,10 @@ int start_palacios_vm(void * arg) { printk("Fails to create device\n"); cdev_del(&(guest->cdev)); v3_free_vm(guest->v3_ctx); - complete(&(guest->start_done)); return -1; } - complete(&(guest->start_done)); - - printk("palacios: launching vm\n"); - - if (v3_start_vm(guest->v3_ctx, 0xffffffff) < 0) { - printk("palacios: launch of vm failed\n"); - device_destroy(v3_class, guest->vm_dev); - cdev_del(&(guest->cdev)); - v3_free_vm(guest->v3_ctx); - return -1; - } - - complete(&(guest->thread_done)); - - printk("palacios: vm completed. returning.\n"); + printk("palacios: vm created at /dev/v3-vm%d\n", MINOR(guest->vm_dev)); return 0; } @@ -314,12 +312,8 @@ 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)); +int free_palacios_vm(struct v3_guest * guest) { v3_free_vm(guest->v3_ctx);