[PATCH kernel 2/4] KVM: PPC: Inform the userspace about TCE update failures
David Gibson
david at gibson.dropbear.id.au
Thu Aug 30 14:01:27 AEST 2018
On Thu, Aug 30, 2018 at 01:16:45PM +1000, Alexey Kardashevskiy wrote:
> We return H_TOO_HARD from TCE update handlers when we think that
> the next handler (realmode -> virtual mode -> user mode) has a chance to
> handle the request; H_HARDWARE/H_CLOSED otherwise.
>
> This changes the handlers to return H_TOO_HARD on every error giving
> the userspace an opportunity to handle any request or at least log
> them all.
>
> Signed-off-by: Alexey Kardashevskiy <aik at ozlabs.ru>
Reviewed-by: David Gibson <david at gibson.dropbear.id.au>
> ---
> arch/powerpc/kvm/book3s_64_vio.c | 8 ++++----
> arch/powerpc/kvm/book3s_64_vio_hv.c | 6 +++---
> 2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
> index 0fef22b..3e8ac98 100644
> --- a/arch/powerpc/kvm/book3s_64_vio.c
> +++ b/arch/powerpc/kvm/book3s_64_vio.c
> @@ -401,7 +401,7 @@ static long kvmppc_tce_iommu_do_unmap(struct kvm *kvm,
> long ret;
>
> if (WARN_ON_ONCE(iommu_tce_xchg(tbl, entry, &hpa, &dir)))
> - return H_HARDWARE;
> + return H_TOO_HARD;
>
> if (dir == DMA_NONE)
> return H_SUCCESS;
> @@ -449,15 +449,15 @@ long kvmppc_tce_iommu_do_map(struct kvm *kvm, struct iommu_table *tbl,
> return H_TOO_HARD;
>
> if (WARN_ON_ONCE(mm_iommu_ua_to_hpa(mem, ua, tbl->it_page_shift, &hpa)))
> - return H_HARDWARE;
> + return H_TOO_HARD;
>
> if (mm_iommu_mapped_inc(mem))
> - return H_CLOSED;
> + return H_TOO_HARD;
>
> ret = iommu_tce_xchg(tbl, entry, &hpa, &dir);
> if (WARN_ON_ONCE(ret)) {
> mm_iommu_mapped_dec(mem);
> - return H_HARDWARE;
> + return H_TOO_HARD;
> }
>
> if (dir != DMA_NONE)
> diff --git a/arch/powerpc/kvm/book3s_64_vio_hv.c b/arch/powerpc/kvm/book3s_64_vio_hv.c
> index 7ab6f3f..9584d9b 100644
> --- a/arch/powerpc/kvm/book3s_64_vio_hv.c
> +++ b/arch/powerpc/kvm/book3s_64_vio_hv.c
> @@ -277,10 +277,10 @@ static long kvmppc_rm_tce_iommu_do_map(struct kvm *kvm, struct iommu_table *tbl,
>
> if (WARN_ON_ONCE_RM(mm_iommu_ua_to_hpa_rm(mem, ua, tbl->it_page_shift,
> &hpa)))
> - return H_HARDWARE;
> + return H_TOO_HARD;
>
> if (WARN_ON_ONCE_RM(mm_iommu_mapped_inc(mem)))
> - return H_CLOSED;
> + return H_TOO_HARD;
>
> ret = iommu_tce_xchg_rm(tbl, entry, &hpa, &dir);
> if (ret) {
> @@ -478,7 +478,7 @@ long kvmppc_rm_h_put_tce_indirect(struct kvm_vcpu *vcpu,
>
> rmap = (void *) vmalloc_to_phys(rmap);
> if (WARN_ON_ONCE_RM(!rmap))
> - return H_HARDWARE;
> + return H_TOO_HARD;
>
> /*
> * Synchronize with the MMU notifier callbacks in
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20180830/d0ae9c12/attachment-0001.sig>
More information about the Linuxppc-dev
mailing list