* takes advantage of having initially sorted array and
* known changed memslot position.
*/
-static void insert_memslot(struct kvm_memslots *slots,
- struct kvm_memory_slot *new)
+static void update_memslots(struct kvm_memslots *slots,
+ struct kvm_memory_slot *new)
{
int id = new->id;
int i = slots->id_to_index[id];
slots->id_to_index[mslots[i].id] = i;
}
-static void update_memslots(struct kvm_memslots *slots,
- struct kvm_memory_slot *new)
-{
- if (new) {
- insert_memslot(slots, new);
- }
-}
-
static int check_memory_region_flags(struct kvm_userspace_memory_region *mem)
{
u32 valid_flags = KVM_MEM_LOG_DIRTY_PAGES;
}
static struct kvm_memslots *install_new_memslots(struct kvm *kvm,
- struct kvm_memslots *slots, struct kvm_memory_slot *new)
+ struct kvm_memslots *slots)
{
struct kvm_memslots *old_memslots = kvm->memslots;
WARN_ON(old_memslots->generation & 1);
slots->generation = old_memslots->generation + 1;
- update_memslots(slots, new);
rcu_assign_pointer(kvm->memslots, slots);
synchronize_srcu_expedited(&kvm->srcu);
slot = id_to_memslot(slots, mem->slot);
slot->flags |= KVM_MEMSLOT_INVALID;
- old_memslots = install_new_memslots(kvm, slots, NULL);
+ old_memslots = install_new_memslots(kvm, slots);
/* slot was deleted or moved, clear iommu mapping */
kvm_iommu_unmap_pages(kvm, &old);
memset(&new.arch, 0, sizeof(new.arch));
}
- old_memslots = install_new_memslots(kvm, slots, &new);
+ update_memslots(slots, &new);
+ old_memslots = install_new_memslots(kvm, slots);
kvm_arch_commit_memory_region(kvm, mem, &old, change);