Skip to content

dma: swiotlb: Centralize default pool policy and sizing

Aneesh Kumar K.V (Arm) linux-arm-kernel linux-iommu linux-mips linux-riscv linux-s390 linuxppc-dev lkml loongarch 5 versions – Applied

Status from this message: Applied to dma-mapping-for-next.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest8 patches 21 repliesApplied
  2. v56 patches 15 repliesSuperseded
  3. v45 patches 8 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v34 patches3 repliesSuperseded
v2 RFC2 patches5 repliesSuperseded

Changes in v6 from the cover letter

https://lore.kernel.org/all/[email protected]
* Collect Reviewed-by tags.
* Drop the x86 crash changes
* Add two new patches:
"dma: swiotlb: Consolidate slab rounding" "dma: swiotlb: Rename swiotlb_size_or_default()"
* Drop the swiotlb_default_size_changed() helper.
* Simplify swiotlb_adjust_pool_size().

Patches in v6 Applied

#Subject and filesSizeRepliesApplied
1/8dma: swiotlb: Rename swiotlb_size_or_default()arch/arm/xen/mm.c arch/arm64/mm/init.c arch/riscv/mm/init.c +3 more+7 -70 replies
2/8dma: swiotlb: Consolidate slab roundingkernel/dma/swiotlb.c+20 -240 replies
3/8dma: swiotlb: Track whether the pool size was explicitly setkernel/dma/swiotlb.c+3 -10 replies
4/8dma: swiotlb: Centralize default pool policy selectionarch/arm/mm/init.c arch/arm64/mm/init.c arch/loongarch/kernel/setup.c +12 more+128 -470 replies
5/8dma: swiotlb: Centralize minimal pool sizingarch/arm64/mm/init.c arch/riscv/mm/init.c kernel/dma/swiotlb.c+8 -160 replies
6/8dma: swiotlb: Centralize memory-encryption pool sizingarch/x86/mm/mem_encrypt.c kernel/dma/swiotlb.c+25 -2618 replies
7/8dma: swiotlb: Add an overridable architecture pool opt-outarch/x86/kernel/pci-dma.c include/linux/swiotlb.h kernel/dma/swiotlb.c+18 -50 replies
8/8dma: swiotlb: Remove SWIOTLB_ANYDocumentation/core-api/swiotlb.rst arch/powerpc/mm/mem.c arch/riscv/mm/init.c +4 more+19 -390 replies

Reviews trailers per patch

6 of 8 patches have a Reviewed-by or Acked-by.

PatchCatalin MarinasRobin Murphy
1/8
2/8
3/8R-b R-b
4/8R-b R-b
5/8R-b
6/8R-b
7/8R-b
8/8R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v6 thread

Cover letter [PATCH v6 0/8] dma: swiotlb: Centralize default pool policy and sizing

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 v5:
https://lore.kernel.org/all/[email protected]
* Collect Reviewed-by tags.
* Drop the x86 crash changes
* Add two new patches:
"dma: swiotlb: Consolidate slab rounding" "dma: swiotlb: Rename swiotlb_size_or_default()"
* Drop the swiotlb_default_size_changed() helper.
* Simplify swiotlb_adjust_pool_size().

Changes from v4:
https://lore.kernel.org/all/[email protected]
* Collect Reviewed-by tags.
* Add a new patch, "dma: swiotlb: Track whether the pool size was explicitly set".
* Retain SWIOTLB_ANY usage for RISC-V until patch 6.
* Rename SWIOTLB_INIT_FORCE_DISABLE to SWIOTLB_INIT_DEFAULT_OFF.

Changes from v3:
https://lore.kernel.org/all/[email protected]
* Add a new patch, "dma: swiotlb: Add an overridable architecture pool opt-out".
* Clarify the change in default behavior with the removal of SWIOTLB_ANY.

Changes from v2:
https://lore.kernel.org/all/[email protected]
* 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/[email protected]

Cc Robin Murphy <[email protected]>
Cc Marek Szyprowski <[email protected]>
Cc Jonathan Corbet <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Randy Dunlap <[email protected]>
Cc Will Deacon <[email protected]>
Cc Mark Rutland <[email protected]>
Cc Marc Zyngier <[email protected]>
Cc Steven Price <[email protected]>
Cc Suzuki K Poulose <[email protected]>
Cc Catalin Marinas <[email protected]>
Cc Jiri Pirko <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Mostafa Saleh <[email protected]>
Cc Petr Tesarik <[email protected]>
Cc Alexey Kardashevskiy <[email protected]>
Cc Dan Williams <[email protected]>
Cc Xu Yilun <[email protected]>
Cc Madhavan Srinivasan <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Nicholas Piggin <[email protected]>
Cc "Christophe Leroy (CS GROUP)" <[email protected]>
Cc "Ritesh Harjani (IBM)" <[email protected]>
Cc Shrikanth Hegde <[email protected]>
Cc Alexander Gordeev <[email protected]>
Cc Gerald Schaefer <[email protected]>
Cc Heiko Carstens <[email protected]>
Cc Vasily Gorbik <[email protected]>
Cc Christian Borntraeger <[email protected]>
Cc Sven Schnelle <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Russell King <[email protected]>
Cc Huacai Chen <[email protected]>
Cc WANG Xuerui <[email protected]>
Cc Thomas Bogendoerfer <[email protected]>
Cc Jiaxun Yang <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Albert Ou <[email protected]>
Cc Alexandre Ghiti <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Dave Hansen <[email protected]>
Cc "H. Peter Anvin" <[email protected]>

Aneesh Kumar K.V (Arm) (8):
dma: swiotlb: Rename swiotlb_size_or_default()
dma: swiotlb: Consolidate slab rounding
dma: swiotlb: Track whether the pool size was explicitly set
dma: swiotlb: Centralize default pool policy selection
dma: swiotlb: Centralize minimal pool sizing
dma: swiotlb: Centralize memory-encryption pool sizing
dma: swiotlb: Add an overridable architecture pool opt-out
dma: swiotlb: Remove SWIOTLB_ANY

 Documentation/core-api/swiotlb.rst   |   8 +-
 arch/arm/mm/init.c                   |   6 +-
 arch/arm/xen/mm.c                    |   2 +-
 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/kernel/pci-dma.c            |  23 +++-
 arch/x86/mm/mem_encrypt.c            |  24 ----
 include/linux/swiotlb.h              |  17 ++-
 kernel/dma/swiotlb.c                 | 193 +++++++++++++++++++--------
 19 files changed, 210 insertions(+), 147 deletions(-)

base-commit: 704340f1cd0dcef829eb62f5b48ae95a2ce17bdf

Signature · 1 line
2.43.0