powerpc/iommu: Do not immediately panic when failed IOMMU table allocation
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Tue, 16 Feb 2021 03:33:07 +0000 (14:33 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 22 Apr 2021 15:38:04 +0000 (01:38 +1000)
commit4be518d838809e21354f32087aa9c26efc50b410
tree5e7dc1d62e3a58ab8a49847016310e7cfcaf3f78
parent7f1fa82d79947dfabb4046e1d787da9db2bc1c20
powerpc/iommu: Do not immediately panic when failed IOMMU table allocation

Most platforms allocate IOMMU table structures (specifically it_map)
at the boot time and when this fails - it is a valid reason for panic().

However the powernv platform allocates it_map after a device is returned
to the host OS after being passed through and this happens long after
the host OS booted. It is quite possible to trigger the it_map allocation
panic() and kill the host even though it is not necessary - the host OS
can still use the DMA bypass mode (requires a tiny fraction of it_map's
memory) and even if that fails, the host OS is runnnable as it was without
the device for which allocating it_map causes the panic.

Instead of immediately crashing in a powernv/ioda2 system, this prints
an error and continues. All other platforms still call panic().

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Leonardo Bras <leobras.c@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210216033307.69863-3-aik@ozlabs.ru
arch/powerpc/kernel/iommu.c
arch/powerpc/platforms/cell/iommu.c
arch/powerpc/platforms/pasemi/iommu.c
arch/powerpc/platforms/powernv/pci-ioda.c
arch/powerpc/platforms/pseries/iommu.c
arch/powerpc/sysdev/dart_iommu.c