Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3ecc0ff authored by Christoph Hellwig's avatar Christoph Hellwig
Browse files

dma-mapping: move the dma_coherent flag to struct device



Various architectures support both coherent and non-coherent dma on a
per-device basis.  Move the dma_noncoherent flag from the mips archdata
field to struct device proper to prepare the infrastructure for reuse on
other architectures.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarPaul Burton <paul.burton@mips.com>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 5748e1b3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1106,6 +1106,7 @@ config ARCH_SUPPORTS_UPROBES
	bool

config DMA_MAYBE_COHERENT
	select ARCH_HAS_DMA_COHERENCE_H
	select DMA_NONCOHERENT
	bool

+1 −0
Original line number Diff line number Diff line
# MIPS headers
generic-(CONFIG_GENERIC_CSUM) += checksum.h
generic-y += current.h
generic-y += device.h
generic-y += dma-contiguous.h
generic-y += emergency-restart.h
generic-y += export.h

arch/mips/include/asm/device.h

deleted100644 → 0
+0 −19
Original line number Diff line number Diff line
/*
 * Arch specific extensions to struct device
 *
 * This file is released under the GPLv2
 */
#ifndef _ASM_MIPS_DEVICE_H
#define _ASM_MIPS_DEVICE_H

struct dev_archdata {
#ifdef CONFIG_DMA_PERDEV_COHERENT
	/* Non-zero if DMA is coherent with CPU caches */
	bool dma_coherent;
#endif
};

struct pdev_archdata {
};

#endif /* _ASM_MIPS_DEVICE_H*/
+6 −0
Original line number Diff line number Diff line
@@ -20,6 +20,12 @@ enum coherent_io_user_state {
#elif defined(CONFIG_DMA_MAYBE_COHERENT)
extern enum coherent_io_user_state coherentio;
extern int hw_coherentio;

static inline bool dev_is_dma_coherent(struct device *dev)
{
	return coherentio == IO_COHERENCE_ENABLED ||
		(coherentio == IO_COHERENCE_DEFAULT && hw_coherentio);
}
#else
#ifdef CONFIG_DMA_NONCOHERENT
#define coherentio	IO_COHERENCE_DISABLED
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
				      bool coherent)
{
#ifdef CONFIG_DMA_PERDEV_COHERENT
	dev->archdata.dma_coherent = coherent;
	dev->dma_coherent = coherent;
#endif
}

Loading