powerpc/pseries/iommu: Check if the default window in use before removing it
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Wed, 20 Oct 2021 13:23:14 +0000 (00:23 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 25 Oct 2021 00:41:14 +0000 (11:41 +1100)
commit92fe01b7c655b9767724e7d62bdded0761d232ff
treef86644ff971b50e5257ec5e8139fd4938c127093
parent41ee7232fa5f3c034f22baa52bc287e494e2129a
powerpc/pseries/iommu: Check if the default window in use before removing it

At the moment this check is performed after we remove the default window
which is late and disallows to revert whatever changes enable_ddw()
has made to DMA windows.

This moves the check and error exit before removing the window.

This raised the message severity from "debug" to "warning" as this
should not happen in practice and cannot be triggered by the userspace.

Fixes: 381ceda88c4c ("powerpc/pseries/iommu: Make use of DDW for indirect mapping")
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211020132315.2287178-4-aik@ozlabs.ru
arch/powerpc/platforms/pseries/iommu.c