]> err.no Git - linux-2.6/commitdiff
KVM: Export memory slot allocation mechanism
authorIzik Eidus <izike@qumranet.com>
Wed, 24 Oct 2007 21:52:57 +0000 (23:52 +0200)
committerAvi Kivity <avi@qumranet.com>
Wed, 30 Jan 2008 15:52:56 +0000 (17:52 +0200)
Remove kvm memory slot allocation mechanism from the ioctl
and put it to exported function.

Signed-off-by: Izik Eidus <izike@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
drivers/kvm/kvm.h
drivers/kvm/kvm_main.c

index 12de42c789a2a183640a61eafe8042aa8dfd3ce3..f3dda088e34b9a69351aa65c82c9037bfe548f10 100644 (file)
@@ -513,6 +513,9 @@ struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva);
 extern struct page *bad_page;
 
 int is_error_page(struct page *page);
+int kvm_set_memory_region(struct kvm *kvm,
+                         struct kvm_userspace_memory_region *mem,
+                         int user_alloc);
 gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn);
 struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
 void kvm_release_page(struct page *page);
index ab2c77c9ecef925c60e6eabe095241a5664a65fa..5113cbf7567453e4d2ba331bb31e1e8fa7ffad43 100644 (file)
@@ -643,10 +643,9 @@ EXPORT_SYMBOL_GPL(fx_init);
  *
  * Discontiguous memory is allowed, mostly for framebuffers.
  */
-static int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
-                                         struct
-                                         kvm_userspace_memory_region *mem,
-                                         int user_alloc)
+int kvm_set_memory_region(struct kvm *kvm,
+                         struct kvm_userspace_memory_region *mem,
+                         int user_alloc)
 {
        int r;
        gfn_t base_gfn;
@@ -789,6 +788,16 @@ out_unlock:
        kvm_free_physmem_slot(&new, &old);
 out:
        return r;
+
+}
+EXPORT_SYMBOL_GPL(kvm_set_memory_region);
+
+static int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
+                                         struct
+                                         kvm_userspace_memory_region *mem,
+                                         int user_alloc)
+{
+       return kvm_set_memory_region(kvm, mem, user_alloc);
 }
 
 static int kvm_vm_ioctl_set_nr_mmu_pages(struct kvm *kvm,