@@ -801,4 +801,4 @@ static inline bool kvm_check_request(int req, struct kvm_vcpu *vcpu)
}
#endif
-
+struct kvm *get_kvm_from_task(struct task_struct *task);
@@ -2664,6 +2664,19 @@ static const struct file_operations *stat_fops[] = {
[KVM_STAT_VM] = &vm_stat_fops,
};
+struct kvm* get_kvm_from_task(struct task_struct *task)
+{
+ struct kvm *kvm;
+
+ list_for_each_entry(kvm, &vm_list, vm_list) {
+ if(kvm->mm == task->mm)
+ return kvm;
+ }
+
+ return NULL;
+}
+EXPORT_SYMBOL_GPL(get_kvm_from_task);
+
static void kvm_init_debug(void)
{
struct kvm_stats_debugfs_item *p;