aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/kvm/arm.c5
-rw-r--r--arch/ia64/kvm/kvm-ia64.c5
-rw-r--r--arch/mips/kvm/kvm_mips.c5
-rw-r--r--arch/powerpc/include/asm/kvm_ppc.h6
-rw-r--r--arch/powerpc/kvm/book3s.c4
-rw-r--r--arch/powerpc/kvm/booke.c4
-rw-r--r--arch/powerpc/kvm/powerpc.c9
-rw-r--r--arch/s390/kvm/kvm-s390.c5
-rw-r--r--arch/x86/kvm/x86.c5
-rw-r--r--include/linux/kvm_host.h5
-rw-r--r--virt/kvm/kvm_main.c12
11 files changed, 37 insertions, 28 deletions
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index cc5adb9349ef..e312e4a53f8d 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -152,12 +152,13 @@ int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
152 return VM_FAULT_SIGBUS; 152 return VM_FAULT_SIGBUS;
153} 153}
154 154
155void kvm_arch_free_memslot(struct kvm_memory_slot *free, 155void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
156 struct kvm_memory_slot *dont) 156 struct kvm_memory_slot *dont)
157{ 157{
158} 158}
159 159
160int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) 160int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
161 unsigned long npages)
161{ 162{
162 return 0; 163 return 0;
163} 164}
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index bdfd8789b376..985bf80c622e 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -1550,12 +1550,13 @@ int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
1550 return VM_FAULT_SIGBUS; 1550 return VM_FAULT_SIGBUS;
1551} 1551}
1552 1552
1553void kvm_arch_free_memslot(struct kvm_memory_slot *free, 1553void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
1554 struct kvm_memory_slot *dont) 1554 struct kvm_memory_slot *dont)
1555{ 1555{
1556} 1556}
1557 1557
1558int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) 1558int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
1559 unsigned long npages)
1559{ 1560{
1560 return 0; 1561 return 0;
1561} 1562}
diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index a7b044536de4..73b34827826c 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -198,12 +198,13 @@ kvm_arch_dev_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)
198 return -ENOIOCTLCMD; 198 return -ENOIOCTLCMD;
199} 199}
200 200
201void kvm_arch_free_memslot(struct kvm_memory_slot *free, 201void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
202 struct kvm_memory_slot *dont) 202 struct kvm_memory_slot *dont)
203{ 203{
204} 204}
205 205
206int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) 206int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
207 unsigned long npages)
207{ 208{
208 return 0; 209 return 0;
209} 210}
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index c13f15db476c..20f461637090 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -134,9 +134,11 @@ extern struct page *kvm_alloc_hpt(unsigned long nr_pages);
134extern void kvm_release_hpt(struct page *page, unsigned long nr_pages); 134extern void kvm_release_hpt(struct page *page, unsigned long nr_pages);
135extern int kvmppc_core_init_vm(struct kvm *kvm); 135extern int kvmppc_core_init_vm(struct kvm *kvm);
136extern void kvmppc_core_destroy_vm(struct kvm *kvm); 136extern void kvmppc_core_destroy_vm(struct kvm *kvm);
137extern void kvmppc_core_free_memslot(struct kvm_memory_slot *free, 137extern void kvmppc_core_free_memslot(struct kvm *kvm,
138 struct kvm_memory_slot *free,
138 struct kvm_memory_slot *dont); 139 struct kvm_memory_slot *dont);
139extern int kvmppc_core_create_memslot(struct kvm_memory_slot *slot, 140extern int kvmppc_core_create_memslot(struct kvm *kvm,
141 struct kvm_memory_slot *slot,
140 unsigned long npages); 142 unsigned long npages);
141extern int kvmppc_core_prepare_memory_region(struct kvm *kvm, 143extern int kvmppc_core_prepare_memory_region(struct kvm *kvm,
142 struct kvm_memory_slot *memslot, 144 struct kvm_memory_slot *memslot,
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 39d2994f9d27..130fe1d75bac 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -761,13 +761,13 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log)
761 return kvmppc_ops->get_dirty_log(kvm, log); 761 return kvmppc_ops->get_dirty_log(kvm, log);
762} 762}
763 763
764void kvmppc_core_free_memslot(struct kvm_memory_slot *free, 764void kvmppc_core_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
765 struct kvm_memory_slot *dont) 765 struct kvm_memory_slot *dont)
766{ 766{
767 kvmppc_ops->free_memslot(free, dont); 767 kvmppc_ops->free_memslot(free, dont);
768} 768}
769 769
770int kvmppc_core_create_memslot(struct kvm_memory_slot *slot, 770int kvmppc_core_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
771 unsigned long npages) 771 unsigned long npages)
772{ 772{
773 return kvmppc_ops->create_memslot(slot, npages); 773 return kvmppc_ops->create_memslot(slot, npages);
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 1769354d0bf8..cb2d986a3382 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -1662,12 +1662,12 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log)
1662 return -ENOTSUPP; 1662 return -ENOTSUPP;
1663} 1663}
1664 1664
1665void kvmppc_core_free_memslot(struct kvm_memory_slot *free, 1665void kvmppc_core_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
1666 struct kvm_memory_slot *dont) 1666 struct kvm_memory_slot *dont)
1667{ 1667{
1668} 1668}
1669 1669
1670int kvmppc_core_create_memslot(struct kvm_memory_slot *slot, 1670int kvmppc_core_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
1671 unsigned long npages) 1671 unsigned long npages)
1672{ 1672{
1673 return 0; 1673 return 0;
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 9aaa07efa4b6..b103d747934a 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -417,15 +417,16 @@ long kvm_arch_dev_ioctl(struct file *filp,
417 return -EINVAL; 417 return -EINVAL;
418} 418}
419 419
420void kvm_arch_free_memslot(struct kvm_memory_slot *free, 420void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
421 struct kvm_memory_slot *dont) 421 struct kvm_memory_slot *dont)
422{ 422{
423 kvmppc_core_free_memslot(free, dont); 423 kvmppc_core_free_memslot(kvm, free, dont);
424} 424}
425 425
426int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) 426int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
427 unsigned long npages)
427{ 428{
428 return kvmppc_core_create_memslot(slot, npages); 429 return kvmppc_core_create_memslot(kvm, slot, npages);
429} 430}
430 431
431void kvm_arch_memslots_updated(struct kvm *kvm) 432void kvm_arch_memslots_updated(struct kvm *kvm)
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 1e4e7b97337a..bedda67cc222 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -1089,12 +1089,13 @@ int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
1089 return VM_FAULT_SIGBUS; 1089 return VM_FAULT_SIGBUS;
1090} 1090}
1091 1091
1092void kvm_arch_free_memslot(struct kvm_memory_slot *free, 1092void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
1093 struct kvm_memory_slot *dont) 1093 struct kvm_memory_slot *dont)
1094{ 1094{
1095} 1095}
1096 1096
1097int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) 1097int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
1098 unsigned long npages)
1098{ 1099{
1099 return 0; 1100 return 0;
1100} 1101}
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index edf2a07df3a3..666526a55c46 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7080,7 +7080,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
7080 kfree(rcu_dereference_check(kvm->arch.apic_map, 1)); 7080 kfree(rcu_dereference_check(kvm->arch.apic_map, 1));
7081} 7081}
7082 7082
7083void kvm_arch_free_memslot(struct kvm_memory_slot *free, 7083void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
7084 struct kvm_memory_slot *dont) 7084 struct kvm_memory_slot *dont)
7085{ 7085{
7086 int i; 7086 int i;
@@ -7101,7 +7101,8 @@ void kvm_arch_free_memslot(struct kvm_memory_slot *free,
7101 } 7101 }
7102} 7102}
7103 7103
7104int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages) 7104int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
7105 unsigned long npages)
7105{ 7106{
7106 int i; 7107 int i;
7107 7108
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index c9d4236ab442..8b0107dc2067 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -507,9 +507,10 @@ int kvm_set_memory_region(struct kvm *kvm,
507 struct kvm_userspace_memory_region *mem); 507 struct kvm_userspace_memory_region *mem);
508int __kvm_set_memory_region(struct kvm *kvm, 508int __kvm_set_memory_region(struct kvm *kvm,
509 struct kvm_userspace_memory_region *mem); 509 struct kvm_userspace_memory_region *mem);
510void kvm_arch_free_memslot(struct kvm_memory_slot *free, 510void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *free,
511 struct kvm_memory_slot *dont); 511 struct kvm_memory_slot *dont);
512int kvm_arch_create_memslot(struct kvm_memory_slot *slot, unsigned long npages); 512int kvm_arch_create_memslot(struct kvm *kvm, struct kvm_memory_slot *slot,
513 unsigned long npages);
513void kvm_arch_memslots_updated(struct kvm *kvm); 514void kvm_arch_memslots_updated(struct kvm *kvm);
514int kvm_arch_prepare_memory_region(struct kvm *kvm, 515int kvm_arch_prepare_memory_region(struct kvm *kvm,
515 struct kvm_memory_slot *memslot, 516 struct kvm_memory_slot *memslot,
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 94c6e3f6f244..0932c3b64155 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -542,13 +542,13 @@ static void kvm_destroy_dirty_bitmap(struct kvm_memory_slot *memslot)
542/* 542/*
543 * Free any memory in @free but not in @dont. 543 * Free any memory in @free but not in @dont.
544 */ 544 */
545static void kvm_free_physmem_slot(struct kvm_memory_slot *free, 545static void kvm_free_physmem_slot(struct kvm *kvm, struct kvm_memory_slot *free,
546 struct kvm_memory_slot *dont) 546 struct kvm_memory_slot *dont)
547{ 547{
548 if (!dont || free->dirty_bitmap != dont->dirty_bitmap) 548 if (!dont || free->dirty_bitmap != dont->dirty_bitmap)
549 kvm_destroy_dirty_bitmap(free); 549 kvm_destroy_dirty_bitmap(free);
550 550
551 kvm_arch_free_memslot(free, dont); 551 kvm_arch_free_memslot(kvm, free, dont);
552 552
553 free->npages = 0; 553 free->npages = 0;
554} 554}
@@ -559,7 +559,7 @@ void kvm_free_physmem(struct kvm *kvm)
559 struct kvm_memory_slot *memslot; 559 struct kvm_memory_slot *memslot;
560 560
561 kvm_for_each_memslot(memslot, slots) 561 kvm_for_each_memslot(memslot, slots)
562 kvm_free_physmem_slot(memslot, NULL); 562 kvm_free_physmem_slot(kvm, memslot, NULL);
563 563
564 kfree(kvm->memslots); 564 kfree(kvm->memslots);
565} 565}
@@ -823,7 +823,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
823 if (change == KVM_MR_CREATE) { 823 if (change == KVM_MR_CREATE) {
824 new.userspace_addr = mem->userspace_addr; 824 new.userspace_addr = mem->userspace_addr;
825 825
826 if (kvm_arch_create_memslot(&new, npages)) 826 if (kvm_arch_create_memslot(kvm, &new, npages))
827 goto out_free; 827 goto out_free;
828 } 828 }
829 829
@@ -899,7 +899,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
899 899
900 kvm_arch_commit_memory_region(kvm, mem, &old, change); 900 kvm_arch_commit_memory_region(kvm, mem, &old, change);
901 901
902 kvm_free_physmem_slot(&old, &new); 902 kvm_free_physmem_slot(kvm, &old, &new);
903 kfree(old_memslots); 903 kfree(old_memslots);
904 904
905 return 0; 905 return 0;
@@ -907,7 +907,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
907out_slots: 907out_slots:
908 kfree(slots); 908 kfree(slots);
909out_free: 909out_free:
910 kvm_free_physmem_slot(&new, &old); 910 kvm_free_physmem_slot(kvm, &new, &old);
911out: 911out:
912 return r; 912 return r;
913} 913}