powerpc/kvm/book3s: Use find_kvm_host_pte in kvmppc_get_hpa
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200505071729.54912-19-aneesh.kumar@linux.ibm.com
This commit is contained in:
Родитель
bda3deaa6f
Коммит
9fd4236faa
|
@ -878,8 +878,8 @@ long kvmppc_h_clear_mod(struct kvm_vcpu *vcpu, unsigned long flags,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int kvmppc_get_hpa(struct kvm_vcpu *vcpu, unsigned long gpa,
|
||||
int writing, unsigned long *hpa,
|
||||
static int kvmppc_get_hpa(struct kvm_vcpu *vcpu, unsigned long mmu_seq,
|
||||
unsigned long gpa, int writing, unsigned long *hpa,
|
||||
struct kvm_memory_slot **memslot_p)
|
||||
{
|
||||
struct kvm *kvm = vcpu->kvm;
|
||||
|
@ -898,7 +898,7 @@ static int kvmppc_get_hpa(struct kvm_vcpu *vcpu, unsigned long gpa,
|
|||
hva = __gfn_to_hva_memslot(memslot, gfn);
|
||||
|
||||
/* Try to find the host pte for that virtual address */
|
||||
ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift);
|
||||
ptep = find_kvm_host_pte(kvm, mmu_seq, hva, &shift);
|
||||
if (!ptep)
|
||||
return H_TOO_HARD;
|
||||
pte = kvmppc_read_update_linux_pte(ptep, writing);
|
||||
|
@ -933,16 +933,11 @@ static long kvmppc_do_h_page_init_zero(struct kvm_vcpu *vcpu,
|
|||
mmu_seq = kvm->mmu_notifier_seq;
|
||||
smp_rmb();
|
||||
|
||||
ret = kvmppc_get_hpa(vcpu, dest, 1, &pa, &memslot);
|
||||
if (ret != H_SUCCESS)
|
||||
return ret;
|
||||
|
||||
/* Check if we've been invalidated */
|
||||
arch_spin_lock(&kvm->mmu_lock.rlock.raw_lock);
|
||||
if (mmu_notifier_retry(kvm, mmu_seq)) {
|
||||
ret = H_TOO_HARD;
|
||||
|
||||
ret = kvmppc_get_hpa(vcpu, mmu_seq, dest, 1, &pa, &memslot);
|
||||
if (ret != H_SUCCESS)
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
/* Zero the page */
|
||||
for (i = 0; i < SZ_4K; i += L1_CACHE_BYTES, pa += L1_CACHE_BYTES)
|
||||
|
@ -966,19 +961,14 @@ static long kvmppc_do_h_page_init_copy(struct kvm_vcpu *vcpu,
|
|||
mmu_seq = kvm->mmu_notifier_seq;
|
||||
smp_rmb();
|
||||
|
||||
ret = kvmppc_get_hpa(vcpu, dest, 1, &dest_pa, &dest_memslot);
|
||||
if (ret != H_SUCCESS)
|
||||
return ret;
|
||||
ret = kvmppc_get_hpa(vcpu, src, 0, &src_pa, NULL);
|
||||
if (ret != H_SUCCESS)
|
||||
return ret;
|
||||
|
||||
/* Check if we've been invalidated */
|
||||
arch_spin_lock(&kvm->mmu_lock.rlock.raw_lock);
|
||||
if (mmu_notifier_retry(kvm, mmu_seq)) {
|
||||
ret = H_TOO_HARD;
|
||||
ret = kvmppc_get_hpa(vcpu, mmu_seq, dest, 1, &dest_pa, &dest_memslot);
|
||||
if (ret != H_SUCCESS)
|
||||
goto out_unlock;
|
||||
|
||||
ret = kvmppc_get_hpa(vcpu, mmu_seq, src, 0, &src_pa, NULL);
|
||||
if (ret != H_SUCCESS)
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
/* Copy the page */
|
||||
memcpy((void *)dest_pa, (void *)src_pa, SZ_4K);
|
||||
|
|
Загрузка…
Ссылка в новой задаче