From: Christoph Hellwig <hch@lst.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>,
Greg Ungerer <gerg@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org,
iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] m68k: implement arch_dma_prep_coherent
Date: Fri, 14 Jun 2019 12:21:26 +0200 [thread overview]
Message-ID: <20190614102126.8402-3-hch@lst.de> (raw)
In-Reply-To: <20190614102126.8402-1-hch@lst.de>
When we remap memory as non-cached to be used as a DMA coherent buffer
we should writeback all cache and invalidate the cache lines so that
we make sure we have a clean slate. Implement this using the
cache_push() helper.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
arch/m68k/Kconfig | 1 +
arch/m68k/kernel/dma.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 2571a8fba4b0..64b122595896 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -4,6 +4,7 @@ config M68K
default y
select ARCH_32BIT_OFF_T
select ARCH_HAS_DMA_MMAP_PGPROT if MMU && !COLDFIRE
+ select ARCH_HAS_DMA_PREP_COHERENT
select ARCH_HAS_SYNC_DMA_FOR_DEVICE if HAS_DMA
select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
select ARCH_NO_COHERENT_DMA_MMAP if !MMU
diff --git a/arch/m68k/kernel/dma.c b/arch/m68k/kernel/dma.c
index 9c6a350a16d8..e720e6eed838 100644
--- a/arch/m68k/kernel/dma.c
+++ b/arch/m68k/kernel/dma.c
@@ -18,6 +18,11 @@
#include <asm/pgalloc.h>
#if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE)
+void arch_dma_prep_coherent(struct page *page, size_t size)
+{
+ cache_push(page_to_phys(page), size);
+}
+
pgprot_t arch_dma_mmap_pgprot(struct device *dev, pgprot_t prot,
unsigned long attrs)
{
--
2.20.1
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2019-06-14 10:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-14 10:21 [RFC] switch m68k to use the generic remapping DMA allocator Christoph Hellwig
2019-06-14 10:21 ` [PATCH 1/2] m68k: use the generic dma coherent remap allocator Christoph Hellwig
2019-06-14 10:21 ` Christoph Hellwig [this message]
2019-06-17 13:39 ` [RFC] switch m68k to use the generic remapping DMA allocator Greg Ungerer
2019-06-17 18:53 ` Geert Uytterhoeven
2019-06-25 6:32 ` Christoph Hellwig
2019-06-25 7:26 ` Geert Uytterhoeven
2019-06-25 7:35 ` Christoph Hellwig
2019-06-25 8:07 ` Geert Uytterhoeven
2019-06-24 7:16 ` Geert Uytterhoeven
2019-06-25 6:33 ` Christoph Hellwig
-- strict thread matches above, loose matches on Subject: below --
2019-06-25 9:01 switch m68k to use the generic remapping DMA allocator v2 Christoph Hellwig
2019-06-25 9:01 ` [PATCH 2/2] m68k: implement arch_dma_prep_coherent 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=20190614102126.8402-3-hch@lst.de \
--to=hch@lst.de \
--cc=geert@linux-m68k.org \
--cc=gerg@linux-m68k.org \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.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