From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 314562EEE67; Mon, 21 Sep 2026 06:36:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789972617; cv=none; b=laUAHUdZay6L0iuppkCeJR6l+AxOBhYyONgJpWxqGpUJqPVmq9UqjqVNn9j8BzB+o/RHBDGoz5465wK9tS3Z7LuhGBKz/hQa0JC54ZCEuUPNhvX1BRp/maO2QLcIrdR9RP1xblnfRKD6QFQxd622+8Bi/ph/2WzXIoERg4wwny8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789972617; c=relaxed/simple; bh=CiKM5xgpv99M5lztSzRK6ETqhtT2OtqU5Hh6wvlsaCk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=B2MnIgtD7aAeuL6ve1vE5nluKMB7Mr0Y5JFAd8wEshCgjGtdTDiH41UlYl0W4v9D6mw7nK2RmRkOYrQEVgmmgopbVKhd/FIahO3Jbp870CRvcrk0wAzSUqCz3Mm4YW6/9kGALLJ1tXAsBKSs+K/PktDrHTCdFphxwVSDIz8gvKU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=n5EMJGDj; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="n5EMJGDj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A9871F00893; Mon, 21 Sep 2026 06:36:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1789972615; bh=R+xk4C4kNi+974cCDKa30TAiC73V15NHvprk7wFBCRE=; h=From:To:Cc:Subject:Date; b=n5EMJGDj+zLmxsPkZtyPhFMc5SdW91+kVGQKlZRGoEuRhgqy+jOXiC22FJZPTRnx/ 8ZWNT+7XmAJ6Y8z2LQmLv24qXA8HLxeuIXm/OFyOPPDkdoznCOj0FcrWVciDQWhWPZ r2BBS9zHeDeT40YsZcdE2X/nGO7Y+Pvl1UFRGID6F1kuxWb8hCPztYF6RvfyPIGzkN 44/ltkFkEuJwpg83+HSydVZOf9Xq5rOieR5Vczi3Cxy3yVrWkPRZCX/sDeOksdaSHq noytLDOn+2WCcSM2Fxmcpi0kB7rsuWtI2CLNMRjSWllNrf1MYOx4tv5psHf8hAcATC QRVreDt2BG9Bg== 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 , Will Deacon , 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)" , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sven Schnelle , Russell King , Huacai Chen , Thomas Bogendoerfer , Jiaxun Yang , Paul Walmsley , Palmer Dabbelt , Albert Ou , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , 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 v5 0/6] dma: swiotlb: Centralize default pool policy and sizing Date: Mon, 21 Sep 2026 12:06:22 +0530 Message-ID: <20260921063628.362078-1-aneesh.kumar@kernel.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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: Will Deacon 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: Alexander Gordeev Cc: Gerald Schaefer Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Christian Borntraeger Cc: Sven Schnelle Cc: Russell King Cc: Huacai Chen Cc: Thomas Bogendoerfer Cc: Jiaxun Yang Cc: Paul Walmsley Cc: Palmer Dabbelt Cc: Albert Ou Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen 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) (6): dma: swiotlb: Centralize default pool policy selection dma: swiotlb: Track whether the pool size was explicitly set 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/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 | 6 +- arch/x86/kernel/pci-dma.c | 23 ++- arch/x86/mm/mem_encrypt.c | 24 --- include/linux/swiotlb.h | 21 ++- kernel/dma/swiotlb.c | 220 +++++++++++++++++++++------ 18 files changed, 248 insertions(+), 140 deletions(-) base-commit: 704340f1cd0dcef829eb62f5b48ae95a2ce17bdf -- 2.43.0