Commit 009fbfc9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'dma-mapping-6.7-2023-10-30' of git://git.infradead.org/users/hch/dma-mapping

Pull dma-mapping updates from Christoph Hellwig:

 - get rid of the fake support for coherent DMA allocation on coldfire
   with caches (Christoph Hellwig)

 - add a few Kconfig dependencies so that Kconfig catches the use of
   invalid configurations (Christoph Hellwig)

 - fix a type in dma-debug output (Chuck Lever)

 - rewrite a comment in swiotlb (Sean Christopherson)

* tag 'dma-mapping-6.7-2023-10-30' of git://git.infradead.org/users/hch/dma-mapping:
  dma-debug: Fix a typo in a debugging eye-catcher
  swiotlb: rewrite comment explaining why the source is preserved on DMA_FROM_DEVICE
  m68k: remove unused includes from dma.c
  m68k: don't provide arch_dma_alloc for nommu/coldfire
  net: fec: use dma_alloc_noncoherent for data cache enabled coldfire
  m68k: use the coherent DMA code for coldfire without data cache
  dma-direct: warn when coherent allocations aren't supported
  dma-direct: simplify the use atomic pool logic in dma_direct_alloc
  dma-direct: add a CONFIG_ARCH_HAS_DMA_ALLOC symbol
  dma-direct: add dependencies to CONFIG_DMA_GLOBAL_POOL
parents 3c86a44d 36d91e85
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ config ARM
	select ARCH_HAS_CPU_FINALIZE_INIT if MMU
	select ARCH_HAS_CURRENT_STACK_POINTER
	select ARCH_HAS_DEBUG_VIRTUAL if MMU
	select ARCH_HAS_DMA_ALLOC if MMU
	select ARCH_HAS_DMA_WRITE_COMBINE if !ARM_DMA_MEM_BUFFERABLE
	select ARCH_HAS_ELF_RANDOMIZE
	select ARCH_HAS_FORTIFY_SOURCE
+3 −3
Original line number Diff line number Diff line
@@ -6,15 +6,15 @@ config M68K
	select ARCH_HAS_BINFMT_FLAT
	select ARCH_HAS_CPU_FINALIZE_INIT if MMU
	select ARCH_HAS_CURRENT_STACK_POINTER
	select ARCH_HAS_DMA_PREP_COHERENT if HAS_DMA && MMU && !COLDFIRE
	select ARCH_HAS_SYNC_DMA_FOR_DEVICE if HAS_DMA
	select ARCH_HAS_DMA_PREP_COHERENT if M68K_NONCOHERENT_DMA && !COLDFIRE
	select ARCH_HAS_SYNC_DMA_FOR_DEVICE if M68K_NONCOHERENT_DMA
	select ARCH_HAVE_NMI_SAFE_CMPXCHG if RMW_INSNS
	select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
	select ARCH_NO_PREEMPT if !COLDFIRE
	select ARCH_USE_MEMTEST if MMU_MOTOROLA
	select ARCH_WANT_IPC_PARSE_VERSION
	select BINFMT_FLAT_ARGVP_ENVP_ON_STACK
	select DMA_DIRECT_REMAP if HAS_DMA && MMU && !COLDFIRE
	select DMA_DIRECT_REMAP if M68K_NONCOHERENT_DMA && !COLDFIRE
	select GENERIC_ATOMIC64
	select GENERIC_CPU_DEVICES
	select GENERIC_IOMAP
+12 −0
Original line number Diff line number Diff line
@@ -535,3 +535,15 @@ config CACHE_COPYBACK
	  The ColdFire CPU cache is set into Copy-back mode.
endchoice
endif # HAVE_CACHE_CB

# Coldfire cores that do not have a data cache configured can do coherent DMA.
config COLDFIRE_COHERENT_DMA
	bool
	default y
	depends on COLDFIRE
	depends on !HAVE_CACHE_CB && !CACHE_D && !CACHE_BOTH

config M68K_NONCOHERENT_DMA
	bool
	default y
	depends on HAS_DMA && !COLDFIRE_COHERENT_DMA
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ obj-$(CONFIG_MMU_MOTOROLA) += ints.o vectors.o
obj-$(CONFIG_MMU_SUN3) += ints.o vectors.o
obj-$(CONFIG_PCI) += pcibios.o

obj-$(CONFIG_HAS_DMA)	+= dma.o
obj-$(CONFIG_M68K_NONCOHERENT_DMA) += dma.o

obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o
obj-$(CONFIG_BOOTINFO_PROC)	+= bootinfo_proc.o
+1 −33
Original line number Diff line number Diff line
@@ -4,20 +4,11 @@
 * for more details.
 */

#undef DEBUG

#include <linux/dma-map-ops.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/scatterlist.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/export.h>

#include <asm/cacheflush.h>

#if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE)
#ifndef CONFIG_COLDFIRE
void arch_dma_prep_coherent(struct page *page, size_t size)
{
	cache_push(page_to_phys(page), size);
@@ -33,29 +24,6 @@ pgprot_t pgprot_dmacoherent(pgprot_t prot)
	}
	return prot;
}
#else
void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
		gfp_t gfp, unsigned long attrs)
{
	void *ret;

	if (dev == NULL || (*dev->dma_mask < 0xffffffff))
		gfp |= GFP_DMA;
	ret = (void *)__get_free_pages(gfp, get_order(size));

	if (ret != NULL) {
		memset(ret, 0, size);
		*dma_handle = virt_to_phys(ret);
	}
	return ret;
}

void arch_dma_free(struct device *dev, size_t size, void *vaddr,
		dma_addr_t dma_handle, unsigned long attrs)
{
	free_pages((unsigned long)vaddr, get_order(size));
}

#endif /* CONFIG_MMU && !CONFIG_COLDFIRE */

void arch_sync_dma_for_device(phys_addr_t handle, size_t size,
Loading