Commit 210c7c4d authored by Izik Eidus's avatar Izik Eidus Committed by Avi Kivity

KVM: Export memory slot allocation mechanism

Remove kvm memory slot allocation mechanism from the ioctl
and put it to exported function.
Signed-off-by: default avatarIzik Eidus <izike@qumranet.com>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
parent 80b14b5b
...@@ -513,6 +513,9 @@ struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva); ...@@ -513,6 +513,9 @@ struct page *gva_to_page(struct kvm_vcpu *vcpu, gva_t gva);
extern struct page *bad_page; extern struct page *bad_page;
int is_error_page(struct page *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); gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn);
struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn);
void kvm_release_page(struct page *page); void kvm_release_page(struct page *page);
......
...@@ -643,10 +643,9 @@ EXPORT_SYMBOL_GPL(fx_init); ...@@ -643,10 +643,9 @@ EXPORT_SYMBOL_GPL(fx_init);
* *
* Discontiguous memory is allowed, mostly for framebuffers. * Discontiguous memory is allowed, mostly for framebuffers.
*/ */
static int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, int kvm_set_memory_region(struct kvm *kvm,
struct struct kvm_userspace_memory_region *mem,
kvm_userspace_memory_region *mem, int user_alloc)
int user_alloc)
{ {
int r; int r;
gfn_t base_gfn; gfn_t base_gfn;
...@@ -789,6 +788,16 @@ static int kvm_vm_ioctl_set_memory_region(struct kvm *kvm, ...@@ -789,6 +788,16 @@ static int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
kvm_free_physmem_slot(&new, &old); kvm_free_physmem_slot(&new, &old);
out: out:
return r; 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, static int kvm_vm_ioctl_set_nr_mmu_pages(struct kvm *kvm,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment