Subject: [RFC PATCH 14/21] powerpc/kvm/book3s: Use find_kvm_host_pte in page fault handler

From: "Aneesh Kumar K.V" <[email-masked]>
Date: Thu, 27 Feb 2020 12:26:13 +0530

Signed-off-by: Aneesh Kumar K.V <[email-masked]>
---
 arch/powerpc/kvm/book3s_64_mmu_hv.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
index 6c372f5c61b6..fbabdcf24c86 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
@@ -605,19 +605,18 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
 		/* if the guest wants write access, see if that is OK */
 		if (!writing && hpte_is_writable(r)) {
 			pte_t *ptep, pte;
-			unsigned long flags;
 			/*
 			 * We need to protect against page table destruction
 			 * hugepage split and collapse.
 			 */
-			local_irq_save(flags);
-			ptep = find_current_mm_pte(mm->pgd, hva, NULL, NULL);
+			spin_lock(&kvm->mmu_lock);
+			ptep = find_kvm_host_pte(kvm, mmu_seq, hva, NULL);
 			if (ptep) {
 				pte = kvmppc_read_update_linux_pte(ptep, 1);
 				if (__pte_write(pte))
 					write_ok = 1;
 			}
-			local_irq_restore(flags);
+			spin_unlock(&kvm->mmu_lock);
 		}
 	}
 
-- 
2.24.1