KVM: PPC: Add skip_page_out parameter to uvmem functions
authorSukadev Bhattiprolu <sukadev@linux.ibm.com>
Thu, 19 Dec 2019 21:51:45 +0000 (13:51 -0800)
committerPaul Mackerras <paulus@ozlabs.org>
Fri, 17 Jan 2020 04:08:31 +0000 (15:08 +1100)
Add 'skip_page_out' parameter to kvmppc_uvmem_drop_pages() so the
callers can specify whetheter or not to skip paging out pages. This
will be needed in a follow-on patch that implements H_SVM_INIT_ABORT
hcall.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
arch/powerpc/include/asm/kvm_book3s_uvmem.h
arch/powerpc/kvm/book3s_64_mmu_radix.c
arch/powerpc/kvm/book3s_hv.c
arch/powerpc/kvm/book3s_hv_uvmem.c

index 50204e228f1671ed938d6e5ce51ddad4024787cb..3cf8425b9838c5914ac75a2501b4e391da126b0c 100644 (file)
@@ -20,7 +20,7 @@ unsigned long kvmppc_h_svm_init_start(struct kvm *kvm);
 unsigned long kvmppc_h_svm_init_done(struct kvm *kvm);
 int kvmppc_send_page_to_uv(struct kvm *kvm, unsigned long gfn);
 void kvmppc_uvmem_drop_pages(const struct kvm_memory_slot *free,
-                            struct kvm *kvm);
+                            struct kvm *kvm, bool skip_page_out);
 #else
 static inline int kvmppc_uvmem_init(void)
 {
@@ -69,6 +69,6 @@ static inline int kvmppc_send_page_to_uv(struct kvm *kvm, unsigned long gfn)
 
 static inline void
 kvmppc_uvmem_drop_pages(const struct kvm_memory_slot *free,
-                       struct kvm *kvm) { }
+                       struct kvm *kvm, bool skip_page_out) { }
 #endif /* CONFIG_PPC_UV */
 #endif /* __ASM_KVM_BOOK3S_UVMEM_H__ */
index da857c8ba6e40fc53df5455dc003d1e702751ef2..744dba98e5d1121b790729fa8a07f3edd2686286 100644 (file)
@@ -1102,7 +1102,7 @@ void kvmppc_radix_flush_memslot(struct kvm *kvm,
        unsigned int shift;
 
        if (kvm->arch.secure_guest & KVMPPC_SECURE_INIT_START)
-               kvmppc_uvmem_drop_pages(memslot, kvm);
+               kvmppc_uvmem_drop_pages(memslot, kvm, true);
 
        if (kvm->arch.secure_guest & KVMPPC_SECURE_INIT_DONE)
                return;
index 2cf3dd8b79d2537855667e9735f409a3a0c94cb7..47ffc7f1b1042405e9b1dfb898a7197bf27d8d58 100644 (file)
@@ -5477,7 +5477,7 @@ static int kvmhv_svm_off(struct kvm *kvm)
                        continue;
 
                kvm_for_each_memslot(memslot, slots) {
-                       kvmppc_uvmem_drop_pages(memslot, kvm);
+                       kvmppc_uvmem_drop_pages(memslot, kvm, true);
                        uv_unregister_mem_slot(kvm->arch.lpid, memslot->id);
                }
        }
index 2de264fc31563867a76c89d96cdefc96344c12a1..ffa602a97dba6d4685a23bc3e2084703c85b4494 100644 (file)
@@ -258,7 +258,7 @@ unsigned long kvmppc_h_svm_init_done(struct kvm *kvm)
  * QEMU page table with normal PTEs from newly allocated pages.
  */
 void kvmppc_uvmem_drop_pages(const struct kvm_memory_slot *free,
-                            struct kvm *kvm)
+                            struct kvm *kvm, bool skip_page_out)
 {
        int i;
        struct kvmppc_uvmem_page_pvt *pvt;
@@ -276,7 +276,7 @@ void kvmppc_uvmem_drop_pages(const struct kvm_memory_slot *free,
 
                uvmem_page = pfn_to_page(uvmem_pfn);
                pvt = uvmem_page->zone_device_data;
-               pvt->skip_page_out = true;
+               pvt->skip_page_out = skip_page_out;
                mutex_unlock(&kvm->arch.uvmem_lock);
 
                pfn = gfn_to_pfn(kvm, gfn);