Skip to content

Commit

Permalink
KVM: Export memory slot allocation mechanism
Browse files Browse the repository at this point in the history
Remove kvm memory slot allocation mechanism from the ioctl
and put it to exported function.

Signed-off-by: Izik Eidus <[email protected]>
Signed-off-by: Avi Kivity <[email protected]>
  • Loading branch information
Izik Eidus authored and avikivity committed Jan 30, 2008
1 parent 80b14b5 commit 210c7c4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
3 changes: 3 additions & 0 deletions drivers/kvm/kvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
17 changes: 13 additions & 4 deletions drivers/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -789,6 +788,16 @@ static int kvm_vm_ioctl_set_memory_region(struct kvm *kvm,
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,
Expand Down

0 comments on commit 210c7c4

Please sign in to comment.