linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Arnd Bergmann <arnd@arndb.de>, Miguel Ojeda <ojeda@kernel.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Danilo Krummrich <dakr@kernel.org>,
	Abdiel Janulgue <abdiel.janulgue@gmail.com>,
	Daniel Almeida <daniel.almeida@collabora.com>,
	Andreas Hindborg <a.hindborg@kernel.org>,
	Christoph Hellwig <hch@lst.de>
Cc: iommu@lists.linux.dev, driver-core@lists.linux.dev,
	acourbot@nvidia.com, "Andrew Morton" <akpm@linux-foundation.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Anton Ivanov" <anton.ivanov@cambridgegreys.com>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"David Gow" <david@davidgow.net>, "Gary Guo" <gary@garyguo.net>,
	"Johannes Berg" <johannes@sipsolutions.net>,
	"Justin Stitt" <justinstitt@google.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, linux-um@lists.infradead.org,
	"Russell King" <linux@armlinux.org.uk>,
	llvm@lists.linux.dev, "Benno Lossin" <lossin@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	mmaurer@google.com, "Bill Wendling" <morbo@google.com>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Nick Desaulniers" <nick.desaulniers+lkml@gmail.com>,
	"Nicolas Schier" <nicolas.schier@linux.dev>,
	"Nicolas Schier" <nsc@kernel.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Richard Weinberger" <richard@nod.at>,
	rust-for-linux@vger.kernel.org,
	"Trevor Gross" <tmgross@umich.edu>,
	"Uladzislau Rezki (Sony)" <urezki@gmail.com>,
	"Will Deacon" <will@kernel.org>,
	"Geert Uytterhoeven" <geert@linux-m68k.org>
Subject: Re: [PATCH v2 0/3] Inline helpers into Rust without full LTO
Date: Fri, 27 Mar 2026 09:16:52 +0100	[thread overview]
Message-ID: <9a19ccac-f7ce-4780-a251-f69a1fa45757@samsung.com> (raw)
In-Reply-To: <7ad8bdf9-5eff-4443-ad15-c05355d793d1@app.fastmail.com>

On 26.03.2026 22:12, Arnd Bergmann wrote:
> On Sun, Mar 22, 2026, at 20:46, Miguel Ojeda wrote:
>> On Sun, 22 Mar 2026 20:21:59 +0100 Miguel Ojeda <ojeda@kernel.org> wrote:
>>        BINDGEN rust/bindings/bindings_generated.rs - due to target
>> missing
>>      In file included from rust/helpers/helpers.c:59:
>>      rust/helpers/dma.c:17:2: warning: static function 'dma_free_attrs'
>> is used in an inline function with external linkage [-Wstatic-in-inline]
>>         17 |         dma_free_attrs(dev, size, cpu_addr, dma_handle,
>> attrs);
>>            |         ^
>>      rust/helpers/dma.c:12:1: note: use 'static' to give inline function
>> 'rust_helper_dma_free_attrs' internal linkage
>>         12 | __rust_helper void rust_helper_dma_free_attrs(struct device
>> *dev, size_t size,
>>            | ^
>>            | static
>>
>> For some reason, `dma_free_attrs` is not marked `inline` in
>> `include/linux/dma-mapping.h` to begin with, unlike the rest.
>>
>> Unless I am missing something and there is a reason for that, it looks
>> like it has just been missing since it was added in commit ed6ccf10f24b
>> ("dma-mapping: properly stub out the DMA API for !CONFIG_HAS_DMA").
>>
>> Do you want a patch?
> I have an older patch to drop CONFIG_NO_DMA entirely, which
> may be better here, since we know that nobody cares about the
> empty stubs.

The inline fix is already merged to v7.0-rc, but I'm fine with stubs 
removal and I can queue them to -next. Could You send a proper patch 
separately so I can easily apply it?


> The only targets that 'select NO_DMA' today are m68k (sun3
> and dragonball), sh2 and um, which are some of the targets
> that don't have any DMA masters, but there is little downside
> of enabling the DMA mapping interfaces on those as well.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
> index 11835eb59d94..19fb556357fc 100644
> --- a/arch/m68k/Kconfig
> +++ b/arch/m68k/Kconfig
> @@ -38,7 +38,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..adc50396b87d 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
> diff --git a/arch/m68k/include/asm/pgtable_mm.h b/arch/m68k/include/asm/pgtable_mm.h
> index 7501ff030c63..d095ae6c19f9 100644
> --- a/arch/m68k/include/asm/pgtable_mm.h
> +++ b/arch/m68k/include/asm/pgtable_mm.h
> @@ -159,8 +159,10 @@ static inline void update_mmu_cache_range(struct vm_fault *vmf,
>   	    ? (__pgprot((pgprot_val(prot) & _CACHEMASK040) | _PAGE_NOCACHE_S))	\
>   	    : (prot)))
>   
> +#ifndef CONFIG_SUN3
>   pgprot_t pgprot_dmacoherent(pgprot_t prot);
>   #define pgprot_dmacoherent(prot)	pgprot_dmacoherent(prot)
> +#endif
>   
>   #endif /* CONFIG_COLDFIRE */
>   #endif /* !__ASSEMBLER__ */
> diff --git a/arch/m68k/kernel/dma.c b/arch/m68k/kernel/dma.c
> index 16063783aa80..c52584e024af 100644
> --- 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);
> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
> index d5795067befa..e246f295ec48 100644
> --- a/arch/sh/Kconfig
> +++ b/arch/sh/Kconfig
> @@ -63,7 +63,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
> @@ -133,10 +132,10 @@ config SWAP_IO_SPACE
>   	bool
>   
>   config DMA_COHERENT
> -	bool
> +	def_bool !MMU
>   
>   config DMA_NONCOHERENT
> -	def_bool !NO_DMA && !DMA_COHERENT
> +	def_bool !DMA_COHERENT
>   	select ARCH_HAS_DMA_PREP_COHERENT
>   	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>   	select DMA_DIRECT_REMAP
> diff --git a/arch/um/Kconfig b/arch/um/Kconfig
> index 098cda44db22..dd3428a49614 100644
> --- a/arch/um/Kconfig
> +++ b/arch/um/Kconfig
> @@ -25,7 +25,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
> diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
> index 677c51ab7510..a96a22f857f1 100644
> --- a/include/linux/dma-mapping.h
> +++ b/include/linux/dma-mapping.h
> @@ -138,7 +138,6 @@ static inline void debug_dma_map_single(struct device *dev, const void *addr,
>   }
>   #endif /* CONFIG_DMA_API_DEBUG */
>   
> -#ifdef CONFIG_HAS_DMA
>   static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
>   {
>   	debug_dma_mapping_error(dev, dma_addr);
> @@ -200,146 +199,6 @@ void *dma_vmap_noncontiguous(struct device *dev, size_t size,
>   void dma_vunmap_noncontiguous(struct device *dev, void *vaddr);
>   int dma_mmap_noncontiguous(struct device *dev, struct vm_area_struct *vma,
>   		size_t size, struct sg_table *sgt);
> -#else /* CONFIG_HAS_DMA */
> -static inline dma_addr_t dma_map_page_attrs(struct device *dev,
> -		struct page *page, size_t offset, size_t size,
> -		enum dma_data_direction dir, unsigned long attrs)
> -{
> -	return DMA_MAPPING_ERROR;
> -}
> -static inline void dma_unmap_page_attrs(struct device *dev, dma_addr_t addr,
> -		size_t size, enum dma_data_direction dir, unsigned long attrs)
> -{
> -}
> -static inline dma_addr_t dma_map_phys(struct device *dev, phys_addr_t phys,
> -		size_t size, enum dma_data_direction dir, unsigned long attrs)
> -{
> -	return DMA_MAPPING_ERROR;
> -}
> -static inline void dma_unmap_phys(struct device *dev, dma_addr_t addr,
> -		size_t size, enum dma_data_direction dir, unsigned long attrs)
> -{
> -}
> -static inline unsigned int dma_map_sg_attrs(struct device *dev,
> -		struct scatterlist *sg, int nents, enum dma_data_direction dir,
> -		unsigned long attrs)
> -{
> -	return 0;
> -}
> -static inline void dma_unmap_sg_attrs(struct device *dev,
> -		struct scatterlist *sg, int nents, enum dma_data_direction dir,
> -		unsigned long attrs)
> -{
> -}
> -static inline int dma_map_sgtable(struct device *dev, struct sg_table *sgt,
> -		enum dma_data_direction dir, unsigned long attrs)
> -{
> -	return -EOPNOTSUPP;
> -}
> -static inline dma_addr_t dma_map_resource(struct device *dev,
> -		phys_addr_t phys_addr, size_t size, enum dma_data_direction dir,
> -		unsigned long attrs)
> -{
> -	return DMA_MAPPING_ERROR;
> -}
> -static inline void dma_unmap_resource(struct device *dev, dma_addr_t addr,
> -		size_t size, enum dma_data_direction dir, unsigned long attrs)
> -{
> -}
> -static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
> -{
> -	return -ENOMEM;
> -}
> -static inline void *dma_alloc_attrs(struct device *dev, size_t size,
> -		dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs)
> -{
> -	return NULL;
> -}
> -static inline void dma_free_attrs(struct device *dev, size_t size,
> -		void *cpu_addr, dma_addr_t dma_handle, unsigned long attrs)
> -{
> -}
> -static inline void *dmam_alloc_attrs(struct device *dev, size_t size,
> -		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
> -{
> -	return NULL;
> -}
> -static inline void dmam_free_coherent(struct device *dev, size_t size,
> -		void *vaddr, dma_addr_t dma_handle)
> -{
> -}
> -static inline int dma_get_sgtable_attrs(struct device *dev,
> -		struct sg_table *sgt, void *cpu_addr, dma_addr_t dma_addr,
> -		size_t size, unsigned long attrs)
> -{
> -	return -ENXIO;
> -}
> -static inline int dma_mmap_attrs(struct device *dev, struct vm_area_struct *vma,
> -		void *cpu_addr, dma_addr_t dma_addr, size_t size,
> -		unsigned long attrs)
> -{
> -	return -ENXIO;
> -}
> -static inline bool dma_can_mmap(struct device *dev)
> -{
> -	return false;
> -}
> -static inline bool dma_pci_p2pdma_supported(struct device *dev)
> -{
> -	return false;
> -}
> -static inline int dma_set_mask(struct device *dev, u64 mask)
> -{
> -	return -EIO;
> -}
> -static inline int dma_set_coherent_mask(struct device *dev, u64 mask)
> -{
> -	return -EIO;
> -}
> -static inline u64 dma_get_required_mask(struct device *dev)
> -{
> -	return 0;
> -}
> -static inline bool dma_addressing_limited(struct device *dev)
> -{
> -	return false;
> -}
> -static inline size_t dma_max_mapping_size(struct device *dev)
> -{
> -	return 0;
> -}
> -static inline size_t dma_opt_mapping_size(struct device *dev)
> -{
> -	return 0;
> -}
> -static inline unsigned long dma_get_merge_boundary(struct device *dev)
> -{
> -	return 0;
> -}
> -static inline struct sg_table *dma_alloc_noncontiguous(struct device *dev,
> -		size_t size, enum dma_data_direction dir, gfp_t gfp,
> -		unsigned long attrs)
> -{
> -	return NULL;
> -}
> -static inline void dma_free_noncontiguous(struct device *dev, size_t size,
> -		struct sg_table *sgt, enum dma_data_direction dir)
> -{
> -}
> -static inline void *dma_vmap_noncontiguous(struct device *dev, size_t size,
> -		struct sg_table *sgt)
> -{
> -	return NULL;
> -}
> -static inline void dma_vunmap_noncontiguous(struct device *dev, void *vaddr)
> -{
> -}
> -static inline int dma_mmap_noncontiguous(struct device *dev,
> -		struct vm_area_struct *vma, size_t size, struct sg_table *sgt)
> -{
> -	return -EINVAL;
> -}
> -#endif /* CONFIG_HAS_DMA */
>   
>   #ifdef CONFIG_IOMMU_DMA
>   /**
> diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig
> index 0748091339f7..228a3566d344 100644
> --- a/kernel/dma/Kconfig
> +++ b/kernel/dma/Kconfig
> @@ -1,12 +1,7 @@
>   # SPDX-License-Identifier: GPL-2.0-only
>   
> -config NO_DMA
> -	bool
> -
>   config HAS_DMA
> -	bool
> -	depends on !NO_DMA
> -	default y
> +	def_bool y
>   
>   config DMA_OPS_HELPERS
>   	bool
>
Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland



  parent reply	other threads:[~2026-03-27  8:17 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-03 11:34 Alice Ryhl
2026-02-03 11:34 ` [PATCH v2 1/3] kbuild: rust: add `CONFIG_RUSTC_CLANG_LLVM_COMPATIBLE` Alice Ryhl
2026-02-03 11:49   ` Will Deacon
2026-02-03 12:02     ` Alice Ryhl
2026-03-05 10:12   ` Nicolas Schier
2026-03-05 10:51     ` Alice Ryhl
2026-03-14  0:26   ` Nathan Chancellor
2026-02-03 11:34 ` [PATCH v2 2/3] rust: helpers: #define __rust_helper Alice Ryhl
2026-03-14  0:28   ` Nathan Chancellor
2026-02-03 11:34 ` [PATCH v2 3/3] build: rust: provide an option to inline C helpers into Rust Alice Ryhl
2026-03-06 17:32   ` Alice Ryhl
2026-03-14  0:40     ` Nathan Chancellor
2026-03-14 11:22       ` Alice Ryhl
2026-03-16 21:34         ` Nathan Chancellor
2026-03-17  8:02           ` Miguel Ojeda
2026-03-14  0:34   ` Nathan Chancellor
2026-03-17  8:25 ` [PATCH v2 0/3] Inline helpers into Rust without full LTO Andreas Hindborg
2026-03-22 19:21 ` Miguel Ojeda
2026-03-22 19:38   ` Miguel Ojeda
2026-03-23 13:54     ` Mark Brown
2026-03-23 14:53       ` Miguel Ojeda
2026-03-22 19:46   ` Miguel Ojeda
2026-03-23  8:49     ` Marek Szyprowski
2026-03-25  1:58       ` Miguel Ojeda
2026-03-26 21:12     ` Arnd Bergmann
2026-03-27  8:02       ` Miguel Ojeda
2026-03-27  8:16       ` Marek Szyprowski [this message]
2026-03-23  0:03   ` Miguel Ojeda
2026-03-23  3:04     ` Andrew Lunn
2026-03-23  3:24       ` Miguel Ojeda
2026-03-23 12:54         ` Andrew Lunn
2026-03-23 13:13           ` Gary Guo
2026-03-23 13:28             ` Andrew Lunn
2026-03-23 13:34               ` Miguel Ojeda
2026-03-23 14:39               ` Alice Ryhl
2026-03-23 13:14           ` Miguel Ojeda
2026-03-23 10:03     ` Russell King (Oracle)
2026-03-23 13:26       ` Miguel Ojeda
2026-03-26 10:10       ` Alice Ryhl
2026-03-26 13:47         ` Miguel Ojeda
2026-03-26 14:31           ` Christian Schrefl
2026-03-26 15:18             ` Russell King (Oracle)
2026-03-26 17:30               ` Miguel Ojeda
2026-03-30 21:09                 ` Christian Schrefl
2026-03-31 11:44                   ` Arnd Bergmann
2026-03-26 21:33               ` Arnd Bergmann
2026-03-27  7:56                 ` Geert Uytterhoeven
2026-03-27  9:02                   ` Arnd Bergmann
2026-03-27 13:41                     ` Arnd Bergmann
2026-03-30 12:03                     ` Geert Uytterhoeven
2026-03-30 12:13                       ` Arnd Bergmann
2026-03-30 12:17                         ` Geert Uytterhoeven
2026-03-26 17:31             ` Miguel Ojeda
2026-03-26  2:42   ` Nathan Chancellor
2026-03-26 17:13     ` Miguel Ojeda
2026-03-26  5:34   ` David Gow
2026-03-29 17:33 ` Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9a19ccac-f7ce-4780-a251-f69a1fa45757@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=a.hindborg@kernel.org \
    --cc=abdiel.janulgue@gmail.com \
    --cc=acourbot@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=aliceryhl@google.com \
    --cc=anton.ivanov@cambridgegreys.com \
    --cc=arnd@arndb.de \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=david@davidgow.net \
    --cc=driver-core@lists.linux.dev \
    --cc=gary@garyguo.net \
    --cc=geert@linux-m68k.org \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux.dev \
    --cc=johannes@sipsolutions.net \
    --cc=justinstitt@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-um@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=llvm@lists.linux.dev \
    --cc=lossin@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mmaurer@google.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=nicolas.schier@linux.dev \
    --cc=nsc@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=peterz@infradead.org \
    --cc=richard@nod.at \
    --cc=robin.murphy@arm.com \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tmgross@umich.edu \
    --cc=urezki@gmail.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox