KVM: PPC: Book3S HV: Cleanups - constify memslots, fix comments
authorPaul Mackerras <paulus@ozlabs.org>
Wed, 12 Dec 2018 04:16:48 +0000 (15:16 +1100)
committerPaul Mackerras <paulus@ozlabs.org>
Sun, 16 Dec 2018 23:58:43 +0000 (10:58 +1100)
This adds 'const' to the declarations for the struct kvm_memory_slot
pointer parameters of some functions, which will make it possible to
call those functions from kvmppc_core_commit_memory_region_hv()
in the next patch.

This also fixes some comments about locking.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Reviewed-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
arch/powerpc/include/asm/kvm_book3s.h
arch/powerpc/include/asm/kvm_book3s_64.h
arch/powerpc/kvm/book3s_64_mmu_radix.c
arch/powerpc/kvm/book3s_hv_nested.c
arch/powerpc/kvm/book3s_hv_rm_mmu.c

index 09f8e9ba69bc788c65cac1d043dcd3c4bc31f1ca..728d2b7c9981e80200c6caea72f0cf206b506705 100644 (file)
@@ -197,7 +197,8 @@ extern int kvmppc_mmu_radix_translate_table(struct kvm_vcpu *vcpu, gva_t eaddr,
 extern int kvmppc_mmu_radix_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
                        struct kvmppc_pte *gpte, bool data, bool iswrite);
 extern void kvmppc_unmap_pte(struct kvm *kvm, pte_t *pte, unsigned long gpa,
-                       unsigned int shift, struct kvm_memory_slot *memslot,
+                       unsigned int shift,
+                       const struct kvm_memory_slot *memslot,
                        unsigned int lpid);
 extern bool kvmppc_hv_handle_set_rc(struct kvm *kvm, pgd_t *pgtable,
                                    bool writing, unsigned long gpa,
@@ -215,10 +216,6 @@ extern int kvmppc_radix_init(void);
 extern void kvmppc_radix_exit(void);
 extern int kvm_unmap_radix(struct kvm *kvm, struct kvm_memory_slot *memslot,
                        unsigned long gfn);
-extern void kvmppc_unmap_pte(struct kvm *kvm, pte_t *pte,
-                            unsigned long gpa, unsigned int shift,
-                            struct kvm_memory_slot *memslot,
-                            unsigned int lpid);
 extern int kvm_age_radix(struct kvm *kvm, struct kvm_memory_slot *memslot,
                        unsigned long gfn);
 extern int kvm_test_age_radix(struct kvm *kvm, struct kvm_memory_slot *memslot,
@@ -242,7 +239,7 @@ extern kvm_pfn_t kvmppc_gpa_to_pfn(struct kvm_vcpu *vcpu, gpa_t gpa,
                        bool writing, bool *writable);
 extern void kvmppc_add_revmap_chain(struct kvm *kvm, struct revmap_entry *rev,
                        unsigned long *rmap, long pte_index, int realmode);
-extern void kvmppc_update_dirty_map(struct kvm_memory_slot *memslot,
+extern void kvmppc_update_dirty_map(const struct kvm_memory_slot *memslot,
                        unsigned long gfn, unsigned long psize);
 extern void kvmppc_invalidate_hpte(struct kvm *kvm, __be64 *hptep,
                        unsigned long pte_index);
index 6d298145d564e84b42ac050e102b34437d95606a..c9cbaf02fc737d34ca52efd532634da6d68e70ff 100644 (file)
@@ -625,7 +625,7 @@ extern int kvmppc_create_pte(struct kvm *kvm, pgd_t *pgtable, pte_t pte,
 extern void kvmhv_insert_nest_rmap(struct kvm *kvm, unsigned long *rmapp,
                                   struct rmap_nested **n_rmap);
 extern void kvmhv_remove_nest_rmap_range(struct kvm *kvm,
-                               struct kvm_memory_slot *memslot,
+                               const struct kvm_memory_slot *memslot,
                                unsigned long gpa, unsigned long hpa,
                                unsigned long nbytes);
 
index 87ad35e0b13819a475c5eb89a090e7b3f0ef292c..52711eb052f51631679e0849c68a7f617b8543c9 100644 (file)
@@ -284,7 +284,8 @@ static void kvmppc_pmd_free(pmd_t *pmdp)
 
 /* Called with kvm->mmu_lock held */
 void kvmppc_unmap_pte(struct kvm *kvm, pte_t *pte, unsigned long gpa,
-                     unsigned int shift, struct kvm_memory_slot *memslot,
+                     unsigned int shift,
+                     const struct kvm_memory_slot *memslot,
                      unsigned int lpid)
 
 {
@@ -861,7 +862,7 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
        return ret;
 }
 
-/* Called with kvm->lock held */
+/* Called with kvm->mmu_lock held */
 int kvm_unmap_radix(struct kvm *kvm, struct kvm_memory_slot *memslot,
                    unsigned long gfn)
 {
@@ -876,7 +877,7 @@ int kvm_unmap_radix(struct kvm *kvm, struct kvm_memory_slot *memslot,
        return 0;                               
 }
 
-/* Called with kvm->lock held */
+/* Called with kvm->mmu_lock held */
 int kvm_age_radix(struct kvm *kvm, struct kvm_memory_slot *memslot,
                  unsigned long gfn)
 {
@@ -895,7 +896,7 @@ int kvm_age_radix(struct kvm *kvm, struct kvm_memory_slot *memslot,
        return ref;
 }
 
-/* Called with kvm->lock held */
+/* Called with kvm->mmu_lock held */
 int kvm_test_age_radix(struct kvm *kvm, struct kvm_memory_slot *memslot,
                       unsigned long gfn)
 {
index 401d2ecbebc508ebfc04b228216a3b5429d11278..6d1b14bd7e65080f0e6795974398c973a08bc9be 100644 (file)
@@ -723,7 +723,7 @@ static void kvmhv_remove_nest_rmap_list(struct kvm *kvm, unsigned long *rmapp,
 
 /* called with kvm->mmu_lock held */
 void kvmhv_remove_nest_rmap_range(struct kvm *kvm,
-                                 struct kvm_memory_slot *memslot,
+                                 const struct kvm_memory_slot *memslot,
                                  unsigned long gpa, unsigned long hpa,
                                  unsigned long nbytes)
 {
index a67cf1cdeda400cd659ba0858ab9040d10ced4c8..3b3791ed74a6756315080be96f4085f1a9c7cd9b 100644 (file)
@@ -107,7 +107,7 @@ void kvmppc_add_revmap_chain(struct kvm *kvm, struct revmap_entry *rev,
 EXPORT_SYMBOL_GPL(kvmppc_add_revmap_chain);
 
 /* Update the dirty bitmap of a memslot */
-void kvmppc_update_dirty_map(struct kvm_memory_slot *memslot,
+void kvmppc_update_dirty_map(const struct kvm_memory_slot *memslot,
                             unsigned long gfn, unsigned long psize)
 {
        unsigned long npages;