public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: iommu@lists.linux-foundation.org
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
	Robin Murphy <robin.murphy@arm.com>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] dma-mapping: use phys_to_dma in dma_direct_get_required
Date: Mon, 10 Sep 2018 08:13:32 +0200	[thread overview]
Message-ID: <20180910061332.28187-4-hch@lst.de> (raw)
In-Reply-To: <20180910061332.28187-1-hch@lst.de>

We need to apply an DMA offset for the function to work as expected.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/base/platform.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 7812b861b6da..6feac7294f8d 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -15,7 +15,7 @@
 #include <linux/of_irq.h>
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-direct.h>
 #include <linux/bootmem.h>
 #include <linux/err.h>
 #include <linux/slab.h>
@@ -1185,7 +1185,7 @@ int __init platform_bus_init(void)
  */
 u64 dma_direct_get_required_mask(struct device *dev)
 {
-	u64 end = ((max_pfn - 1) << PAGE_SHIFT);
+	u64 end = phys_to_dma(dev, (max_pfn - 1) << PAGE_SHIFT);
 
 	return (1 << (fls64(end) - 1)) * 2 - 1;
 }
-- 
2.18.0


  parent reply	other threads:[~2018-09-10  6:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-10  6:13 dma_get_required_mask tidyups Christoph Hellwig
2018-09-10  6:13 ` [PATCH 1/3] dma-mapping: make the get_required_mask method available unconditionally Christoph Hellwig
2018-09-10  6:13 ` [PATCH 2/3] dma-mapping: simplify dma_direct get_required_mask Christoph Hellwig
2018-09-10  6:13 ` Christoph Hellwig [this message]
2018-09-19 15:01 ` dma_get_required_mask tidyups 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=20180910061332.28187-4-hch@lst.de \
    --to=hch@lst.de \
    --cc=benh@kernel.crashing.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=robin.murphy@arm.com \
    /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