linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: hch@infradead.org (Christoph Hellwig)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 3/7] drivers: dma-coherent: Account dma_pfn_offset when used with device tree
Date: Tue, 20 Jun 2017 06:42:19 -0700	[thread overview]
Message-ID: <20170620134219.GA31496@infradead.org> (raw)
In-Reply-To: <1495621472-9323-4-git-send-email-vladimir.murzin@arm.com>

Wouldn't the smal patch below solve the same issue in a simple way?

diff --git a/drivers/base/dma-coherent.c b/drivers/base/dma-coherent.c
index 640a7e63c453..e8f8447d705b 100644
--- a/drivers/base/dma-coherent.c
+++ b/drivers/base/dma-coherent.c
@@ -290,9 +290,11 @@ EXPORT_SYMBOL(dma_mmap_from_coherent);
 static int rmem_dma_device_init(struct reserved_mem *rmem, struct device *dev)
 {
 	struct dma_coherent_mem *mem = rmem->priv;
+	dma_addr_t dev_addr = ((rmem->base >> PAGE_SHIFT) -
+				dev->dma_pfn_offset) << PAGE_SHIFT;
 
 	if (!mem &&
-	    !dma_init_coherent_memory(rmem->base, rmem->base, rmem->size,
+	    !dma_init_coherent_memory(rmem->base, dev_addr, rmem->size,
 				      DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE,
 				      &mem)) {
 		pr_err("Reserved memory: failed to init DMA memory pool at %pa, size %ld MiB\n",

  reply	other threads:[~2017-06-20 13:42 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24 10:24 [PATCH v5 0/7] ARM: Fix dma_alloc_coherent() and friends for NOMMU Vladimir Murzin
2017-05-24 10:24 ` [PATCH v5 1/7] dma: Take into account dma_pfn_offset Vladimir Murzin
2017-06-20 13:24   ` Christoph Hellwig
2017-06-22 12:47     ` Vladimir Murzin
2017-05-24 10:24 ` [PATCH v5 2/7] dma: Add simple dma_noop_mmap Vladimir Murzin
2017-06-20 13:23   ` Christoph Hellwig
2017-06-22 12:46     ` Vladimir Murzin
2017-06-26  9:45       ` Christoph Hellwig
2017-05-24 10:24 ` [PATCH v5 3/7] drivers: dma-coherent: Account dma_pfn_offset when used with device tree Vladimir Murzin
2017-06-20 13:42   ` Christoph Hellwig [this message]
2017-06-20 13:50     ` Robin Murphy
2017-06-26  9:37       ` Christoph Hellwig
2017-06-22 12:59     ` Vladimir Murzin
2017-05-24 10:24 ` [PATCH v5 4/7] drivers: dma-coherent: Introduce default DMA pool Vladimir Murzin
2017-06-20 13:49   ` Christoph Hellwig
2017-06-20 14:24     ` Robin Murphy
2017-06-26  9:42       ` Christoph Hellwig
2017-06-26 14:08         ` Vladimir Murzin
2017-06-27 14:36         ` Robin Murphy
2017-06-27 15:22           ` Christoph Hellwig
2017-06-22 13:18     ` Vladimir Murzin
2017-06-26  9:44       ` Christoph Hellwig
2017-05-24 10:24 ` [PATCH v5 5/7] ARM: NOMMU: Introduce dma operations for noMMU Vladimir Murzin
2017-05-24 10:24 ` [PATCH v5 6/7] ARM: NOMMU: Set ARM_DMA_MEM_BUFFERABLE for M-class cpus Vladimir Murzin
2017-05-24 10:24 ` [PATCH v5 7/7] ARM: dma-mapping: Remove traces of NOMMU code Vladimir Murzin
2017-06-08  8:28 ` [PATCH v5 0/7] ARM: Fix dma_alloc_coherent() and friends for NOMMU Vladimir Murzin
2017-06-08 16:25   ` Russell King - ARM Linux
2017-06-15  7:25     ` Vladimir Murzin
2017-06-20 12:59       ` Vladimir Murzin
2017-06-20 13:00         ` 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=20170620134219.GA31496@infradead.org \
    --to=hch@infradead.org \
    --cc=linux-arm-kernel@lists.infradead.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 NNTP newsgroup(s).