OSDN Git Service

powerpc/iommu: Allocate it_map by vmalloc
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Tue, 16 Feb 2021 03:33:06 +0000 (14:33 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 22 Apr 2021 15:38:04 +0000 (01:38 +1000)
commit7f1fa82d79947dfabb4046e1d787da9db2bc1c20
treec5b4c0c664a80359ec39102d2efdab3b6ca581bc
parent0db11461677aa5105b9ebbd939aee0ceb77a988b
powerpc/iommu: Allocate it_map by vmalloc

The IOMMU table uses the it_map bitmap to keep track of allocated DMA
pages. This has always been a contiguous array allocated at either
the boot time or when a passed through device is returned to the host OS.
The it_map memory is allocated by alloc_pages() which allocates
contiguous physical memory.

Such allocation method occasionally creates a problem when there is
no big chunk of memory available (no free memory or too fragmented).
On powernv/ioda2 the default DMA window requires 16MB for it_map.

This replaces alloc_pages_node() with vzalloc_node() which allocates
contiguous block but in virtual memory. This should reduce changes of
failure but should not cause other behavioral changes as it_map is only
used by the kernel's DMA hooks/api when MMU is on.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210216033307.69863-2-aik@ozlabs.ru
arch/powerpc/kernel/iommu.c