Commit 462fce46 authored by Takuya Yoshikawa's avatar Takuya Yoshikawa Committed by Marcelo Tosatti

KVM: set_memory_region: Drop user_alloc from prepare/commit_memory_region()

X86 does not use this any more.  The remaining user, s390's !user_alloc
check, can be simply removed since KVM_SET_MEMORY_REGION ioctl is no
longer supported.

Note: fixed powerpc's indentations with spaces to suppress checkpatch
errors.
Signed-off-by: default avatarTakuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent ee2c25ef
...@@ -231,16 +231,14 @@ int kvm_arch_set_memory_region(struct kvm *kvm, ...@@ -231,16 +231,14 @@ int kvm_arch_set_memory_region(struct kvm *kvm,
int kvm_arch_prepare_memory_region(struct kvm *kvm, int kvm_arch_prepare_memory_region(struct kvm *kvm,
struct kvm_memory_slot *memslot, struct kvm_memory_slot *memslot,
struct kvm_memory_slot old, struct kvm_memory_slot old,
struct kvm_userspace_memory_region *mem, struct kvm_userspace_memory_region *mem)
bool user_alloc)
{ {
return 0; return 0;
} }
void kvm_arch_commit_memory_region(struct kvm *kvm, void kvm_arch_commit_memory_region(struct kvm *kvm,
struct kvm_userspace_memory_region *mem, struct kvm_userspace_memory_region *mem,
struct kvm_memory_slot old, struct kvm_memory_slot old)
bool user_alloc)
{ {
} }
......
...@@ -1579,8 +1579,7 @@ int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) ...@@ -1579,8 +1579,7 @@ int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages)
int kvm_arch_prepare_memory_region(struct kvm *kvm, int kvm_arch_prepare_memory_region(struct kvm *kvm,
struct kvm_memory_slot *memslot, struct kvm_memory_slot *memslot,
struct kvm_memory_slot old, struct kvm_memory_slot old,
struct kvm_userspace_memory_region *mem, struct kvm_userspace_memory_region *mem)
bool user_alloc)
{ {
unsigned long i; unsigned long i;
unsigned long pfn; unsigned long pfn;
...@@ -1610,8 +1609,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, ...@@ -1610,8 +1609,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
void kvm_arch_commit_memory_region(struct kvm *kvm, void kvm_arch_commit_memory_region(struct kvm *kvm,
struct kvm_userspace_memory_region *mem, struct kvm_userspace_memory_region *mem,
struct kvm_memory_slot old, struct kvm_memory_slot old)
bool user_alloc)
{ {
return; return;
} }
......
...@@ -413,16 +413,14 @@ int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) ...@@ -413,16 +413,14 @@ int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages)
int kvm_arch_prepare_memory_region(struct kvm *kvm, int kvm_arch_prepare_memory_region(struct kvm *kvm,
struct kvm_memory_slot *memslot, struct kvm_memory_slot *memslot,
struct kvm_memory_slot old, struct kvm_memory_slot old,
struct kvm_userspace_memory_region *mem, struct kvm_userspace_memory_region *mem)
bool user_alloc)
{ {
return kvmppc_core_prepare_memory_region(kvm, memslot, mem); return kvmppc_core_prepare_memory_region(kvm, memslot, mem);
} }
void kvm_arch_commit_memory_region(struct kvm *kvm, void kvm_arch_commit_memory_region(struct kvm *kvm,
struct kvm_userspace_memory_region *mem, struct kvm_userspace_memory_region *mem,
struct kvm_memory_slot old, struct kvm_memory_slot old)
bool user_alloc)
{ {
kvmppc_core_commit_memory_region(kvm, mem, old); kvmppc_core_commit_memory_region(kvm, mem, old);
} }
......
...@@ -975,8 +975,7 @@ int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) ...@@ -975,8 +975,7 @@ int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages)
int kvm_arch_prepare_memory_region(struct kvm *kvm, int kvm_arch_prepare_memory_region(struct kvm *kvm,
struct kvm_memory_slot *memslot, struct kvm_memory_slot *memslot,
struct kvm_memory_slot old, struct kvm_memory_slot old,
struct kvm_userspace_memory_region *mem, struct kvm_userspace_memory_region *mem)
bool user_alloc)
{ {
/* A few sanity checks. We can have exactly one memory slot which has /* A few sanity checks. We can have exactly one memory slot which has
to start at guest virtual zero and which has to be located at a to start at guest virtual zero and which has to be located at a
...@@ -997,16 +996,12 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, ...@@ -997,16 +996,12 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
if (mem->memory_size & 0xffffful) if (mem->memory_size & 0xffffful)
return -EINVAL; return -EINVAL;
if (!user_alloc)
return -EINVAL;
return 0; return 0;
} }
void kvm_arch_commit_memory_region(struct kvm *kvm, void kvm_arch_commit_memory_region(struct kvm *kvm,
struct kvm_userspace_memory_region *mem, struct kvm_userspace_memory_region *mem,
struct kvm_memory_slot old, struct kvm_memory_slot old)
bool user_alloc)
{ {
int rc; int rc;
......
...@@ -6907,8 +6907,7 @@ int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) ...@@ -6907,8 +6907,7 @@ int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages)
int kvm_arch_prepare_memory_region(struct kvm *kvm, int kvm_arch_prepare_memory_region(struct kvm *kvm,
struct kvm_memory_slot *memslot, struct kvm_memory_slot *memslot,
struct kvm_memory_slot old, struct kvm_memory_slot old,
struct kvm_userspace_memory_region *mem, struct kvm_userspace_memory_region *mem)
bool user_alloc)
{ {
int npages = memslot->npages; int npages = memslot->npages;
...@@ -6938,8 +6937,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, ...@@ -6938,8 +6937,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
void kvm_arch_commit_memory_region(struct kvm *kvm, void kvm_arch_commit_memory_region(struct kvm *kvm,
struct kvm_userspace_memory_region *mem, struct kvm_userspace_memory_region *mem,
struct kvm_memory_slot old, struct kvm_memory_slot old)
bool user_alloc)
{ {
int nr_mmu_pages = 0, npages = mem->memory_size >> PAGE_SHIFT; int nr_mmu_pages = 0, npages = mem->memory_size >> PAGE_SHIFT;
......
...@@ -464,12 +464,10 @@ int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages); ...@@ -464,12 +464,10 @@ int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages);
int kvm_arch_prepare_memory_region(struct kvm *kvm, int kvm_arch_prepare_memory_region(struct kvm *kvm,
struct kvm_memory_slot *memslot, struct kvm_memory_slot *memslot,
struct kvm_memory_slot old, struct kvm_memory_slot old,
struct kvm_userspace_memory_region *mem, struct kvm_userspace_memory_region *mem);
bool user_alloc);
void kvm_arch_commit_memory_region(struct kvm *kvm, void kvm_arch_commit_memory_region(struct kvm *kvm,
struct kvm_userspace_memory_region *mem, struct kvm_userspace_memory_region *mem,
struct kvm_memory_slot old, struct kvm_memory_slot old);
bool user_alloc);
bool kvm_largepages_enabled(void); bool kvm_largepages_enabled(void);
void kvm_disable_largepages(void); void kvm_disable_largepages(void);
/* flush all memory translations */ /* flush all memory translations */
......
...@@ -875,7 +875,7 @@ int __kvm_set_memory_region(struct kvm *kvm, ...@@ -875,7 +875,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
slots = old_memslots; slots = old_memslots;
} }
r = kvm_arch_prepare_memory_region(kvm, &new, old, mem, user_alloc); r = kvm_arch_prepare_memory_region(kvm, &new, old, mem);
if (r) if (r)
goto out_slots; goto out_slots;
...@@ -915,7 +915,7 @@ int __kvm_set_memory_region(struct kvm *kvm, ...@@ -915,7 +915,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
old_memslots = install_new_memslots(kvm, slots, &new); old_memslots = install_new_memslots(kvm, slots, &new);
kvm_arch_commit_memory_region(kvm, mem, old, user_alloc); kvm_arch_commit_memory_region(kvm, mem, old);
kvm_free_physmem_slot(&old, &new); kvm_free_physmem_slot(&old, &new);
kfree(old_memslots); kfree(old_memslots);
......
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