[PATCH v3 0/4] dma: swiotlb: Centralize default pool policy and sizing

From: Aneesh Kumar K.V (Arm)

Date: Fri Sep 04 2026 - 06:35:14 EST


Hi,

This series centralizes swiotlb default-pool selection and sizing, and
simplifies the initialization flags used to describe pool placement.

The first patch replaces the addressing-limit argument with initialization
flags and introduces explicit policies for the different reasons a default
pool may be needed. Architectures now report DMA addressing constraints with
SWIOTLB_INIT_ADDRESSING_LIMIT, while the core selects the corresponding pool
policy.

The second patch moves the reduced sizing used when the pool is needed only
for unaligned kmalloc bouncing from arm64 and RISC-V into the swiotlb core.

The third patch centralizes swiotlb sizing for memory-encrypted systems. It
moves the existing x86 guest-sizing policy into the core. Host memory
encryption retains the normal pool size, and a shared default pool is not
selected solely for guest memory encryption when a restricted DMA pool is
present.

The fourth patch removes SWIOTLB_ANY. Pool placement is derived directly from
SWIOTLB_INIT_ADDRESSING_LIMIT: pools required for limited DMA addressing are
allocated below the architecture's low address limit, while other pools may
be allocated anywhere in directly mapped memory. Xen continues to request a
pool explicitly with SWIOTLB_INIT_REMAP without imposing a low-address
constraint.

Changes from v2:
https://lore.kernel.org/all/20260813102521.1367737-1-aneesh.kumar@xxxxxxxxxx
* Rebase to latest tree.
* Drop SWIOTLB_ANY and derive that based on SWIOTLB_INIT_ADDRESSING_LIMIT
* Add SWIOTLB_INIT_REMAP.

v1:
https://lore.kernel.org/all/20260811134056.756015-1-aneesh.kumar@xxxxxxxxxx

Cc: Robin Murphy <robin.murphy@xxxxxxx>
Cc: Marek Szyprowski <m.szyprowski@xxxxxxxxxxx>
Cc: Will Deacon <will@xxxxxxxxxx>
Cc: Marc Zyngier <maz@xxxxxxxxxx>
Cc: Steven Price <steven.price@xxxxxxx>
Cc: Suzuki K Poulose <Suzuki.Poulose@xxxxxxx>
Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
Cc: Jiri Pirko <jiri@xxxxxxxxxxx>
Cc: Jason Gunthorpe <jgg@xxxxxxxx>
Cc: Mostafa Saleh <smostafa@xxxxxxxxxx>
Cc: Petr Tesarik <ptesarik@xxxxxxxx>
Cc: Alexey Kardashevskiy <aik@xxxxxxx>
Cc: Dan Williams <dan.j.williams@xxxxxxxxx>
Cc: Xu Yilun <yilun.xu@xxxxxxxxxxxxxxx>
Cc: Madhavan Srinivasan <maddy@xxxxxxxxxxxxx>
Cc: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
Cc: Nicholas Piggin <npiggin@xxxxxxxxx>
Cc: "Christophe Leroy (CS GROUP)" <chleroy@xxxxxxxxxx>
Cc: Alexander Gordeev <agordeev@xxxxxxxxxxxxx>
Cc: Gerald Schaefer <gerald.schaefer@xxxxxxxxxxxxx>
Cc: Heiko Carstens <hca@xxxxxxxxxxxxx>
Cc: Vasily Gorbik <gor@xxxxxxxxxxxxx>
Cc: Christian Borntraeger <borntraeger@xxxxxxxxxxxxx>
Cc: Sven Schnelle <svens@xxxxxxxxxxxxx>
Cc: Russell King <linux@xxxxxxxxxxxxxxx>
Cc: Huacai Chen <chenhuacai@xxxxxxxxxx>
Cc: Thomas Bogendoerfer <tsbogend@xxxxxxxxxxxxxxxx>
Cc: Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>
Cc: Paul Walmsley <pjw@xxxxxxxxxx>
Cc: Palmer Dabbelt <palmer@xxxxxxxxxxx>
Cc: Albert Ou <aou@xxxxxxxxxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Borislav Petkov <bp@xxxxxxxxx>
Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: loongarch@xxxxxxxxxxxxxxx
Cc: linux-mips@xxxxxxxxxxxxxxx
Cc: linuxppc-dev@xxxxxxxxxxxxxxxx
Cc: linux-riscv@xxxxxxxxxxxxxxxxxxx
Cc: linux-s390@xxxxxxxxxxxxxxx
Cc: x86@xxxxxxxxxx

Aneesh Kumar K.V (Arm) (4):
dma: swiotlb: Centralize default pool policy selection
dma: swiotlb: Centralize minimal pool sizing
dma: swiotlb: Centralize memory-encryption pool sizing
dma: swiotlb: Remove SWIOTLB_ANY

Documentation/core-api/swiotlb.rst | 8 +-
arch/arm/mm/init.c | 6 +-
arch/arm64/mm/init.c | 14 +-
arch/loongarch/kernel/setup.c | 2 +-
arch/mips/cavium-octeon/dma-octeon.c | 2 +-
arch/mips/loongson64/dma.c | 2 +-
arch/mips/sibyte/common/dma.c | 2 +-
arch/powerpc/kernel/dma-swiotlb.c | 4 +-
arch/powerpc/mm/mem.c | 17 ++-
arch/powerpc/platforms/pseries/svm.c | 10 --
arch/powerpc/sysdev/fsl_pci.c | 1 +
arch/riscv/mm/init.c | 24 +--
arch/s390/mm/init.c | 2 +-
arch/x86/include/asm/crash_reserve.h | 4 +-
arch/x86/include/asm/iommu.h | 2 +
arch/x86/kernel/amd_gart_64.c | 1 +
arch/x86/kernel/pci-dma.c | 19 ++-
arch/x86/mm/mem_encrypt.c | 24 ---
include/linux/swiotlb.h | 19 ++-
kernel/dma/swiotlb.c | 214 ++++++++++++++++++++-------
20 files changed, 236 insertions(+), 141 deletions(-)


base-commit: 89a312991dc6e638a36adc43ccb91dbc25504c04
--
2.43.0