Created
March 25, 2014 20:15
-
-
Save Pacifist117/9770381 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64,66d63 | |
< #include <linux/nitro.h> | |
< #include <linux/nitro_main.h> | |
< | |
77d73 | |
< //static DEFINE_RAW_SPINLOCK(kvm_count_lock); | |
148c144 | |
< mutex_lock_killable(&vcpu->mutex); | |
--- | |
> mutex_lock(&vcpu->mutex); | |
223d218 | |
< | |
247,249d241 | |
< | |
< printk("Kevin: vcpu initiated in kvm (%s)\n",__FUNCTION__); | |
< | |
513,515d504 | |
< | |
< printk("Kevin: vm initiated in kvm (%s)\n",__FUNCTION__); | |
< | |
527d515 | |
< printk("Kevin: vm FAILED to initiate in kvm (%s)\n",__FUNCTION__); | |
529a518 | |
> | |
577,578d565 | |
< | |
< nitro_destroy_vm_hook(kvm); | |
1538,1540d1524 | |
< | |
< //printk("Kevin: HLT instruction called in kvm (%s)\n",__FUNCTION__); | |
< | |
1674c1658 | |
< int create_vcpu_fd(struct kvm_vcpu *vcpu) | |
--- | |
> static int create_vcpu_fd(struct kvm_vcpu *vcpu) | |
1729,1730d1712 | |
< | |
< nitro_create_vcpu_hook(vcpu); | |
1733,1735d1714 | |
< | |
< printk("Kevin: Lock freed (nitro_create_vcpu_hook returned and about to return in (%s)\n",__FUNCTION__); | |
< | |
1765,1774c1744,1745 | |
< // if (vcpu->kvm->mm != current->mm) | |
< // return -EIO; | |
< | |
< switch(ioctl){ | |
< case KVM_NITRO_GET_EVENT: | |
< return nitro_ioctl_get_event(vcpu); | |
< break; | |
< case KVM_NITRO_CONTINUE: | |
< return nitro_ioctl_continue(vcpu); | |
< break; | |
--- | |
> if (vcpu->kvm->mm != current->mm) | |
> return -EIO; | |
1776,1783c1747 | |
< //#if defined(CONFIG_S390) || defined(CONFIG_PPC) | |
< #if defined(CONFIG_S390) || defined(CONFIG_PPC) || defined(CONFIG_MIPS) | |
< case KVM_S390_INTERRUPT: | |
< case KVM_INTERRUPT: | |
< return kvm_arch_vcpu_ioctl(filp, ioctl, arg); | |
< break; | |
< #endif | |
< } | |
--- | |
> #if defined(CONFIG_S390) || defined(CONFIG_PPC) | |
1786a1751 | |
> */ | |
1789,1794c1754 | |
< //asynchronous nitro calls | |
< if (ioctl == KVM_NITRO_GET_EVENT) | |
< return nitro_ioctl_get_event(vcpu); | |
< else if(ioctl == KVM_NITRO_CONTINUE) | |
< return nitro_ioctl_continue(vcpu); | |
< */ | |
--- | |
> #endif | |
2028,2029c1988,1989 | |
< //if (kvm->mm != current->mm) | |
< // return -EIO; | |
--- | |
> if (kvm->mm != current->mm) | |
> return -EIO; | |
2113,2162d2072 | |
< //#ifdef CONFIG_HAVE_KVM_IRQ_ROUTING | |
< //#ifdef KVM_CAP_IRQ_ROUTING | |
< case KVM_SET_GSI_ROUTING: { | |
< struct kvm_irq_routing routing; | |
< struct kvm_irq_routing __user *urouting; | |
< struct kvm_irq_routing_entry *entries; | |
< | |
< r = -EFAULT; | |
< if (copy_from_user(&routing, argp, sizeof(routing))) | |
< goto out; | |
< r = -EINVAL; | |
< if (routing.nr >= KVM_MAX_IRQ_ROUTES) | |
< goto out; | |
< if (routing.flags) | |
< goto out; | |
< r = -ENOMEM; | |
< entries = vmalloc(routing.nr * sizeof(*entries)); | |
< if (!entries) | |
< goto out; | |
< r = -EFAULT; | |
< urouting = argp; | |
< if (copy_from_user(entries, urouting->entries, | |
< routing.nr * sizeof(*entries))) | |
< goto out_free_irq_routing; | |
< r = kvm_set_irq_routing(kvm, entries, routing.nr, | |
< routing.flags); | |
< out_free_irq_routing: | |
< vfree(entries); | |
< break; | |
< } | |
< //#endif /* CONFIG_HAVE_KVM_IRQ_ROUTING */ | |
< //#endif /* KVM_CAP_IRQ_ROUTING */ | |
< case KVM_NITRO_ATTACH_VCPUS: { | |
< int i; | |
< struct nitro_vcpus nvcpus; | |
< | |
< r = nitro_iotcl_attach_vcpus(kvm,&nvcpus); | |
< if (r) | |
< goto out; | |
< | |
< r = -EFAULT; | |
< if (copy_to_user(argp, &nvcpus, sizeof(nvcpus))){ | |
< for(i=0;i<nvcpus.num_vcpus;i++) | |
< kvm_put_kvm(kvm); | |
< goto out; | |
< } | |
< | |
< r = 0; | |
< break; | |
< } | |
2166,2167d2075 | |
< { | |
< printk("Kevin: r = -ENOTTY in (%s) ioctl %u (%d)\n",__FUNCTION__,ioctl,ioctl); | |
2169d2076 | |
< } | |
2277,2279d2183 | |
< | |
< nitro_create_vm_hook(kvm); | |
< | |
2311d2214 | |
< void __user *argp = (void __user *)arg; | |
2344,2383d2246 | |
< case KVM_NITRO_NUM_VMS: | |
< r = nitro_iotcl_num_vms(); | |
< break; | |
< case KVM_NITRO_ATTACH_VM: { | |
< pid_t creator; | |
< struct kvm *kvm; | |
< | |
< r = -EFAULT; | |
< if (copy_from_user(&creator, argp, sizeof(pid_t))) | |
< goto out; | |
< | |
< r = -ESRCH; | |
< kvm = nitro_get_vm_by_creator(creator); | |
< if(kvm == NULL) | |
< goto out; | |
< | |
< kvm_get_kvm(kvm); | |
< r = anon_inode_getfd("kvm-vm", &kvm_vm_fops, kvm, O_RDWR | O_CLOEXEC); | |
< if(r<0) | |
< kvm_put_kvm(kvm); | |
< break; | |
< } | |
< /*case KVM_NITRO_ATTACH_VCPUS: { | |
< int i; | |
< struct nitro_vcpus nvcpus; | |
< | |
< r = nitro_iotcl_attach_vcpus(kvm,&nvcpus); | |
< if (r) | |
< goto out; | |
< | |
< r = -EFAULT; | |
< if (copy_to_user(arg, &nvcpus, sizeof(nvcpus))){ | |
< for(i=0;i<nvcpus.num_vcpus;i++) | |
< kvm_put_kvm(kvm); | |
< goto out; | |
< } | |
< | |
< r = 0; | |
< break; | |
< } */ | |
2843d2705 | |
< | |
2932,2933d2793 | |
< printk("Kevin: kvm inititaied in kvm (%s)\n",__FUNCTION__); | |
< | |
2959d2818 | |
< printk("Kevin: kvm FAILED to initiate in kvm (%s)\n",__FUNCTION__); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment