All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: linux-arch@vger.kernel.org
Cc: Gerhard Pircher <gerhard_pircher@gmx.net>
Subject: [PATCH 1/8] mips: implement dma_mmap_coherent()
Date: Fri, 10 Jul 2009 15:12:32 +0200	[thread overview]
Message-ID: <s5hocrsn0lb.wl%tiwai@suse.de> (raw)
In-Reply-To: s5hprc8n0od.wl%tiwai@suse.de

A lazy version of dma_mmap_coherent() implementation for MIPS.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 arch/mips/include/asm/dma-mapping.h |    4 ++++
 arch/mips/mm/dma-default.c          |   13 +++++++++++++
 2 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h
index d16afdd..475fad3 100644
--- a/arch/mips/include/asm/dma-mapping.h
+++ b/arch/mips/include/asm/dma-mapping.h
@@ -73,6 +73,10 @@ extern int dma_is_consistent(struct device *dev, dma_addr_t dma_addr);
 extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
 	       enum dma_data_direction direction);
 
+#define ARCH_HAS_DMA_MMAP_COHERENT
+extern int dma_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
+			     void *cpu_addr, dma_addr_t handle, size_t size);
+
 #if 0
 #define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
 
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index 7e48e76..6d71a2b 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -367,3 +367,16 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
 }
 
 EXPORT_SYMBOL(dma_cache_sync);
+
+int dma_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
+		      void *cpu_addr, dma_addr_t handle, size_t size)
+{
+	struct page *pg;
+	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+	cpu_addr = (void *)dma_addr_to_virt(handle);
+	pg = virt_to_page(cpu_addr);
+	return remap_pfn_range(vma, vma->vm_start,
+			       page_to_pfn(pg) + vma->vm_pgoff,
+			       size, vma->vm_page_prot);
+}
+EXPORT_SYMBOL(dma_mmap_coherent);
-- 
1.6.3.2

  reply	other threads:[~2009-07-10 13:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-10 13:10 [PATCH 0/8] Add dma_mmap_coherent() for other archs Takashi Iwai
2009-07-10 13:12 ` Takashi Iwai [this message]
2009-07-10 13:13 ` [PATCH 2/8] arm: Define ARCH_HAS_DMA_MMAP_COHERENT Takashi Iwai
2009-07-10 13:13 ` [PATCH 3/8] parisc: implement dma_mmap_coherent() Takashi Iwai
2009-07-10 15:11   ` James Bottomley
2009-07-10 18:16     ` Russell King
2009-07-10 18:30       ` James Bottomley
2009-07-10 18:39         ` Russell King
2009-07-10 18:59           ` James Bottomley
2009-07-17 14:13             ` Takashi Iwai
2009-07-17 19:16               ` James Bottomley
2009-07-19 12:23                 ` Takashi Iwai
2009-07-10 13:14 ` [PATCH 4/8] sh: " Takashi Iwai
2009-07-10 13:14 ` [PATCH 5/8] sparc: " Takashi Iwai
2009-07-10 13:15 ` [PATCH 6/8] powerpc: " Takashi Iwai
2009-07-10 13:15 ` [PATCH 7/8] x86: " Takashi Iwai
2009-07-10 13:16 ` [PATCH 8/8] ia64: " Takashi Iwai

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=s5hocrsn0lb.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=gerhard_pircher@gmx.net \
    --cc=linux-arch@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.