linux-metag.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
To: Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	Haavard Skinnemoen
	<hskinnemoen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Hans-Christian Egtvedt
	<egtvedt-BrfabpQBY5qlHtIdYg32fQ@public.gmane.org>,
	Steven Miao <realmz6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Ley Foon Tan <lftan-EIB2kfCEclfQT0dZR+AlfA@public.gmane.org>,
	David Howells <dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	Koichi Yasutake
	<yasutake.koichi-NAum8xwdG0+S7A1Ibl2khg@public.gmane.org>,
	Chris Metcalf <cmetcalf-d5a29ZRxExrQT0dZR+AlfA@public.gmane.org>,
	linux-snps-arc-IAPFreCvJWPLiZjB17Co1B2eb7JE58TQ@public.gmane.org,
	linux-c6x-dev-jPsnJVOj+W6hPH1hqNUYSQ@public.gmane.org,
	linux-cris-kernel-VrBV9hrLPhE@public.gmane.org,
	linux-parisc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-m68k-cunTk1MwBs8S/qaLPR03pWD2FQJk+8+b@public.gmane.org,
	linux-metag-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	sparclinux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: [PATCH 01/16] dma-mapping: make the generic coherent dma mmap implementation optional
Date: Mon,  9 Nov 2015 19:17:06 +0100	[thread overview]
Message-ID: <1447093041-21832-2-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1447093041-21832-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>

We have a couple architectures that do not want to support this code,
so add another Kconfig symbol that disables the code similar to what we
do for the nommu case.

Signed-off-by: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
---
 arch/Kconfig               | 3 +++
 drivers/base/dma-mapping.c | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 4e949e5..e47995f 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -564,4 +564,7 @@ config OLD_SIGACTION
 config COMPAT_OLD_SIGACTION
 	bool
 
+config ARCH_NO_COHERENT_DMA_MMAP
+	bool
+
 source "kernel/gcov/Kconfig"
diff --git a/drivers/base/dma-mapping.c b/drivers/base/dma-mapping.c
index d95c597..381e39d 100644
--- a/drivers/base/dma-mapping.c
+++ b/drivers/base/dma-mapping.c
@@ -247,7 +247,7 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
 		    void *cpu_addr, dma_addr_t dma_addr, size_t size)
 {
 	int ret = -ENXIO;
-#ifdef CONFIG_MMU
+#if defined(CONFIG_MMU) && !defined(CONFIG_ARCH_NO_COHERENT_DMA_MMAP)
 	unsigned long user_count = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT;
 	unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
 	unsigned long pfn = page_to_pfn(virt_to_page(cpu_addr));
@@ -264,7 +264,7 @@ int dma_common_mmap(struct device *dev, struct vm_area_struct *vma,
 				      user_count << PAGE_SHIFT,
 				      vma->vm_page_prot);
 	}
-#endif	/* CONFIG_MMU */
+#endif	/* CONFIG_MMU && !CONFIG_ARCH_NO_COHERENT_DMA_MMAP */
 
 	return ret;
 }
-- 
1.9.1

  parent reply	other threads:[~2015-11-09 18:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09 18:17 use dma_map_ops for all architectures Christoph Hellwig
2015-11-09 18:17 ` [PATCH 03/16] avr32: convert to dma_map_ops Christoph Hellwig
     [not found] ` <1447093041-21832-1-git-send-email-hch-jcswGhMUV9g@public.gmane.org>
2015-11-09 18:17   ` Christoph Hellwig [this message]
2015-11-09 18:17   ` [PATCH 02/16] arc: " Christoph Hellwig
2015-11-09 18:17   ` [PATCH 04/16] blackfin: " Christoph Hellwig
2015-11-09 18:17   ` [PATCH 15/16] dma-mapping: always provide the dma_map_ops based implementation Christoph Hellwig
2015-11-09 18:17 ` [PATCH 05/16] c6x: convert to dma_map_ops Christoph Hellwig
2015-11-09 18:17 ` [PATCH 06/16] cris: " Christoph Hellwig
2015-11-11 15:07   ` Jesper Nilsson
2015-11-09 18:17 ` [PATCH 07/16] nios2: " Christoph Hellwig
2015-11-09 18:17 ` [PATCH 08/16] frv: " Christoph Hellwig
2015-11-09 18:17 ` [PATCH 09/16] parisc: " Christoph Hellwig
2015-11-09 19:32   ` Helge Deller
2015-11-09 18:17 ` [PATCH 10/16] mn10300: " Christoph Hellwig
2015-11-09 18:17 ` [PATCH 11/16] m68k: " Christoph Hellwig
2015-11-09 18:17 ` [PATCH 12/16] metag: " Christoph Hellwig
2015-11-09 18:17 ` [PATCH 13/16] sparc: use generic dma_set_mask Christoph Hellwig
2015-11-09 18:17 ` [PATCH 14/16] tile: uninline dma_set_mask Christoph Hellwig
2015-11-09 18:17 ` [PATCH 16/16] dma-mapping: remove <asm-generic/dma-coherent.h> Christoph Hellwig

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=1447093041-21832-2-git-send-email-hch@lst.de \
    --to=hch-jcswghmuv9g@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=cmetcalf-d5a29ZRxExrQT0dZR+AlfA@public.gmane.org \
    --cc=dhowells-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=egtvedt-BrfabpQBY5qlHtIdYg32fQ@public.gmane.org \
    --cc=hskinnemoen-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=lftan-EIB2kfCEclfQT0dZR+AlfA@public.gmane.org \
    --cc=linux-c6x-dev-jPsnJVOj+W6hPH1hqNUYSQ@public.gmane.org \
    --cc=linux-cris-kernel-VrBV9hrLPhE@public.gmane.org \
    --cc=linux-m68k-cunTk1MwBs8S/qaLPR03pWD2FQJk+8+b@public.gmane.org \
    --cc=linux-metag-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-parisc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-snps-arc-IAPFreCvJWPLiZjB17Co1B2eb7JE58TQ@public.gmane.org \
    --cc=realmz6-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=sparclinux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=yasutake.koichi-NAum8xwdG0+S7A1Ibl2khg@public.gmane.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).