From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 85E63C98313 for ; Thu, 24 Sep 2026 06:08:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=VtP2h4zW4bEjcnxPBRMFx0ixfP0iRNTgGeISWqXXHWU=; b=1Qbxzy9GYQGLr8 rrsjToEdUH2JfHYrCs3Uz0HkrqpFIUg3zOIhp7IVpvKyjL+E5djWRXA3QLkAjGbWycm8dhGxpWEp9 Pko3tiIV2XcCLgxJJDuWFWT0VKSCoj3Cnom4ATKDw/Mz73F4RLgf0OesAUca0Kn7a0Dp8igVOH3wL Tq/dytvnpxo7re/uAojRxAMDMZaFc4FIEgUDQtz91dJDeUbil59Q3raCzugzocbjFdAUSnZitbcX4 WYeTHGLEyLr/mYt5jBhpYcR6NBA6KufNEHOJLZMGf0VK9AtVhigfi0Lror1u6EcobGbwzb+HKTyN5 STpJK/TzFizwPeTl7gPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x9cd3-0000000A6hy-2I5K; Thu, 24 Sep 2026 06:08:21 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x9cd1-0000000A6ho-2qn3; Thu, 24 Sep 2026 06:08:19 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 5F42240DCB; Thu, 24 Sep 2026 06:08:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABCE41F000FF; Thu, 24 Sep 2026 06:08:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790230098; bh=A+b0QfMrBYdMcYFCICVqdR0OXDOa6w9OD48EIiSzDyI=; h=From:To:Cc:Subject:Date; b=dCLAyysYJq3tw3Zd89/8HfyIdVUUN6YTWImQbQtYWgNgSoX+q7H8933X4zO5vsix/ cWAmzjdMnk+PSNjJeT226kssBmm8ufXA7enM27yO7uWkccRxhHNQnYvO++Zr45t6eP OeALh5UHn/vSCK0Rh4RSy3KJUeVFnG5TsvTPhd9ST8OCQK505QKdc6V0IFjBVNhBMy xNiX0aNyHwI9CKrv7R9GSYhWwqqiaaErgu4K++3z+05rY+zy3QOaz8I96TAPuEeUjI 0Th7aF8pwVdxGD0s8uvsSbzv4vyoM16Mk5PfUSMlOWPka5qZHjNKC5wurOCZj94FfQ SY60QB0CQgMvw== From: "Aneesh Kumar K.V (Arm)" To: iommu@lists.linux.dev, linux-kernel@vger.kernel.org Cc: "Aneesh Kumar K.V (Arm)" , Robin Murphy , Marek Szyprowski , Jonathan Corbet , Shuah Khan , Randy Dunlap , Will Deacon , Mark Rutland , Marc Zyngier , Steven Price , Suzuki K Poulose , Catalin Marinas , Jiri Pirko , Jason Gunthorpe , Mostafa Saleh , Petr Tesarik , Alexey Kardashevskiy , Dan Williams , Xu Yilun , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , "Ritesh Harjani (IBM)" , Shrikanth Hegde , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , Stefano Stabellini , Russell King , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , Jiaxun Yang , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , linux-arm-kernel@lists.infradead.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, x86@kernel.org Subject: [PATCH v6 0/8] dma: swiotlb: Centralize default pool policy and sizing Date: Thu, 24 Sep 2026 11:37:48 +0530 Message-ID: <20260924060756.1325156-1-aneesh.kumar@kernel.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org 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/20260921063628.362078-1-aneesh.kumar@kernel.org * 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/20260914070135.313337-1-aneesh.kumar@kernel.org * 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/20260904101810.1193505-1-aneesh.kumar@kernel.org * 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/20260813102521.1367737-1-aneesh.kumar@kernel.org * 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@kernel.org Cc: Robin Murphy Cc: Marek Szyprowski Cc: Jonathan Corbet Cc: Shuah Khan Cc: Randy Dunlap Cc: Will Deacon Cc: Mark Rutland Cc: Marc Zyngier Cc: Steven Price Cc: Suzuki K Poulose Cc: Catalin Marinas Cc: Jiri Pirko Cc: Jason Gunthorpe Cc: Mostafa Saleh Cc: Petr Tesarik Cc: Alexey Kardashevskiy Cc: Dan Williams Cc: Xu Yilun Cc: Madhavan Srinivasan Cc: Michael Ellerman Cc: Nicholas Piggin Cc: "Christophe Leroy (CS GROUP)" Cc: "Ritesh Harjani (IBM)" Cc: Shrikanth Hegde Cc: Alexander Gordeev Cc: Gerald Schaefer Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Christian Borntraeger Cc: Sven Schnelle Cc: Stefano Stabellini Cc: Russell King Cc: Huacai Chen Cc: WANG Xuerui Cc: Thomas Bogendoerfer Cc: Jiaxun Yang Cc: Paul Walmsley Cc: Palmer Dabbelt Cc: Albert Ou Cc: Alexandre Ghiti Cc: Andy Lutomirski Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: loongarch@lists.linux.dev Cc: linux-mips@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-riscv@lists.infradead.org Cc: linux-s390@vger.kernel.org Cc: x86@kernel.org 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 -- 2.43.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv