iommu: Allow passing custom allocators to pgtable drivers
authorBoris Brezillon <boris.brezillon@collabora.com>
Fri, 24 Nov 2023 14:24:33 +0000 (15:24 +0100)
committerJoerg Roedel <jroedel@suse.de>
Mon, 27 Nov 2023 10:10:12 +0000 (11:10 +0100)
commit17b226dcf80ce79d02f4f0b08813d8848885b986
tree36192fd28a0750fb88c86bb03afb7376cefe2fc9
parente7080665c977ea1aafb8547a9c7bd08b199311d6
iommu: Allow passing custom allocators to pgtable drivers

This will be useful for GPU drivers who want to keep page tables in a
pool so they can:

- keep freed page tables in a free pool and speed-up upcoming page
  table allocations
- batch page table allocation instead of allocating one page at a time
- pre-reserve pages for page tables needed for map/unmap operations,
  to ensure map/unmap operations don't try to allocate memory in paths
  they're allowed to block or fail

It might also be valuable for other aspects of GPU and similar
use-cases, like fine-grained memory accounting and resource limiting.

We will extend the Arm LPAE format to support custom allocators in a
separate commit.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Link: https://lore.kernel.org/r/20231124142434.1577550-2-boris.brezillon@collabora.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/io-pgtable.c
include/linux/io-pgtable.h