lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <fc18a185-277e-472a-959b-4c5354295691@app.fastmail.com>
Date: Mon, 16 Jun 2025 20:33:42 +0200
From: "Arnd Bergmann" <arnd@...db.de>
To: "James Clark" <james.clark@...aro.org>, "Christoph Hellwig" <hch@....de>
Cc: "Mark Brown" <broonie@...nel.org>, "Vladimir Oltean" <olteanv@...il.com>,
 oe-kbuild-all@...ts.linux.dev, "Larisa Grigore" <larisa.grigore@....com>,
 "Frank Li" <Frank.li@....com>, linux-spi@...r.kernel.org,
 imx@...ts.linux.dev, linux-kernel@...r.kernel.org,
 "kernel test robot" <lkp@...el.com>,
 "Marek Szyprowski" <m.szyprowski@...sung.com>,
 "Robin Murphy" <robin.murphy@....com>, iommu@...ts.linux.dev
Subject: Re: [PATCH] dma-mapping: Stub out dma_{alloc,free,map}_pages() API

On Mon, Jun 16, 2025, at 15:48, Arnd Bergmann wrote:
> On Mon, Jun 16, 2025, at 15:23, James Clark wrote:
>> On 16/06/2025 2:19 pm, Christoph Hellwig wrote:
>
> Maybe we can actually remove CONFIG_NO_DMA/CONFIG_HAS_DMA
> entirely and remove all the checks for CONFIG_HAS_DMA? 
> My guess is that this would only lead to a small code size
> increase on the affected targets, but since they are not
> actually trying to do DMA, and they all have a very limited
> set of drivers they actually use, it won't break existing
> code.

I tried removing the stubs on sh/j2 allmodconfig and found this:

ERROR: modpost: "dma_unmap_page_attrs" [drivers/bus/mhi/host/mhi.ko] undefined!
ERROR: modpost: "dma_map_page_attrs" [drivers/bus/mhi/host/mhi.ko] undefined!
ERROR: modpost: "dma_alloc_attrs" [drivers/bus/mhi/host/mhi.ko] undefined!
ERROR: modpost: "dma_free_attrs" [drivers/bus/mhi/host/mhi.ko] undefined!
ERROR: modpost: "dma_unmap_page_attrs" [drivers/soc/mediatek/mtk-cmdq-helper.ko] undefined!
ERROR: modpost: "dma_map_page_attrs" [drivers/soc/mediatek/mtk-cmdq-helper.ko] undefined!
ERROR: modpost: "dma_unmap_page_attrs" [drivers/soc/qcom/qcom-geni-se.ko] undefined!
ERROR: modpost: "dma_map_page_attrs" [drivers/soc/qcom/qcom-geni-se.ko] undefined!
ERROR: modpost: "dma_set_coherent_mask" [drivers/soc/ti/pruss.ko] undefined!
ERROR: modpost: "dma_unmap_page_attrs" [drivers/virtio/virtio_ring.ko] undefined!
WARNING: modpost: suppressed 733 unresolved symbol warnings because there were too many)

Enabling HAS_DMA unconditionally all all the platforms builds:

--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -64,7 +64,6 @@ config SUPERH
        select LOCK_MM_AND_FIND_VMA
        select MODULES_USE_ELF_RELA
        select NEED_SG_DMA_LENGTH
-       select NO_DMA if !MMU && !DMA_COHERENT
        select NO_GENERIC_PCI_IOPORT_MAP if PCI
        select OLD_SIGACTION
        select OLD_SIGSUSPEND
@@ -134,7 +133,7 @@ config SWAP_IO_SPACE
        bool
 
 config DMA_COHERENT
-       bool
+       def_bool !MMU
 
 config DMA_NONCOHERENT
        def_bool !NO_DMA && !DMA_COHERENT
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -22,7 +22,6 @@ config UML
        select HAVE_DEBUG_KMEMLEAK
        select HAVE_DEBUG_BUGVERBOSE
        select HAVE_PAGE_SIZE_4KB
-       select NO_DMA if !UML_DMA_EMULATION
        select OF_EARLY_FLATTREE if OF
        select GENERIC_IRQ_SHOW
        select GENERIC_CPU_DEVICES
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -37,7 +37,6 @@ config M68K
        select MMU_GATHER_NO_RANGE if MMU
        select MODULES_USE_ELF_REL
        select MODULES_USE_ELF_RELA
-       select NO_DMA if !MMU && !COLDFIRE
        select OLD_SIGACTION
        select OLD_SIGSUSPEND3
        select UACCESS_MEMCPY if !MMU
diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
index c9a7e602d8a4..a1123e2fecdf 100644
--- a/arch/m68k/Kconfig.cpu
+++ b/arch/m68k/Kconfig.cpu
@@ -38,7 +38,6 @@ config SUN3
        depends on MMU
        select HAVE_ARCH_PFN_VALID
        select LEGACY_TIMER_TICK
-       select NO_DMA
        select M68020
        help
          This option enables support for the Sun 3 series of workstations
@@ -558,4 +557,4 @@ config COLDFIRE_COHERENT_DMA
 config M68K_NONCOHERENT_DMA
        bool
        default y
-       depends on HAS_DMA && !COLDFIRE_COHERENT_DMA
+       depends on HAS_DMA && !COLDFIRE_COHERENT_DMA && !SUN3
--- a/arch/m68k/kernel/dma.c
+++ b/arch/m68k/kernel/dma.c
@@ -8,7 +8,7 @@
 #include <linux/kernel.h>
 #include <asm/cacheflush.h>
 
-#ifndef CONFIG_COLDFIRE
+#if !defined(CONFIG_COLDFIRE) && !defined(CONFIG_SUN3)
 void arch_dma_prep_coherent(struct page *page, size_t size)
 {
        cache_push(page_to_phys(page), size);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ